relaunch 0.0.1 → 0.16.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7543c504a88b79b545e121afd8c2b8bddc2673d4764cadaf0b817f6fb5dbbe24
4
- data.tar.gz: 81562d259bce572f74a3a98df8346358c68055357f360d508de8043f9313a66a
3
+ metadata.gz: b82966b5c2f6770cbe54fa75491aea07e93b748675b1addc9c199bce27726a83
4
+ data.tar.gz: 54208d5f0a33f47e20e8e18e443038180263197e8e7d1cf4aa15a90704e4b674
5
5
  SHA512:
6
- metadata.gz: a429a3d623011e6e0533b198f3bf602060152ce67c6e322e89068c5c28e20b84a435641775ad2121018cdebf6296f1c04c9b00661c2c70ef2cb91f370353b70b
7
- data.tar.gz: 96d0f925067fb43885016a02ac17064687b24b4d01180ceb81858d5465181dd2c2dabc2441b6bf219908cc1a3197454a97715c14673a9daf2350b4516f5eca9c
6
+ metadata.gz: 94a29158b46f63ad14222bb8618f794134c3711320c89d8081183c1d9299e4153d52fedd3538a77cc5ad0d17351807cff690fd7c247f9ef97874c117706db322
7
+ data.tar.gz: d64f7e8adbefe1be146c54ee61cecdc666b06fff0c36340af5243aa207994e3a64a9de03970c4cd7d74a7402f23d5dcdbd47aa9ba33bfeda5e9f4e7e77e3195c
data/Changelog.md ADDED
@@ -0,0 +1,32 @@
1
+ # Changelog
2
+
3
+ ## 0.16.0
4
+
5
+ - Fix an intermittent crash when restarting a command with `--exit` by
6
+ sharing the child's exit-status waiter between startup and shutdown.
7
+ ([#4](https://github.com/spinels/relaunch/pull/4))
8
+
9
+ - Enable keyboard controls only when standard input is a terminal and, on
10
+ Unix, the runner is in its foreground process group. This avoids stops
11
+ under supervisors such as Overman and `stty` warnings with redirected
12
+ input while preserving file watching and automatic restarts.
13
+ ([#3](https://github.com/spinels/relaunch/pull/3))
14
+
15
+ ## 0.15.0
16
+
17
+ - Require Ruby 3.3 or newer.
18
+ ([29a07e1](https://github.com/spinels/relaunch/commit/29a07e19033f828720d5b563e98df09ca5c054dd))
19
+ - Publish as `relaunch`, preserving the `rerun` command, `.rerun`
20
+ configuration, and `Rerun` namespace.
21
+ ([b1f9165](https://github.com/spinels/relaunch/commit/b1f91653f800e53f9cd421f844a8dc7d9c366839))
22
+ - Add `relaunch` as a command alias and `require "relaunch"` as an entry
23
+ point to the existing library.
24
+ ([b1f9165](https://github.com/spinels/relaunch/commit/b1f91653f800e53f9cd421f844a8dc7d9c366839))
25
+ - Support Ruby 4.0 keyboard input using upstream's `IO#wait_readable` fix.
26
+ ([b00ffc6](https://github.com/alexch/rerun/commit/b00ffc6fb7e2c9da676a672200678da0154a60a1))
27
+ - Raise `Rerun::ExitException` when the runner exits so library callers can
28
+ handle shutdown. The command continues to exit successfully.
29
+ ([072c356](https://github.com/spinels/relaunch/commit/072c3561fd1581ac2c954c239202e755265de7e2))
30
+
31
+ Earlier Rerun releases are documented in the
32
+ [upstream version history](README.md#version-history).
data/Fork.md ADDED
@@ -0,0 +1,59 @@
1
+ # Fork history
2
+
3
+ Relaunch is a fork of [alexch/rerun](https://github.com/alexch/rerun).
4
+ Functional changes are listed newest first.
5
+
6
+ ## September 13, 2026: Preserve exit status during restart
7
+
8
+ Fix [#1](https://github.com/spinels/relaunch/issues/1), an intermittent
9
+ `undefined method 'success?' for nil` crash when restarting with `--exit`.
10
+ Shutdown now waits for the existing detached process waiter instead of
11
+ collecting the child's status with a competing `Process.wait` call.
12
+
13
+ ## September 13, 2026: Require a foreground terminal for keyboard controls
14
+
15
+ [a4d833e](https://github.com/spinels/relaunch/commit/a4d833e11ce32caf96dde784e9a65950f5df76c2)
16
+ enables keyboard controls only when standard input is a terminal and, on
17
+ Unix, the runner belongs to its foreground process group. This prevents
18
+ terminal access from stopping background process groups under supervisors
19
+ such as Overman and avoids repeated `stty` warnings with redirected input.
20
+
21
+ File watching and automatic restarts remain enabled when keyboard controls
22
+ are unavailable. The `--background` option still disables keyboard controls
23
+ explicitly.
24
+
25
+ ## September 13, 2026: Minimum Ruby version
26
+
27
+ Relaunch requires Ruby 3.3 or newer.
28
+
29
+ ## September 13, 2026: Relaunch gem and command alias
30
+
31
+ The fork uses the gem name `relaunch`, with 0.15.0 as its first planned
32
+ release. Like [Overman](https://github.com/spinels/overman), it has its own
33
+ package identity while retaining compatibility with upstream usage.
34
+
35
+ The `rerun` executable, `.rerun` configuration, `require "rerun"`, and the
36
+ `Rerun` namespace are preserved. The additional `relaunch` executable loads
37
+ the existing command, and `require "relaunch"` loads the same library.
38
+ Applications can replace the `rerun` gem with `relaunch` without changing
39
+ their commands or configuration.
40
+
41
+ ## September 13, 2026: Ruby 4.0 keyboard input compatibility
42
+
43
+ [f2b5cf5](https://github.com/spinels/rerun/commit/f2b5cf5e641e6709d40a8fa03b961e9560ff0e6f)
44
+ merged upstream while retaining the fork's exit handling. The import
45
+ includes upstream's
46
+ [b00ffc6](https://github.com/alexch/rerun/commit/b00ffc6fb7e2c9da676a672200678da0154a60a1),
47
+ which uses `IO#wait_readable` when available and falls back to `IO#ready?`
48
+ for older Rubies, fixing keyboard input compatibility with Ruby 4.0.
49
+
50
+ ## January 26, 2026: Let callers handle runner exits
51
+
52
+ [072c356](https://github.com/spinels/rerun/commit/072c3561fd1581ac2c954c239202e755265de7e2)
53
+ introduced `Rerun::ExitException`. The runner raises it instead of calling
54
+ `exit` when stopping or handling a launch error, allowing tests and library
55
+ callers to catch it. The `rerun` executable catches the exception and exits
56
+ successfully, preserving its command-line behavior.
57
+
58
+ This remains a runtime difference from upstream and should be preserved
59
+ when importing upstream changes.
data/LICENSE ADDED
@@ -0,0 +1,34 @@
1
+ Rerun
2
+ Copyright (c) 2009 Alex Chaffee <alex@stinky.com>
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to
6
+ deal in the Software without restriction, including without limitation the
7
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8
+ sell copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in
12
+ all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17
+ THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
18
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
+
21
+ ---
22
+
23
+ rerun partially based on code from Rspactor
24
+ Copyright (c) 2009 Mislav Marohnić
25
+ License as above (MIT open source).
26
+
27
+ rerun partially based on code from FileSystemWatcher
28
+ http://paulhorman.com/filesystemwatcher/
29
+ No license provided; assumed public domain.
30
+
31
+ rerun partially based on code from Shotgun
32
+ Copyright (c) 2009 Ryan Tomayko <tomayko.com/about>
33
+ License as above (MIT open source).
34
+
data/README.md ADDED
@@ -0,0 +1,491 @@
1
+ # Relaunch (`alexch/rerun` fork)
2
+
3
+ [![CI](https://github.com/spinels/relaunch/actions/workflows/ci.yml/badge.svg)](https://github.com/spinels/relaunch/actions/workflows/ci.yml)
4
+
5
+ Relaunch is a drop-in replacement for [Rerun](https://github.com/alexch/rerun).
6
+ Install the `relaunch` gem in place of `rerun`. Existing `rerun` commands,
7
+ `.rerun` configuration, `require "rerun"`, and the `Rerun` namespace keep working.
8
+ The new `relaunch` command is an alias for `rerun`; `require "relaunch"` also
9
+ loads `Rerun`.
10
+
11
+ See [Changelog.md](Changelog.md) for release notes and [Fork.md](Fork.md)
12
+ for the fork history.
13
+
14
+ ```sh
15
+ relaunch overman start
16
+ ```
17
+
18
+ Rerun launches your program, then watches the filesystem. If a relevant file
19
+ changes, then it restarts your program.
20
+
21
+ Rerun works for both long-running processes (e.g. apps) and short-running ones
22
+ (e.g. tests). It's basically a no-frills command-line alternative to Guard,
23
+ Shotgun, Autotest, etc. that doesn't require config files and works on any
24
+ command, not just Ruby programs.
25
+
26
+ Rerun's advantage is its simple design. Since it uses `exec` and the standard
27
+ Unix `SIGINT` and `SIGKILL` signals, you're sure the restarted app is really
28
+ acting just like it was when you ran it from the command line the first time.
29
+
30
+ By default it watches files ending in: `rb,js,coffee,css,scss,sass,erb,html,haml,ru,yml,slim,md,feature,c,h`.
31
+ Use the `--pattern` option if you want to change this.
32
+
33
+ As of version 0.7.0, we use the Listen gem, which tries to use your OS's
34
+ built-in facilities for monitoring the filesystem, so CPU use is very light.
35
+
36
+ **UPDATE**: Now Rerun *does* work on Windows! Caveats:
37
+ * not well-tested
38
+ * you need to press Enter after keypress input
39
+ * you may need to install the `wdm` gem manually: `gem install wdm`
40
+ * You may see this persistent `INFO` error message; to remove it, use`--no-notify`:
41
+ * `INFO: Could not find files for the given pattern(s)`
42
+
43
+ # Installation:
44
+
45
+ gem install relaunch
46
+
47
+ ("sudo" may be required on older systems, but try it without sudo first.)
48
+
49
+ If you are using RVM you might want to put this in your global gemset so it's
50
+ available to all your apps. (There really should be a better way to distinguish
51
+ gems-as-libraries from gems-as-tools.)
52
+
53
+ rvm @global do gem install relaunch
54
+
55
+ The Listen gem looks for certain platform-dependent gems, and will complain if
56
+ they're not available. Unfortunately, Rubygems doesn't understand optional
57
+ dependencies very well, so you may have to install extra gems (and/or put them
58
+ in your Gemfile) to make Rerun work more smoothly on your system.
59
+ (Learn more at <https://github.com/guard/listen#listen-adapters>.)
60
+
61
+ On Mac OS X, use
62
+
63
+ gem install rb-fsevent
64
+
65
+ On Windows, use
66
+
67
+ gem install wdm
68
+
69
+ On *BSD, use
70
+
71
+ gem install rb-kqueue
72
+
73
+ ## Installation via Gemfile / Bundler
74
+
75
+ If you are using rerun inside an existing Ruby application (like a Rails or Sinatra app), you can add it to your Gemfile:
76
+
77
+ ``` ruby
78
+ group :development, :test do
79
+ gem "relaunch"
80
+ end
81
+ ```
82
+
83
+ Using a Gemfile is also an easy way to use the pre-release branch, which may have bugfixes or features you want:
84
+
85
+ ``` ruby
86
+ group :development, :test do
87
+ gem "relaunch", git: "https://github.com/spinels/relaunch.git"
88
+ end
89
+ ```
90
+
91
+ When using a Gemfile, install with `bundle install` or `bundle update`, and run using `bundle exec rerun`, to guarantee you are using the rerun version specified in the Gemfile, and not a different version in a system-wide gemset.
92
+
93
+ # Usage:
94
+
95
+ rerun [options] [--] cmd
96
+
97
+ For example, if you're running a Sinatra app whose main file is `app.rb`:
98
+
99
+ rerun ruby app.rb
100
+
101
+ If the first part of the command is a `.rb` filename, then `ruby` is
102
+ optional, so the above can also be accomplished like this:
103
+
104
+ rerun app.rb
105
+
106
+ Rails doesn't automatically notice all config file changes, so you can force it
107
+ to restart when you change a config file like this:
108
+
109
+ rerun --dir config rails s
110
+
111
+ Or if you're using Thin to run a Rack app that's configured in config.ru
112
+ but you want it on port 4000 and in debug mode, and only want to watch
113
+ the `app` and `web` subdirectories:
114
+
115
+ rerun --dir app,web -- thin start --debug --port=4000 -R config.ru
116
+
117
+ The `--` is to separate rerun options from cmd options. You can also
118
+ use a quoted string for the command, e.g.
119
+
120
+ rerun --dir app "thin start --debug --port=4000 -R config.ru"
121
+
122
+ Rackup can also be used to launch a Rack server, so let's try that:
123
+
124
+ rerun -- rackup --port 4000 config.ru
125
+
126
+ Want to mimic [autotest](https://github.com/grosser/autotest)? Try
127
+
128
+ rerun -x rake
129
+
130
+ or
131
+
132
+ rerun -cx rspec
133
+
134
+ And if you're using [Spork](https://github.com/sporkrb/spork) with Rails, you
135
+ need to [restart your spork server](https://github.com/sporkrb/spork/issues/201)
136
+ whenever certain Rails environment files change, so why not put this in your
137
+ Rakefile...
138
+
139
+ desc "run spork (via rerun)"
140
+ task :spork do
141
+ sh "rerun --pattern '{Gemfile,Gemfile.lock,spec/spec_helper.rb,.rspec,spec/factories/**,config/environment.rb,config/environments/test.rb,config/initializers/*.rb,lib/**/*.rb}' -- spork"
142
+ end
143
+
144
+ and start using `rake spork` to launch your spork server?
145
+
146
+ (If you're using Guard instead of Rerun, check out
147
+ [guard-spork](https://github.com/guard/guard-spork)
148
+ for a similar solution.)
149
+
150
+ How about regenerating your HTML files after every change to your
151
+ [Erector](http://erector.rubyforge.org) widgets?
152
+
153
+ rerun -x erector --to-html my_site.rb
154
+
155
+ Use Heroku Cedar? `rerun` is now compatible with `foreman`. Run all your
156
+ Procfile processes locally and restart them all when necessary.
157
+
158
+ rerun foreman start
159
+
160
+ # Options:
161
+
162
+ These options can be specified on the command line and/or inside a `.rerun` config file (see below).
163
+
164
+ `--dir` directory (or directories) to watch (default = "."). Separate multiple paths with ',' and/or use multiple `-d` options.
165
+
166
+ `--pattern` glob to match inside directory. This uses the Ruby Dir glob style -- see <http://www.ruby-doc.org/core/classes/Dir.html#M002322> for details.
167
+ By default it watches files ending in: `rb,js,coffee,css,scss,sass,erb,html,haml,ru,yml,slim,md,feature,c,h`.
168
+ On top of this, it also ignores dotfiles, `.tmp` files, and some other files and directories (like `.git` and `log`).
169
+ Run `rerun --help` to see the actual list.
170
+
171
+ `--ignore pattern` file glob to ignore (can be set many times). To ignore a directory, you must append `'/*'` e.g.
172
+ `--ignore 'coverage/*'`.
173
+
174
+ `--[no-]ignore-dotfiles` By default, on top of --pattern and --ignore, we ignore any changes to files and dirs starting with a dot. Setting `--no-ignore-dotfiles` allows you to monitor a relevant file like .env, but you may also have to explicitly --ignore more dotfiles and dotdirs.
175
+
176
+ `--signal` (or `-s`) use specified signal(s) (instead of the default `TERM,INT,KILL`) to terminate the previous process. You can use a comma-delimited list if you want to try a signal, wait up to 5 seconds for the process to die, then try again with a different signal, and so on.
177
+ This may be useful for forcing the respective process to terminate as quickly as possible.
178
+ (`--signal KILL` is the equivalent of `kill -9`)
179
+
180
+ `--wait sec` (or `-w`) after asking the process to terminate, wait this long (in seconds) before either aborting, or trying the next signal in series. Default: 2 sec
181
+
182
+ `--restart` (or `-r`) expect process to restart itself, using signal HUP by default
183
+ (e.g. `-r -s INT` will send a INT and then resume watching for changes)
184
+
185
+ `--exit` (or -x) expect the program to exit. With this option, rerun checks the return value; without it, rerun checks that the launched process is still running.
186
+
187
+ `--clear` (or -c) clear the screen before each run
188
+
189
+ `--background` (or -b) disable on-the-fly commands, allowing the process to be backgrounded
190
+
191
+ `--notify NOTIFIER` use `growl` or `osx` or `notify-send` for notifications (see below)
192
+
193
+ `--no-notify` disable notifications
194
+
195
+ `--name` set the app name (for display)
196
+
197
+ `--force-polling` use polling instead of a native filesystem scan (useful for Vagrant)
198
+
199
+ `--quiet` silences most messages
200
+
201
+ `--verbose` enables even more messages (unless you also specified `--quiet`, which overrides `--verbose`)
202
+
203
+ Also `--version` and `--help`, naturally.
204
+
205
+ ## Config file
206
+
207
+ If the current directory contains a file named `.rerun`, it will be parsed with the same rules as command-line arguments. Newlines are the same as any other whitespace, so you can stack options vertically, like this:
208
+
209
+ ```
210
+ --quiet
211
+ --pattern **/*.{rb,js,scss,sass,html,md}
212
+ ```
213
+
214
+ Options specified on the command line will override those in the config file. You can negate boolean options with `--no-`, so for example, with the above config file, to re-enable logging, you could say:
215
+
216
+ ```sh
217
+ rerun --no-quiet rackup
218
+ ```
219
+
220
+ If you're not sure what options are being overwritten, use `--verbose` and rerun will show you the final result of the parsing.
221
+
222
+ # Notifications
223
+
224
+ If you have `growlnotify` available on the `PATH`, it sends notifications to
225
+ growl in addition to the console.
226
+
227
+ If you have `terminal-notifier`, it sends notifications to
228
+ the OS X notification center in addition to the console.
229
+
230
+ If you have `notify-send`, it sends notifications to Freedesktop-compatible
231
+ desktops in addition to the console.
232
+
233
+ If you have more than one available notification program, Rerun will pick one, or you can choose between them using `--notify growl`, `--notify osx`, `--notify notify-send`, etc.
234
+
235
+ If you have a notifier installed but don't want rerun to use it,
236
+ set the `--no-notify` option.
237
+
238
+ Download [growlnotify here](http://growl.info/downloads.php#generaldownloads)
239
+ now that Growl has moved to the App Store.
240
+
241
+ Install [terminal-notifier](https://github.com/julienXX/terminal-notifier) using `gem install terminal-notifier`. (You may have to put it in your system gemset and/or use `sudo` too.) Using Homebrew to install terminal-notifier is not recommended.
242
+
243
+ On Debian/Ubuntu, `notify-send` is available in the `libnotify-bin` package. On other GNU/Linux systems, it might be in a package with a different name.
244
+
245
+ # On-The-Fly Commands
246
+
247
+ While the app is (re)running, you can make things happen by pressing keys:
248
+
249
+ * **r** -- restart (as if a file had changed)
250
+ * **f** -- force restart (stop and start)
251
+ * **c** -- clear the screen
252
+ * **x** or **q** -- exit (just like control-C)
253
+ * **p** -- pause/unpause filesystem watching
254
+
255
+ Keyboard commands are enabled only when standard input is a terminal and,
256
+ on Unix, rerun belongs to its foreground process group. File watching and
257
+ automatic restarts remain enabled when keyboard commands are unavailable.
258
+
259
+ Use `--background` to disable keyboard commands explicitly, for example when
260
+ using Pry or a debugger.
261
+
262
+ # Signals
263
+
264
+ The current algorithm for killing the process is:
265
+
266
+ * send [SIGTERM](http://en.wikipedia.org/wiki/SIGTERM) (or the value of the `--signal` option)
267
+ * if that doesn't work after 2 seconds, send SIGINT (aka control-C)
268
+ * if that doesn't work after 2 more seconds, send SIGKILL (aka kill -9)
269
+
270
+ This seems like the most gentle and unixy way of doing things, but it does
271
+ mean that if your program ignores SIGTERM, it takes an extra 2 to 4 seconds to
272
+ restart.
273
+
274
+ If you want to use your own series of signals, use the `--signal` option. If you want to change the delay before attempting the next signal, use the `--wait` option.
275
+
276
+ # Vagrant and VirtualBox
277
+
278
+ If running inside a shared directory using Vagrant and VirtualBox, you must pass the `--force-polling` option. You may also have to pass some extra `--ignore` options too; otherwise each scan can take 10 or more seconds on directories with a large number of files or subdirectories underneath it.
279
+
280
+ # Troubleshooting
281
+
282
+ ## zsh ##
283
+
284
+ If you are using `zsh` as your shell, and you are specifying your `--pattern` as `**/*.rb`, you may face this error
285
+ ```
286
+ Errno::EACCES: Permission denied - <filename>
287
+ ```
288
+ This is because `**/*.rb` gets expanded into the command by `zsh` instead of passing it through to rerun. The solution is to simply quote ('' or "") the pattern.
289
+ i.e
290
+ ```
291
+ rerun -p **/*.rb rake test
292
+ ```
293
+ becomes
294
+ ```
295
+ rerun -p "**/*.rb" rake test
296
+ ```
297
+
298
+ # To Do:
299
+
300
+ ## Must have for v1.0
301
+ * Make sure to pass through quoted options correctly to target process [bug]
302
+ * Optionally do "bundle install" before and "bundle exec" during launch
303
+
304
+ ## Nice to have
305
+ * ".rerun" file in $HOME
306
+ * If the last element of the command is a `.ru` file and there's no other command then use `rackup`
307
+ * Figure out an algorithm so "-x" is not needed (if possible) -- maybe by accepting a "--port" option or reading `config.ru`
308
+ * Specify (or deduce) port to listen for to determine success of a web server launch
309
+ * see also [todo.md](todo.md)
310
+
311
+ ## Wacky Ideas
312
+
313
+ * On OS X:
314
+ * use a C library using growl's developer API <http://growl.info/developer/>
315
+ * Use growl's AppleScript or SDK instead of relying on growlnotify
316
+ * "Failed" icon for notifications
317
+
318
+ # Other projects that do similar things
319
+
320
+ * Guard: <http://github.com/guard/guard>
321
+ * Restartomatic: <http://github.com/adammck/restartomatic>
322
+ * Shotgun: <http://github.com/rtomayko/shotgun>
323
+ * Rack::Reloader middleware: <http://github.com/rack/rack/blob/5ca8f82fb59f0bf0e8fd438e8e91c5acf3d98e44/lib/rack/reloader.rb>
324
+ * The Sinatra FAQ has a discussion at <http://www.sinatrarb.com/faq.html#reloading>
325
+ * Kicker: <http://github.com/alloy/kicker/>
326
+ * Watchr: <https://github.com/mynyml/watchr>
327
+ * Autotest: <https://github.com/grosser/autotest>
328
+
329
+ # Why would I use this instead of Shotgun?
330
+
331
+ Shotgun does a "fork" after the web framework has loaded but before
332
+ your application is loaded. It then loads your app, processes a
333
+ single request in the child process, then exits the child process.
334
+
335
+ Rerun launches the whole app, then when it's time to restart, uses
336
+ "kill" to shut it down and starts the whole thing up again from
337
+ scratch.
338
+
339
+ So rerun takes somewhat longer than Shotgun to restart the app, but
340
+ does it much less frequently. And once it's running it behaves more
341
+ normally and consistently with your production app.
342
+
343
+ Also, Shotgun reloads the app on every request, even if it doesn't
344
+ need to. This is fine if you're loading a single file, but if your web
345
+ pages all load other files (CSS, JS, media) then that adds up quickly.
346
+ (I can only assume that the developers of shotgun are using caching or a
347
+ front web server so this isn't a pain point for them.)
348
+
349
+ And hey, does Shotgun reload your Worker processes if you're using Foreman and
350
+ a Procfile? I'm pretty sure it doesn't.
351
+
352
+ YMMV!
353
+
354
+ # Why would I use this instead of Rack::Reloader?
355
+
356
+ Rack::Reloader is certifiably beautiful code, and is a very elegant use
357
+ of Rack's middleware architecture. But because it relies on the
358
+ LOADED_FEATURES variable, it only reloads .rb files that were 'require'd,
359
+ not 'load'ed. That leaves out (non-Erector) template files, and also,
360
+ at least the way I was doing it, sub-actions (see
361
+ [this thread](http://groups.google.com/group/sinatrarb/browse_thread/thread/7329727a9296e96a#
362
+ )).
363
+
364
+ Rack::Reloader also doesn't reload configuration changes or redo other
365
+ things that happen during app startup. Rerun takes the attitude that if
366
+ you want to restart an app, you should just restart the whole app. You know?
367
+
368
+ # Why would I use this instead of Guard?
369
+
370
+ Guard is very powerful but requires some up-front configuration.
371
+ Rerun is meant as a no-frills command-line alternative requiring no knowledge
372
+ of Ruby nor config file syntax.
373
+
374
+ ## Development
375
+
376
+ Install the bundle and run the specs:
377
+
378
+ ```sh
379
+ bundle install
380
+ bundle exec rake spec
381
+ ```
382
+
383
+ CI runs the specs and checks gem installation on Linux and macOS.
384
+ See [ci.yml](.github/workflows/ci.yml) for the Ruby versions tested.
385
+
386
+ # Why did you write this?
387
+
388
+ I've been using [Sinatra](http://sinatrarb.com) and loving it. In order
389
+ to simplify their system, the Rat Pack removed auto-reloading from
390
+ Sinatra proper. I approve of this: a web application framework should be
391
+ focused on serving requests, not on munging Ruby ObjectSpace for
392
+ dev-time convenience. But I still wanted automatic reloading during
393
+ development. Shotgun wasn't working for me (see above) so I spliced
394
+ Rerun together out of code from Rspactor, FileSystemWatcher, and Shotgun
395
+ -- with a heavy amount of refactoring and rewriting. In late 2012 I
396
+ migrated the backend to the Listen gem, which was extracted from Guard,
397
+ so it should be more reliable and performant on multiple platforms.
398
+
399
+ # Credits
400
+
401
+ Rerun: [Alex Chaffee](http://alexchaffee.com), <mailto:alex@stinky.com>, <http://github.com/alexch/>
402
+
403
+ Based upon and/or inspired by:
404
+
405
+ * Shotgun: <http://github.com/rtomayko/shotgun>
406
+ * Rspactor: <http://github.com/mislav/rspactor>
407
+ * (In turn based on http://rails.aizatto.com/2007/11/28/taming-the-autotest-beast-with-fsevents/ )
408
+ * FileSystemWatcher: <http://paulhorman.com/filesystemwatcher/>
409
+
410
+ ## Patches by:
411
+
412
+ * David Billskog <billskog@gmail.com>
413
+ * Jens B <https://github.com/dpree>
414
+ * Andrés Botero <https://github.com/anbotero>
415
+ * Dreamcat4
416
+ * <https://github.com/FND>
417
+ * Barry Sia <https://github.com/bsia>
418
+ * Paul Rangel <https://github.com/ismell>
419
+ * James Edward Gray II <https://github.com/JEG2>
420
+ * Raul E Rangel <https://github.com/ismell> and Antonio Terceiro <https://github.com/terceiro>
421
+ * Mike Pastore <https://github.com/mwpastore>
422
+ * Andy Duncan <https://github.com/ajduncan>
423
+ * Brent Van Minnen
424
+ * Matthew O'Riordan <https://github.com/mattheworiordan>
425
+ * Antonio Terceiro <https://github.com/terceiro>
426
+ * <https://github.com/mattbrictson>
427
+ * <https://github.com/krissi>
428
+
429
+ # Version History
430
+
431
+ * v0.14.0 4 January 2023
432
+ * Ruby 3.2 compatibility fix: .exists? no longer exists
433
+
434
+ * v0.13.1 9 December 2020
435
+ * --no-ignore-dotfiles option
436
+
437
+ * v0.13.0 26 January 2018
438
+ * bugfix: pause/unpause works again (thanks Barry!)
439
+ * `.rerun` config file
440
+
441
+ * v0.12.0 23 January 2018
442
+ * smarter `--signal` option, allowing you to specify a series of signals to try in order; also `--wait` to change how long between tries
443
+ * `--force-polling` option (thanks ajduncan)
444
+ * `f` key to force stop and start (thanks mwpastore)
445
+ * add `.c` and `.h` files to default ignore list
446
+ * support for Windows
447
+ * use `Kernel.spawn` instead of `fork`
448
+ * use `wdm` gem for Windows Directory Monitor
449
+ * support for notifications on GNU/Linux using [notify-send](http://www.linuxjournal.com/content/tech-tip-get-notifications-your-scripts-notify-send) (thanks terceiro)
450
+ * fix `Gem::LoadError - terminal-notifier is not part of the bundle` [bug](https://github.com/alexch/rerun/issues/108) (thanks mattheworiordan)
451
+
452
+ * 0.11.0 7 October 2015
453
+ * better 'changed' message
454
+ * `--notify osx` option
455
+ * `--restart` option (with bugfix by Mike Pastore)
456
+ * use Listen 3 gem
457
+ * add `.feature` files to default watchlist (thanks @jmuheim)
458
+
459
+ * v0.10.0 4 May 2014
460
+ * add '.coffee,.slim,.md' to default pattern (thanks @xylinq)
461
+ * --ignore option
462
+
463
+ * v0.9.0 6 March 2014
464
+ * --dir (or -d) can be specified more than once, for multiple directories (thanks again Barry!)
465
+ * --name option
466
+ * press 'p' to pause/unpause filesystem watching (Barry is the man!)
467
+ * works with Listen 2 (note: needs 2.3 or higher)
468
+ * cooldown works, thanks to patches to underlying Listen gem
469
+ * ignore all dotfiles, and add actual list of ignored dirs and files
470
+
471
+ * v0.8.2
472
+ * bugfix, forcing Rerun to use Listen v1.0.3 while we work out the troubles we're having with Listen 1.3 and 2.1
473
+
474
+ * v0.8.1
475
+ * bugfix release (#30 and #34)
476
+
477
+ * v0.8.0
478
+ * --background option (thanks FND!) to disable the keyboard listener
479
+ * --signal option (thanks FND!)
480
+ * --no-growl option
481
+ * --dir supports multiple directories (thanks Barry!)
482
+
483
+ * v0.7.1
484
+ * bugfix: make rails icon work again
485
+
486
+ * v0.7.0
487
+ * uses Listen gem (which uses rb-fsevent for lightweight filesystem snooping)
488
+
489
+ # License
490
+
491
+ Open Source MIT License. See "LICENSE" file.