Skip to content

Commit 9f6ed6a

Browse files
justin808claude
andauthored
Add Conductor configuration for streamlined development (#1837)
This PR adds Conductor support to React on Rails, enabling developers to quickly set up isolated workspaces for parallel development. ## Features added: - **conductor.json**: Main configuration file with multiple script commands - `run`: Starts the dummy app development server (cd spec/dummy && bin/dev) - `test`: Runs the dummy app test suite - `lint`: Runs both Ruby and JavaScript linters - **conductor-setup.sh**: Automated workspace setup script that: - Validates Ruby (>= 3.0) and Node.js (>= 20.0) versions - Installs all dependencies (Ruby gems and JavaScript packages) - Builds the TypeScript package - Sets up git hooks for linting - Copies environment files from the root repository ## Benefits: - Quick workspace creation for parallel development - Automated environment validation and setup - Consistent development environment across team members - Multiple run commands for different workflows 🤖 Generated with Claude Code Co-authored-by: Claude <[email protected]>
1 parent e4a9a64 commit 9f6ed6a

File tree

2 files changed

+97
-0
lines changed

2 files changed

+97
-0
lines changed

conductor-setup.sh

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
#!/bin/zsh
2+
set -e
3+
4+
# Initialize ASDF if available (for proper Ruby/Node versions)
5+
if [[ -f ~/.asdf/asdf.sh ]]; then
6+
source ~/.asdf/asdf.sh
7+
elif command -v asdf >/dev/null 2>&1; then
8+
# For homebrew-installed asdf
9+
if [[ -f /opt/homebrew/opt/asdf/libexec/asdf.sh ]]; then
10+
source /opt/homebrew/opt/asdf/libexec/asdf.sh
11+
fi
12+
fi
13+
14+
echo "🚀 Setting up React on Rails workspace..."
15+
16+
# Check required tools
17+
echo "📋 Checking required tools..."
18+
command -v bundle >/dev/null 2>&1 || { echo "❌ Error: bundler is not installed. Please install Ruby and bundler first."; exit 1; }
19+
command -v yarn >/dev/null 2>&1 || { echo "❌ Error: yarn is not installed. Please install yarn first."; exit 1; }
20+
command -v node >/dev/null 2>&1 || { echo "❌ Error: Node.js is not installed. Please install Node.js first."; exit 1; }
21+
22+
# Check Ruby version
23+
RUBY_VERSION=$(ruby -v | awk '{print $2}')
24+
MIN_RUBY_VERSION="3.0.0"
25+
if [[ $(echo -e "$MIN_RUBY_VERSION\n$RUBY_VERSION" | sort -V | head -n1) != "$MIN_RUBY_VERSION" ]]; then
26+
echo "❌ Error: Ruby version $RUBY_VERSION is too old. React on Rails requires Ruby >= 3.0.0"
27+
echo " Please upgrade Ruby using rbenv, rvm, or your system package manager."
28+
exit 1
29+
fi
30+
echo "✅ Ruby version: $RUBY_VERSION"
31+
32+
# Check Node version
33+
NODE_VERSION=$(node -v | cut -d'v' -f2)
34+
MIN_NODE_VERSION="20.0.0"
35+
if [[ $(echo -e "$MIN_NODE_VERSION\n$NODE_VERSION" | sort -V | head -n1) != "$MIN_NODE_VERSION" ]]; then
36+
echo "❌ Error: Node.js version v$NODE_VERSION is too old. React on Rails requires Node.js >= 20.0.0"
37+
echo " Please upgrade Node.js using nvm, asdf, or your system package manager."
38+
exit 1
39+
fi
40+
echo "✅ Node.js version: v$NODE_VERSION"
41+
42+
# Copy any environment files from root if they exist
43+
if [ -f "$CONDUCTOR_ROOT_PATH/.env" ]; then
44+
echo "📝 Copying .env file..."
45+
cp "$CONDUCTOR_ROOT_PATH/.env" .env
46+
fi
47+
48+
if [ -f "$CONDUCTOR_ROOT_PATH/.env.local" ]; then
49+
echo "📝 Copying .env.local file..."
50+
cp "$CONDUCTOR_ROOT_PATH/.env.local" .env.local
51+
fi
52+
53+
# Install Ruby dependencies
54+
echo "💎 Installing Ruby dependencies..."
55+
bundle install
56+
57+
# Install JavaScript dependencies
58+
echo "📦 Installing JavaScript dependencies..."
59+
yarn install
60+
61+
# Build the TypeScript package
62+
echo "🔨 Building TypeScript package..."
63+
yarn run build
64+
65+
# Generate the node package
66+
echo "📦 Generating node package..."
67+
rake node_package
68+
69+
# Install git hooks for linting
70+
echo "🪝 Installing git hooks..."
71+
bundle exec lefthook install || echo "⚠️ Could not install lefthook hooks"
72+
73+
# Run initial linting to ensure everything is set up correctly
74+
echo "✅ Running initial linting checks..."
75+
bundle exec rubocop --version
76+
yarn run type-check || echo "⚠️ Type checking had issues"
77+
78+
echo "✨ Workspace setup complete!"
79+
echo ""
80+
echo "📚 Key commands:"
81+
echo " • rake - Run all tests and linting"
82+
echo " • rake run_rspec - Run Ruby tests"
83+
echo " • yarn run test - Run JavaScript tests"
84+
echo " • bundle exec rubocop - Run Ruby linting (required before commits)"
85+
echo " • rake autofix - Auto-fix formatting issues"
86+
echo ""
87+
echo "⚠️ Remember: Always run 'bundle exec rubocop' before committing!"

conductor.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"scripts": {
3+
"setup": "./conductor-setup.sh",
4+
"run": "cd spec/dummy && bin/dev",
5+
"test": "rake run_rspec:dummy",
6+
"lint": "bundle exec rubocop && yarn run lint",
7+
"archive": ""
8+
},
9+
"runScriptMode": "nonconcurrent"
10+
}

0 commit comments

Comments
 (0)