Commit a403aa2
Fix precompile hook to properly locate Rails root
Add find_rails_root helper that walks upward from current directory
looking for config/environment.rb to locate the Rails root, instead
of assuming the current working directory is the Rails root.
Changes:
- Add find_rails_root() method that searches parent directories
- Returns nil if Rails root cannot be found (reaches filesystem root)
- Update generate_packs_if_needed to use Rails root for all paths
- Build absolute path to config/initializers/react_on_rails.rb
Benefits:
- Works regardless of current working directory
- More robust when hook is called from subdirectories
- Gracefully handles non-Rails environments
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>1 parent dabb298 commit a403aa2
1 file changed
+23
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
10 | 23 | | |
11 | 24 | | |
12 | 25 | | |
| |||
36 | 49 | | |
37 | 50 | | |
38 | 51 | | |
| 52 | + | |
39 | 53 | | |
40 | | - | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
41 | 61 | | |
42 | 62 | | |
43 | | - | |
| 63 | + | |
44 | 64 | | |
45 | 65 | | |
46 | 66 | | |
| |||
65 | 85 | | |
66 | 86 | | |
67 | 87 | | |
| 88 | + | |
68 | 89 | | |
69 | 90 | | |
70 | 91 | | |
| |||
0 commit comments