11#!/usr/bin/env ruby 
22# frozen_string_literal: true 
33
4+ require  "English" 
5+ 
46def  installed? ( process ) 
57  IO . popen  "#{ process }  
68rescue  Errno ::ENOENT 
79  false 
810end 
911
1012def  generate_packs 
11-   puts  "Generating React on Rails packs..." 
13+   puts  "📦  Generating React on Rails packs..." 
1214  system  "bundle exec rake react_on_rails:generate_packs" 
13-    
14-   unless  $? . success? 
15-      puts   "Pack generation failed" 
16-      exit   1 
17-   end 
15+ 
16+   return   if  $CHILD_STATUS . success? 
17+ 
18+   puts   "❌ Pack generation failed" 
19+   exit   1 
1820end 
1921
2022def  run_production_like 
21-   puts  "Starting production-like development server..." 
23+   puts  "🏭  Starting production-like development server..." 
2224  puts  "   - Generating React on Rails packs" 
2325  puts  "   - Precompiling assets with production optimizations" 
2426  puts  "   - Running Rails server on port 3001" 
2527  puts  "   - No HMR (Hot Module Replacement)" 
2628  puts  "   - CSS extracted to separate files (no FOUC)" 
2729  puts  "" 
28-   puts  "Access at: http://localhost:3001" 
30+   puts  "💡  Access at: http://localhost:3001" 
2931  puts  "" 
30-    
32+ 
3133  # Generate React on Rails packs first 
3234  generate_packs 
33-    
35+ 
3436  # Precompile assets in production mode 
35-   puts  "Precompiling assets..." 
37+   puts  "🔨  Precompiling assets..." 
3638  system  "RAILS_ENV=production NODE_ENV=production bundle exec rails assets:precompile" 
37-    
38-   if  $? . success? 
39-     puts  "Assets precompiled successfully" 
40-     puts  "Starting Rails server in production mode..." 
39+ 
40+   if  $CHILD_STATUS . success? 
41+     puts  "✅  Assets precompiled successfully" 
42+     puts  "🚀  Starting Rails server in production mode..." 
4143    puts  "" 
4244    puts  "Press Ctrl+C to stop the server" 
4345    puts  "To clean up: rm -rf public/packs && bin/dev" 
4446    puts  "" 
45-      
47+ 
4648    # Start Rails in production mode 
4749    system  "RAILS_ENV=production bundle exec rails server -p 3001" 
4850  else 
49-     puts  "Asset precompilation failed" 
51+     puts  "❌  Asset precompilation failed" 
5052    exit  1 
5153  end 
5254end 
5355
5456def  run_static_development 
55-   puts  "Starting development server with static assets..." 
57+   puts  "⚡  Starting development server with static assets..." 
5658  puts  "   - Generating React on Rails packs" 
5759  puts  "   - Using shakapacker --watch (no HMR)" 
5860  puts  "   - CSS extracted to separate files (no FOUC)" 
5961  puts  "   - Development environment (source maps, faster builds)" 
6062  puts  "   - Auto-recompiles on file changes" 
6163  puts  "" 
62-   puts  "Access at: http://localhost:3000" 
64+   puts  "💡  Access at: http://localhost:3000" 
6365  puts  "" 
64-    
66+ 
6567  # Generate React on Rails packs first 
6668  generate_packs 
67-    
69+ 
6870  if  installed?  "overmind" 
6971    system  "overmind start -f Procfile.dev-static" 
7072  elsif  installed?  "foreman" 
8688
8789def  run_development ( process ) 
8890  generate_packs 
89-    
91+ 
9092  system  "#{ process }  
9193rescue  Errno ::ENOENT 
9294  warn  <<~MSG 
@@ -104,37 +106,37 @@ elsif ARGV[0] == "static"
104106elsif  ARGV [ 0 ]  == "help"  || ARGV [ 0 ]  == "--help"  || ARGV [ 0 ]  == "-h" 
105107  puts  <<~HELP 
106108    Usage: bin/dev [command] 
107-      
109+ 
108110    Commands: 
109111      (none) / hmr        Start development server with HMR (default) 
110112      static              Start development server with static assets (no HMR, no FOUC) 
111113      production-assets   Start with production-optimized assets (no HMR) 
112114      prod                Alias for production-assets 
113115      help                Show this help message 
114-         
116+     #{ '  ' }  
115117    HMR Development mode (default): 
116-     -  Hot Module Replacement (HMR) enabled 
117-     -  Automatic React on Rails pack generation 
118-     -  Source maps for debugging 
119-     -  May have Flash of Unstyled Content (FOUC) 
120-     -  Fast recompilation 
121-     -  Access at: http://localhost:3000 
122-      
118+     •  Hot Module Replacement (HMR) enabled 
119+     •  Automatic React on Rails pack generation 
120+     •  Source maps for debugging 
121+     •  May have Flash of Unstyled Content (FOUC) 
122+     •  Fast recompilation 
123+     •  Access at: http://localhost:3000 
124+ 
123125    Static development mode: 
124-     -  No HMR (static assets with auto-recompilation) 
125-     -  Automatic React on Rails pack generation 
126-     -  CSS extracted to separate files (no FOUC) 
127-     -  Development environment (faster builds than production) 
128-     -  Source maps for debugging 
129-     -  Access at: http://localhost:3000 
130-      
131-     Production-like  mode: 
132-     -  Automatic React on Rails pack generation 
133-     -  Optimized, minified bundles 
134-     -  Extracted CSS files (no FOUC) 
135-     -  No HMR (static assets) 
136-     -  Slower recompilation 
137-     -  Access at: http://localhost:3001 
126+     •  No HMR (static assets with auto-recompilation) 
127+     •  Automatic React on Rails pack generation 
128+     •  CSS extracted to separate files (no FOUC) 
129+     •  Development environment (faster builds than production) 
130+     •  Source maps for debugging 
131+     •  Access at: http://localhost:3000 
132+ 
133+     Production-assets  mode: 
134+     •  Automatic React on Rails pack generation 
135+     •  Optimized, minified bundles 
136+     •  Extracted CSS files (no FOUC) 
137+     •  No HMR (static assets) 
138+     •  Slower recompilation 
139+     •  Access at: http://localhost:3001 
138140  HELP 
139141elsif  ARGV [ 0 ]  == "hmr"  || ARGV [ 0 ] . nil? 
140142  # Default development mode (HMR) 
0 commit comments