relaunch 0.0.1 → 0.15.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: 72b9d31380594b154a7da4a467e47f6e4fc555af0b7cfb5a71d1f45bcf3bd2c5
4
+ data.tar.gz: b83f6350d7302b369939fc1afb2a8fb3fbea729fb149d1e135f945edb0a26ccb
5
5
  SHA512:
6
- metadata.gz: a429a3d623011e6e0533b198f3bf602060152ce67c6e322e89068c5c28e20b84a435641775ad2121018cdebf6296f1c04c9b00661c2c70ef2cb91f370353b70b
7
- data.tar.gz: 96d0f925067fb43885016a02ac17064687b24b4d01180ceb81858d5465181dd2c2dabc2441b6bf219908cc1a3197454a97715c14673a9daf2350b4516f5eca9c
6
+ metadata.gz: 9d12530b843c2624a7b789af56cf998644aa54ed0487d08eeb7a847966d616c3c39608ee51e7a3458a2be561ce24df7794815c9a0f5759be2ec7257c2341d6f4
7
+ data.tar.gz: e777eb25ab636c8dd165877632d4a3e1e71d97ccc00ed99fd19c6444e4142e28619b1f9d21ce404efb85072a90737ec88ddd4565930a5f4d2fc0f43a09e3a9e9
data/Changelog.md ADDED
@@ -0,0 +1,15 @@
1
+ # Changelog
2
+
3
+ ## 0.15.0 (unreleased)
4
+
5
+ - Require Ruby 3.3 or newer.
6
+ - Publish as `relaunch`, preserving the `rerun` command, `.rerun`
7
+ configuration, and `Rerun` namespace.
8
+ - Add `relaunch` as a command alias and `require "relaunch"` as an entry
9
+ point to the existing library.
10
+ - Support Ruby 4.0 keyboard input using upstream's `IO#wait_readable` fix.
11
+ - Raise `Rerun::ExitException` when the runner exits so library callers can
12
+ handle shutdown. The command continues to exit successfully.
13
+
14
+ Earlier Rerun releases are documented in the
15
+ [upstream version history](README.md#version-history).
data/Fork.md ADDED
@@ -0,0 +1,40 @@
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: Minimum Ruby version
7
+
8
+ Relaunch requires Ruby 3.3 or newer.
9
+
10
+ ## September 13, 2026: Relaunch gem and command alias
11
+
12
+ The fork uses the gem name `relaunch`, with 0.15.0 as its first planned
13
+ release. Like [Overman](https://github.com/spinels/overman), it has its own
14
+ package identity while retaining compatibility with upstream usage.
15
+
16
+ The `rerun` executable, `.rerun` configuration, `require "rerun"`, and the
17
+ `Rerun` namespace are preserved. The additional `relaunch` executable loads
18
+ the existing command, and `require "relaunch"` loads the same library.
19
+ Applications can replace the `rerun` gem with `relaunch` without changing
20
+ their commands or configuration.
21
+
22
+ ## September 13, 2026: Ruby 4.0 keyboard input compatibility
23
+
24
+ [f2b5cf5](https://github.com/spinels/rerun/commit/f2b5cf5e641e6709d40a8fa03b961e9560ff0e6f)
25
+ merged upstream while retaining the fork's exit handling. The import
26
+ includes upstream's
27
+ [b00ffc6](https://github.com/alexch/rerun/commit/b00ffc6fb7e2c9da676a672200678da0154a60a1),
28
+ which uses `IO#wait_readable` when available and falls back to `IO#ready?`
29
+ for older Rubies, fixing keyboard input compatibility with Ruby 4.0.
30
+
31
+ ## January 26, 2026: Let callers handle runner exits
32
+
33
+ [072c356](https://github.com/spinels/rerun/commit/072c3561fd1581ac2c954c239202e755265de7e2)
34
+ introduced `Rerun::ExitException`. The runner raises it instead of calling
35
+ `exit` when stopping or handling a launch error, allowing tests and library
36
+ callers to catch it. The `rerun` executable catches the exception and exits
37
+ successfully, preserving its command-line behavior.
38
+
39
+ This remains a runtime difference from upstream and should be preserved
40
+ 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,488 @@
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
+ If you're backgrounding or using Pry or a debugger, you might not want these
256
+ keys to be trapped, so use the `--background` option.
257
+
258
+ # Signals
259
+
260
+ The current algorithm for killing the process is:
261
+
262
+ * send [SIGTERM](http://en.wikipedia.org/wiki/SIGTERM) (or the value of the `--signal` option)
263
+ * if that doesn't work after 2 seconds, send SIGINT (aka control-C)
264
+ * if that doesn't work after 2 more seconds, send SIGKILL (aka kill -9)
265
+
266
+ This seems like the most gentle and unixy way of doing things, but it does
267
+ mean that if your program ignores SIGTERM, it takes an extra 2 to 4 seconds to
268
+ restart.
269
+
270
+ 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.
271
+
272
+ # Vagrant and VirtualBox
273
+
274
+ 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.
275
+
276
+ # Troubleshooting
277
+
278
+ ## zsh ##
279
+
280
+ If you are using `zsh` as your shell, and you are specifying your `--pattern` as `**/*.rb`, you may face this error
281
+ ```
282
+ Errno::EACCES: Permission denied - <filename>
283
+ ```
284
+ 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.
285
+ i.e
286
+ ```
287
+ rerun -p **/*.rb rake test
288
+ ```
289
+ becomes
290
+ ```
291
+ rerun -p "**/*.rb" rake test
292
+ ```
293
+
294
+ # To Do:
295
+
296
+ ## Must have for v1.0
297
+ * Make sure to pass through quoted options correctly to target process [bug]
298
+ * Optionally do "bundle install" before and "bundle exec" during launch
299
+
300
+ ## Nice to have
301
+ * ".rerun" file in $HOME
302
+ * If the last element of the command is a `.ru` file and there's no other command then use `rackup`
303
+ * Figure out an algorithm so "-x" is not needed (if possible) -- maybe by accepting a "--port" option or reading `config.ru`
304
+ * Specify (or deduce) port to listen for to determine success of a web server launch
305
+ * see also [todo.md](todo.md)
306
+
307
+ ## Wacky Ideas
308
+
309
+ * On OS X:
310
+ * use a C library using growl's developer API <http://growl.info/developer/>
311
+ * Use growl's AppleScript or SDK instead of relying on growlnotify
312
+ * "Failed" icon for notifications
313
+
314
+ # Other projects that do similar things
315
+
316
+ * Guard: <http://github.com/guard/guard>
317
+ * Restartomatic: <http://github.com/adammck/restartomatic>
318
+ * Shotgun: <http://github.com/rtomayko/shotgun>
319
+ * Rack::Reloader middleware: <http://github.com/rack/rack/blob/5ca8f82fb59f0bf0e8fd438e8e91c5acf3d98e44/lib/rack/reloader.rb>
320
+ * The Sinatra FAQ has a discussion at <http://www.sinatrarb.com/faq.html#reloading>
321
+ * Kicker: <http://github.com/alloy/kicker/>
322
+ * Watchr: <https://github.com/mynyml/watchr>
323
+ * Autotest: <https://github.com/grosser/autotest>
324
+
325
+ # Why would I use this instead of Shotgun?
326
+
327
+ Shotgun does a "fork" after the web framework has loaded but before
328
+ your application is loaded. It then loads your app, processes a
329
+ single request in the child process, then exits the child process.
330
+
331
+ Rerun launches the whole app, then when it's time to restart, uses
332
+ "kill" to shut it down and starts the whole thing up again from
333
+ scratch.
334
+
335
+ So rerun takes somewhat longer than Shotgun to restart the app, but
336
+ does it much less frequently. And once it's running it behaves more
337
+ normally and consistently with your production app.
338
+
339
+ Also, Shotgun reloads the app on every request, even if it doesn't
340
+ need to. This is fine if you're loading a single file, but if your web
341
+ pages all load other files (CSS, JS, media) then that adds up quickly.
342
+ (I can only assume that the developers of shotgun are using caching or a
343
+ front web server so this isn't a pain point for them.)
344
+
345
+ And hey, does Shotgun reload your Worker processes if you're using Foreman and
346
+ a Procfile? I'm pretty sure it doesn't.
347
+
348
+ YMMV!
349
+
350
+ # Why would I use this instead of Rack::Reloader?
351
+
352
+ Rack::Reloader is certifiably beautiful code, and is a very elegant use
353
+ of Rack's middleware architecture. But because it relies on the
354
+ LOADED_FEATURES variable, it only reloads .rb files that were 'require'd,
355
+ not 'load'ed. That leaves out (non-Erector) template files, and also,
356
+ at least the way I was doing it, sub-actions (see
357
+ [this thread](http://groups.google.com/group/sinatrarb/browse_thread/thread/7329727a9296e96a#
358
+ )).
359
+
360
+ Rack::Reloader also doesn't reload configuration changes or redo other
361
+ things that happen during app startup. Rerun takes the attitude that if
362
+ you want to restart an app, you should just restart the whole app. You know?
363
+
364
+ # Why would I use this instead of Guard?
365
+
366
+ Guard is very powerful but requires some up-front configuration.
367
+ Rerun is meant as a no-frills command-line alternative requiring no knowledge
368
+ of Ruby nor config file syntax.
369
+
370
+ ## Development
371
+
372
+ Set up the test dependencies, install the bundle, and run the specs:
373
+
374
+ ```sh
375
+ ./bin/setup-deps
376
+ bundle install
377
+ bundle exec rake spec
378
+ ```
379
+
380
+ CI runs the specs and checks gem installation on Linux and macOS.
381
+ See [ci.yml](.github/workflows/ci.yml) for the Ruby versions tested.
382
+
383
+ # Why did you write this?
384
+
385
+ I've been using [Sinatra](http://sinatrarb.com) and loving it. In order
386
+ to simplify their system, the Rat Pack removed auto-reloading from
387
+ Sinatra proper. I approve of this: a web application framework should be
388
+ focused on serving requests, not on munging Ruby ObjectSpace for
389
+ dev-time convenience. But I still wanted automatic reloading during
390
+ development. Shotgun wasn't working for me (see above) so I spliced
391
+ Rerun together out of code from Rspactor, FileSystemWatcher, and Shotgun
392
+ -- with a heavy amount of refactoring and rewriting. In late 2012 I
393
+ migrated the backend to the Listen gem, which was extracted from Guard,
394
+ so it should be more reliable and performant on multiple platforms.
395
+
396
+ # Credits
397
+
398
+ Rerun: [Alex Chaffee](http://alexchaffee.com), <mailto:alex@stinky.com>, <http://github.com/alexch/>
399
+
400
+ Based upon and/or inspired by:
401
+
402
+ * Shotgun: <http://github.com/rtomayko/shotgun>
403
+ * Rspactor: <http://github.com/mislav/rspactor>
404
+ * (In turn based on http://rails.aizatto.com/2007/11/28/taming-the-autotest-beast-with-fsevents/ )
405
+ * FileSystemWatcher: <http://paulhorman.com/filesystemwatcher/>
406
+
407
+ ## Patches by:
408
+
409
+ * David Billskog <billskog@gmail.com>
410
+ * Jens B <https://github.com/dpree>
411
+ * Andrés Botero <https://github.com/anbotero>
412
+ * Dreamcat4
413
+ * <https://github.com/FND>
414
+ * Barry Sia <https://github.com/bsia>
415
+ * Paul Rangel <https://github.com/ismell>
416
+ * James Edward Gray II <https://github.com/JEG2>
417
+ * Raul E Rangel <https://github.com/ismell> and Antonio Terceiro <https://github.com/terceiro>
418
+ * Mike Pastore <https://github.com/mwpastore>
419
+ * Andy Duncan <https://github.com/ajduncan>
420
+ * Brent Van Minnen
421
+ * Matthew O'Riordan <https://github.com/mattheworiordan>
422
+ * Antonio Terceiro <https://github.com/terceiro>
423
+ * <https://github.com/mattbrictson>
424
+ * <https://github.com/krissi>
425
+
426
+ # Version History
427
+
428
+ * v0.14.0 4 January 2023
429
+ * Ruby 3.2 compatibility fix: .exists? no longer exists
430
+
431
+ * v0.13.1 9 December 2020
432
+ * --no-ignore-dotfiles option
433
+
434
+ * v0.13.0 26 January 2018
435
+ * bugfix: pause/unpause works again (thanks Barry!)
436
+ * `.rerun` config file
437
+
438
+ * v0.12.0 23 January 2018
439
+ * smarter `--signal` option, allowing you to specify a series of signals to try in order; also `--wait` to change how long between tries
440
+ * `--force-polling` option (thanks ajduncan)
441
+ * `f` key to force stop and start (thanks mwpastore)
442
+ * add `.c` and `.h` files to default ignore list
443
+ * support for Windows
444
+ * use `Kernel.spawn` instead of `fork`
445
+ * use `wdm` gem for Windows Directory Monitor
446
+ * support for notifications on GNU/Linux using [notify-send](http://www.linuxjournal.com/content/tech-tip-get-notifications-your-scripts-notify-send) (thanks terceiro)
447
+ * fix `Gem::LoadError - terminal-notifier is not part of the bundle` [bug](https://github.com/alexch/rerun/issues/108) (thanks mattheworiordan)
448
+
449
+ * 0.11.0 7 October 2015
450
+ * better 'changed' message
451
+ * `--notify osx` option
452
+ * `--restart` option (with bugfix by Mike Pastore)
453
+ * use Listen 3 gem
454
+ * add `.feature` files to default watchlist (thanks @jmuheim)
455
+
456
+ * v0.10.0 4 May 2014
457
+ * add '.coffee,.slim,.md' to default pattern (thanks @xylinq)
458
+ * --ignore option
459
+
460
+ * v0.9.0 6 March 2014
461
+ * --dir (or -d) can be specified more than once, for multiple directories (thanks again Barry!)
462
+ * --name option
463
+ * press 'p' to pause/unpause filesystem watching (Barry is the man!)
464
+ * works with Listen 2 (note: needs 2.3 or higher)
465
+ * cooldown works, thanks to patches to underlying Listen gem
466
+ * ignore all dotfiles, and add actual list of ignored dirs and files
467
+
468
+ * v0.8.2
469
+ * 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
470
+
471
+ * v0.8.1
472
+ * bugfix release (#30 and #34)
473
+
474
+ * v0.8.0
475
+ * --background option (thanks FND!) to disable the keyboard listener
476
+ * --signal option (thanks FND!)
477
+ * --no-growl option
478
+ * --dir supports multiple directories (thanks Barry!)
479
+
480
+ * v0.7.1
481
+ * bugfix: make rails icon work again
482
+
483
+ * v0.7.0
484
+ * uses Listen gem (which uses rb-fsevent for lightweight filesystem snooping)
485
+
486
+ # License
487
+
488
+ Open Source MIT License. See "LICENSE" file.
data/Rakefile ADDED
@@ -0,0 +1,75 @@
1
+ require 'rake'
2
+ require 'rake/clean'
3
+ require 'rake/testtask'
4
+ require 'rspec/core/rake_task'
5
+
6
+ task :default => [:spec]
7
+ task :test => :spec
8
+
9
+ desc "Run all specs"
10
+ RSpec::Core::RakeTask.new('spec') do |t|
11
+ ENV['ENV'] = "test"
12
+ t.pattern = 'spec/**/*_spec.rb'
13
+ t.rspec_opts = ['--color']
14
+ end
15
+
16
+ $rubyforge_project = 'pivotalrb'
17
+
18
+ $spec =
19
+ begin
20
+ require 'rubygems/specification'
21
+ data = File.read('relaunch.gemspec')
22
+ spec = nil
23
+ #Thread.new { spec = eval("$SAFE = 3\n#{data}") }.join
24
+ spec = eval data
25
+ spec
26
+ end
27
+
28
+ def package(ext='')
29
+ "pkg/#{$spec.name}-#{$spec.version}" + ext
30
+ end
31
+
32
+ desc 'Exit if git is dirty'
33
+ task :check_git do
34
+ state = `git status 2> /dev/null | tail -n1`
35
+ clean = (state =~ /working (directory|tree) clean/)
36
+ unless clean
37
+ warn "can't do that on an unclean git dir"
38
+ exit 1
39
+ end
40
+ end
41
+
42
+ desc 'Build packages'
43
+ task :package => %w[.gem .tar.gz].map { |e| package(e) }
44
+
45
+ desc 'Build and install as local gem'
46
+ task :install => package('.gem') do
47
+ sh "gem install #{package('.gem')}"
48
+ end
49
+
50
+ directory 'pkg/'
51
+ CLOBBER.include('pkg')
52
+
53
+ file package('.gem') => %W[pkg/ #{$spec.name}.gemspec] + $spec.files do |f|
54
+ sh "gem build #{$spec.name}.gemspec"
55
+ mv File.basename(f.name), f.name
56
+ end
57
+
58
+ file package('.tar.gz') => %w[pkg/] + $spec.files do |f|
59
+ cmd = <<-SH
60
+ git archive \
61
+ --prefix=#{$spec.name}-#{$spec.version}/ \
62
+ --format=tar \
63
+ HEAD | gzip > #{f.name}
64
+ SH
65
+ sh cmd.gsub(/ +/, ' ')
66
+ end
67
+
68
+ desc 'Publish gem and tarball to rubyforge'
69
+ task 'release' => [:check_git, package('.gem'), package('.tar.gz')] do |t|
70
+ puts "Releasing #{$spec.version}"
71
+ sh "gem push #{package('.gem')}"
72
+ puts "Tagging and pushing"
73
+ sh "git tag v#{$spec.version}"
74
+ sh "git push && git push --tags"
75
+ end
data/bin/relaunch ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ load File.expand_path('rerun', __dir__)
data/bin/relaunch.bat ADDED
@@ -0,0 +1,3 @@
1
+ :: %~dp0 means "the directory of the current script file"
2
+ :: see https://stackoverflow.com/questions/17063947/get-current-batchfile-directory
3
+ ruby %~dp0\relaunch %*