Keep Codex running with new 3.4.7 Ruby

Added Ruby version compatibility check and handling in codex-env script.

Signed-off-by: Juan José Mata <juanjo.mata@gmail.com>
This commit is contained in:
Juan José Mata
2025-11-14 09:54:22 +01:00
committed by GitHub
parent ebcd6360fd
commit 972648b66d

View File

@@ -37,6 +37,20 @@ runuser -l postgres -c "createuser -s $(whoami)" 2>/dev/null || echo "User may a
echo "Starting Redis server..."
service redis-server start
# Check Ruby version compatibility
RUBY_VERSION=$(cat .ruby-version | tr -d '[:space:]')
CURRENT_RUBY=$(ruby -v | awk '{print $2}' | cut -d'p' -f1)
echo "Ruby version check: $CURRENT_RUBY (required: $RUBY_VERSION)"
# Removing Ruby version requirement from Gemfile
if [ "$CURRENT_RUBY" != "$RUBY_VERSION" ]; then
echo "Ruby version mismatch — commenting ruby version requirement in Gemfile..."
# Only comment if the line isn't already commented
sed -i 's/^ruby file: "\.ruby-version"$/#&/' Gemfile
# Ignore Gemfile changes for this session
git update-index --assume-unchanged Gemfile Gemfile.lock
fi
echo "Environment setup completed successfully!"
echo "PostgreSQL and Redis are now running."
echo "You can now run 'bin/setup' to prepare your Rails application and database."