rails_server_hotkeys 1.1.1 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -1
- data/README.md +25 -3
- data/lib/rails_server_hotkeys/boot_hook.rb +5 -2
- data/lib/rails_server_hotkeys/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f8e336ec5e54b395fb44b4767fb7d650b49bca4fe38ff53914cd2fc46def2c21
|
|
4
|
+
data.tar.gz: 3d5d3d0a15856c3bbd6c3da17dbd7d3107ced472ac0d3465ef7a4ecabdc759e2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e1fccacb084b745b9a172005bb92b448b69c317dfee788b03d3ea7a5b2f21193927ffdc80122a0e56a306bfc2f65a0e6bc485b9793dcecc36f9e85d75d848e9c
|
|
7
|
+
data.tar.gz: 044a1c4f63752edcb3a77f7e63fa0d42cdcb9685efed0b3e3a0e6fbdece1a7a0859e90207ef4db2004b2cc4c9c05f94b3a4dc5719da4c97f195f050e8cd38b94
|
data/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/).
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [1.1.2] - 2026-11-01
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
- With Puma 5, the banner was printed before Puma's boot log instead of after `Use Ctrl-C to stop`.
|
|
13
|
+
|
|
9
14
|
## [1.1.1] - 2026-10-31
|
|
10
15
|
|
|
11
16
|
### Changed
|
|
@@ -22,6 +27,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/).
|
|
|
22
27
|
- `o` opens the port the server is actually listening on.
|
|
23
28
|
- Banner shown after Puma's "Use Ctrl-C to stop".
|
|
24
29
|
|
|
25
|
-
[Unreleased]: https://github.com/samuelpismel/rails_server_hotkeys/compare/v1.1.
|
|
30
|
+
[Unreleased]: https://github.com/samuelpismel/rails_server_hotkeys/compare/v1.1.2...HEAD
|
|
31
|
+
[1.1.2]: https://github.com/samuelpismel/rails_server_hotkeys/compare/v1.1.1...v1.1.2
|
|
26
32
|
[1.1.1]: https://github.com/samuelpismel/rails_server_hotkeys/compare/v1.1.0...v1.1.1
|
|
27
33
|
[1.1.0]: https://github.com/samuelpismel/rails_server_hotkeys/releases/tag/v1.1.0
|
data/README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# rails_server_hotkeys
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Keyboard shortcuts for `bin/rails server`.
|
|
4
|
+
|
|
5
|
+
Press `r` to restart the server. No more `touch tmp/restart.txt` in another terminal.
|
|
4
6
|
|
|
5
7
|
```
|
|
6
8
|
=> Booting Puma
|
|
@@ -71,6 +73,7 @@ Only for `rails server`, in the `development` environment, when stdin is a termi
|
|
|
71
73
|
|
|
72
74
|
## Caveats
|
|
73
75
|
|
|
76
|
+
- **Your `config.ru` must call `Rails.application.load_server`.** Rails has generated it since 6.1; apps created on older versions may lack it, and then the gem does nothing. Add it after `run Rails.application`.
|
|
74
77
|
- **Restart needs Puma's `tmp_restart` plugin.** It's in the `config/puma.rb` generated by Rails; if yours lacks it, add `plugin :tmp_restart`.
|
|
75
78
|
- **`bin/dev` (foreman) doesn't forward stdin**, so hotkeys can't work there. Run `bin/rails s` directly, or use overmind and `overmind connect web`.
|
|
76
79
|
- **Unix/macOS only** (uses `stty`). On Windows the gem does nothing.
|
|
@@ -82,6 +85,17 @@ bundle install
|
|
|
82
85
|
bundle exec rake test
|
|
83
86
|
```
|
|
84
87
|
|
|
88
|
+
### Rails and Puma versions
|
|
89
|
+
|
|
90
|
+
`rake test:matrix` boots a real `bin/rails server` in a pseudo-terminal for each Rails/Puma combination in `gemfiles/` and checks the banner, `r` and `q`:
|
|
91
|
+
|
|
92
|
+
```sh
|
|
93
|
+
bundle exec rake test:matrix
|
|
94
|
+
bundle exec rake test:matrix GEMFILES=rails_8.1 # only matching gemfiles
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
The first run installs each bundle, so it takes a while. To add a combination, copy one of the files in `gemfiles/`.
|
|
98
|
+
|
|
85
99
|
### Trying it in a dummy app
|
|
86
100
|
|
|
87
101
|
The unit tests run without Rails, but hotkeys only show up for real under `rails server` in a terminal. To try your changes by hand, create a throwaway app next to the gem:
|
|
@@ -93,7 +107,7 @@ rails new hotkeys-dummy --minimal --skip-git
|
|
|
93
107
|
cd hotkeys-dummy
|
|
94
108
|
|
|
95
109
|
# Point the app at your local copy of the gem
|
|
96
|
-
echo 'gem "
|
|
110
|
+
echo 'gem "rails_server_hotkeys", path: "../restart-rails-hotkeys", group: :development' >> Gemfile
|
|
97
111
|
bundle install
|
|
98
112
|
|
|
99
113
|
bin/rails s
|
|
@@ -101,7 +115,7 @@ bin/rails s
|
|
|
101
115
|
|
|
102
116
|
Adjust the `path:` if your clone has a different folder name.
|
|
103
117
|
|
|
104
|
-
You should see this in
|
|
118
|
+
You should see this in green, right after Puma's `Use Ctrl-C to stop`:
|
|
105
119
|
|
|
106
120
|
```
|
|
107
121
|
› Press r to restart, h for help
|
|
@@ -117,6 +131,14 @@ Things to check:
|
|
|
117
131
|
|
|
118
132
|
Because the gem is loaded through `path:`, edits to it take effect on the next restart: press `r` instead of stopping the server. You don't need to run `bundle install` again unless you change the gemspec.
|
|
119
133
|
|
|
134
|
+
## Acknowledgments
|
|
135
|
+
|
|
136
|
+
Inspired by the keyboard shortcuts in [Expo CLI](https://docs.expo.dev/more/expo-cli/).
|
|
137
|
+
|
|
138
|
+
## A note to the Rails team
|
|
139
|
+
|
|
140
|
+
If you find this useful, feel free to bring the idea into Rails itself.
|
|
141
|
+
|
|
120
142
|
## License
|
|
121
143
|
|
|
122
144
|
MIT
|
|
@@ -18,9 +18,12 @@ module RailsServerHotkeys
|
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
# When Rails runs server blocks, the Puma handler is chosen but
|
|
21
|
-
# Puma::Events isn't required yet.
|
|
21
|
+
# Puma::Events isn't required yet. Puma 5's handler only defines
|
|
22
|
+
# Rack::Handler::Puma, so ::Puma itself may not exist yet either.
|
|
22
23
|
def self.load_puma_events
|
|
23
|
-
|
|
24
|
+
return if defined?(::Puma::Events)
|
|
25
|
+
|
|
26
|
+
require "puma/events" if defined?(::Puma) || defined?(::Rack::Handler::Puma)
|
|
24
27
|
rescue LoadError
|
|
25
28
|
nil
|
|
26
29
|
end
|