-
Couldn't load subscription status.
- Fork 0
Add Conductor configuration for Rails workspace setup #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,51 @@ | ||||||||||||||||||||||||||||||||||||||||||||
| #!/bin/bash | ||||||||||||||||||||||||||||||||||||||||||||
| set -e # Exit on any error | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| echo "🚀 Setting up Rails workspace..." | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| # Load mise if available | ||||||||||||||||||||||||||||||||||||||||||||
| if command -v mise &> /dev/null; then | ||||||||||||||||||||||||||||||||||||||||||||
| eval "$(mise activate bash)" | ||||||||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| # Check for required tools | ||||||||||||||||||||||||||||||||||||||||||||
| if ! command -v ruby &> /dev/null; then | ||||||||||||||||||||||||||||||||||||||||||||
| echo "❌ Ruby is not installed. Please install Ruby first." | ||||||||||||||||||||||||||||||||||||||||||||
| exit 1 | ||||||||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| # Check Ruby version | ||||||||||||||||||||||||||||||||||||||||||||
| RUBY_VERSION=$(ruby -v | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -1) | ||||||||||||||||||||||||||||||||||||||||||||
| REQUIRED_VERSION="3.2.0" | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| if [ "$(printf '%s\n' "$REQUIRED_VERSION" "$RUBY_VERSION" | sort -V | head -n1)" != "$REQUIRED_VERSION" ]; then | ||||||||||||||||||||||||||||||||||||||||||||
| echo "❌ Ruby version $RUBY_VERSION is too old. Rails 8.0.3 requires Ruby >= $REQUIRED_VERSION" | ||||||||||||||||||||||||||||||||||||||||||||
| echo " Please update Ruby using a version manager like rbenv, rvm, or asdf." | ||||||||||||||||||||||||||||||||||||||||||||
| exit 1 | ||||||||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| if ! command -v bundle &> /dev/null; then | ||||||||||||||||||||||||||||||||||||||||||||
| echo "❌ Bundler is not installed. Please install Bundler first." | ||||||||||||||||||||||||||||||||||||||||||||
| exit 1 | ||||||||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| # Copy environment files from root if they exist | ||||||||||||||||||||||||||||||||||||||||||||
| if [ -f "$CONDUCTOR_ROOT_PATH/.env" ]; then | ||||||||||||||||||||||||||||||||||||||||||||
| echo "📋 Copying .env file from root..." | ||||||||||||||||||||||||||||||||||||||||||||
| cp "$CONDUCTOR_ROOT_PATH/.env" .env | ||||||||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| if [ -f "$CONDUCTOR_ROOT_PATH/.env.local" ]; then | ||||||||||||||||||||||||||||||||||||||||||||
| echo "📋 Copying .env.local file from root..." | ||||||||||||||||||||||||||||||||||||||||||||
| cp "$CONDUCTOR_ROOT_PATH/.env.local" .env.local | ||||||||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+33
to
+41
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Potentially wrong source path and destructive overwrites for .env files
-# Copy environment files from root if they exist
-if [ -f "$CONDUCTOR_ROOT_PATH/.env" ]; then
- echo "📋 Copying .env file from root..."
- cp "$CONDUCTOR_ROOT_PATH/.env" .env
-fi
-...
-if [ -f "$CONDUCTOR_ROOT_PATH/.env.local" ]; then
- echo "📋 Copying .env.local file from root..."
- cp "$CONDUCTOR_ROOT_PATH/.env.local" .env.local
-fi
+# Copy environment files from repo root (non-destructive)
+ROOT_PATH="${CONDUCTOR_ROOT_PATH:-$(git rev-parse --show-toplevel 2>/dev/null || pwd)}"
+for f in .env .env.local; do
+ if [ -f "$ROOT_PATH/$f" ]; then
+ if [ -e "$f" ]; then
+ echo "⚠️ $f already exists locally; leaving it unchanged."
+ else
+ echo "📋 Copying $f from root..."
+ cp -n "$ROOT_PATH/$f" "$f"
+ fi
+ fi
+done📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| # Install Ruby dependencies | ||||||||||||||||||||||||||||||||||||||||||||
| echo "📦 Installing Ruby gems..." | ||||||||||||||||||||||||||||||||||||||||||||
| bundle install | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| # Clear logs and temp files | ||||||||||||||||||||||||||||||||||||||||||||
| echo "🧹 Cleaning logs and temp files..." | ||||||||||||||||||||||||||||||||||||||||||||
| bin/rails log:clear tmp:clear | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| echo "✅ Setup complete! Click the Run button to start the Rails server." | ||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+4
to
+51
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion | 🟠 Major 🧩 Analysis chainOverall: solid flow; minor polish will improve portability and safety Nice linear setup with clear messages. Address the above to make it cross‑platform and idempotent. Run this script to validate assumptions and files: 🏁 Script executed: #!/bin/bash
set -Eeuo pipefail
echo "Repo root: $(git rev-parse --show-toplevel 2>/dev/null || pwd)"
echo "Ruby: $(command -v ruby || echo 'missing')"
ruby -v || true
echo "Bundler: $(command -v bundle || echo 'missing')"
bundle -v || true
echo "bin/rails present? $( [ -x bin/rails ] && echo yes || echo no )"
echo "bin/dev present? $( [ -x bin/dev ] && echo yes || echo no )"
echo "Procfile.dev present? $( [ -f Procfile.dev ] && echo yes || echo no )"
echo ".ruby-version: $( [ -f .ruby-version ] && cat .ruby-version || echo 'absent')"
echo "Gemfile ruby directive:"
sed -nE 's/^\s*ruby\s+["'\'']([^"'\'']+)["'\''].*/\1/p' Gemfile || trueLength of output: 292 Enable strict mode and compute set -Eeuo pipefail
readonly CONDUCTOR_ROOT_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")"/.. && pwd)"Improve idempotency (optional)
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| { | ||
| "scripts": { | ||
| "setup": "./conductor-setup.sh", | ||
| "run": "bin/dev", | ||
| "archive": "" | ||
|
Comment on lines
+3
to
+5
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chainValidate run target prerequisites Ensure 🏁 Script executed: #!/bin/bash
set -Eeuo pipefail
[ -x bin/dev ] && echo "bin/dev: OK" || echo "bin/dev: MISSING"
[ -f Procfile.dev ] && echo "Procfile.dev: OK" || echo "Procfile.dev: MISSING"
rg -n '^web:|rails' Procfile* || trueLength of output: 83 Add missing Procfile.dev 🤖 Prompt for AI Agents |
||
| }, | ||
| "runScriptMode": "nonconcurrent" | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Non‑portable Ruby version check (‘sort -V’ breaks on macOS/BSD)
sort -Visn’t available on BSD/macOS; the check can falsely fail. Compare via Ruby’s Gem::Version instead.🤖 Prompt for AI Agents