Commit 3449c0d
Refactor bin/dev to use ReactOnRails::Dev classes with clear Procfile management
This commit significantly refactors the bin/dev development server script to improve
maintainability, testing, and user experience with clear Procfile documentation.
## Key Changes
### 🏗️ **Architecture Improvements**
- **Extracted bin/dev logic** into `ReactOnRails::Dev` module classes:
- `ServerManager` - Main server orchestration and command routing
- `ProcessManager` - Overmind/Foreman process management
- `PackGenerator` - React on Rails pack generation
- `FileManager` - Cleanup of stale socket/pid files
- **Modular design** allows for easy extension and testing
- **Clean API** for programmatic usage: `ReactOnRails::Dev::ServerManager.start(:mode, "procfile")`
### 📋 **Clear Procfile Management**
- **Explicit Procfile mapping** for each command:
- `bin/dev` (HMR) → `Procfile.dev`
- `bin/dev static` → `Procfile.dev-static-assets`
- `bin/dev prod` → `Procfile.dev-prod-assets`
- **Prominent boxed display** shows which Procfile is being used:
```
┌──────────────────────────────────────────────────────────┐
│ 📋 Using Procfile: Procfile.dev │
│ 💡 Access at: http://localhost:3000 │
│ 🔧 Customize this file for your app's needs │
└──────────────────────────────────────────────────────────┘
```
- **Port information** prominently displayed (3000 for dev/static, 3001 for prod)
### ✅ **Fixed Pack Generation**
- **Single pack generation** per mode (eliminates duplication)
- **Clean shakapacker binstubs** - removed React on Rails specific code
- **Proper execution order**: Pack generation → Procfile start
- **Maintainable approach** - no custom webpack binary modifications
### 📚 **Enhanced Documentation**
- **Comprehensive help** shows Procfile mapping and customization options
- **Clear comments** in bin/dev explain customization hierarchy
- **Process manager detection** in installation success message
### 🧪 **Testing Infrastructure**
- **Complete RSpec test suite** for all ReactOnRails::Dev classes
- **Isolated unit tests** with proper mocking
- **Updated existing tests** to work with new architecture
## Breaking Changes
None - bin/dev commands work identically to before.
## Migration Path
Existing bin/dev usage remains unchanged. For advanced customization:
1. Edit appropriate Procfile (recommended)
2. Modify bin/dev script for project-specific behavior
3. Extend ReactOnRails::Dev classes for advanced customization
## Benefits
- **🔧 Clear customization path** via Procfiles
- **🧹 Cleaner codebase** with separated concerns
- **🧪 Testable components** with full RSpec coverage
- **📖 Better documentation** and user guidance
- **⚡ Improved development experience** with prominent UI
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>1 parent 47fdabc commit 3449c0d
File tree
28 files changed
+830
-341
lines changed- lib
- generators/react_on_rails
- bin
- templates
- base/base/bin
- dev_tests/spec/system
- react_on_rails
- dev
- server_rendering_pool
- test_helper
- rakelib
- spec
- dummy
- bin
- spec/helpers
- react_on_rails
- binstubs
- dev
28 files changed
+830
-341
lines changedLines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
| 37 | + | |
36 | 38 | | |
37 | 39 | | |
38 | 40 | | |
| |||
258 | 260 | | |
259 | 261 | | |
260 | 262 | | |
261 | | - | |
262 | 263 | | |
263 | 264 | | |
264 | 265 | | |
| |||
271 | 272 | | |
272 | 273 | | |
273 | 274 | | |
274 | | - | |
275 | | - | |
276 | 275 | | |
277 | 276 | | |
278 | 277 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | | - | |
200 | | - | |
201 | | - | |
202 | | - | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | | - | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | | - | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
241 | | - | |
242 | | - | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
243 | 28 | | |
244 | 29 | | |
245 | 30 | | |
246 | 31 | | |
247 | 32 | | |
248 | | - | |
| 33 | + | |
249 | 34 | | |
250 | | - | |
| 35 | + | |
251 | 36 | | |
252 | | - | |
| 37 | + | |
253 | 38 | | |
254 | | - | |
| 39 | + | |
255 | 40 | | |
256 | | - | |
| 41 | + | |
257 | 42 | | |
258 | 43 | | |
259 | 44 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
0 commit comments