rerun 0.5.2 → 0.5.4

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -5,19 +5,17 @@
5
5
  Launches your app, then watches the filesystem. If a relevant file
6
6
  changes, then it restarts your app.
7
7
 
8
- Currently only *.rb files are watched. This is pretty lame so it will
9
- change soon.
8
+ By default only *.{rb,js,css,erb,ru} files are watched. Use the
9
+ `--pattern` option if you want to change this.
10
10
 
11
- If you're on Mac OS X, it uses the built-in facilities for monitoring
11
+ If you're on Mac OS X, and using the built-in ruby,
12
+ it uses the built-in facilities for monitoring
12
13
  the filesystem, so CPU use is very light. And if you have "growlnotify"
13
14
  available on the PATH, it sends notifications to growl in addition to
14
15
  the console. Here's how to install
15
- [growlnotify](http://growl.info/documentation/growlnotify.php):
16
+ [growlnotify](http://growl.info/extras.php#growlnotify):
16
17
 
17
- > In your shell, cd to the directory on the Growl disk image
18
- > containing growlnotify, and type ./install.sh. That script
19
- > will install growlnotify to /usr/local/bin and the manpage
20
- > to /usr/local/man.
18
+ > The Installer package for growlnotify is in the growlnotify folder in the Extras folder on the Growl disk image. Simply open the Installer package and follow the on-screen instructions.
21
19
 
22
20
  Rerun does not work on Windows. Sorry, but you can't do much relaunching
23
21
  without "fork".
@@ -26,57 +24,63 @@ without "fork".
26
24
 
27
25
  sudo gem install rerun
28
26
 
29
- If you want to use the latest version, grab it off Github:
30
-
31
- gem sources -a http://gems.github.com/
32
- sudo gem install alexch-rerun
33
-
34
- I'll bump the version on Github for release candidates, and deploy to
35
- Rubyforge only when it's had some time to bake.
36
-
37
27
  # Usage:
38
28
 
39
- rerun [options] cmd
29
+ rerun [options] [--] cmd
40
30
 
41
31
  For example, if you're running a Sinatra app whose main file is
42
32
  app.rb:
43
33
 
44
- rerun "ruby app.rb"
34
+ rerun ruby app.rb
35
+
36
+ If the first part of the command is a `.rb` filename, then `ruby` is
37
+ optional, so the above can also be accomplished like this:
38
+
39
+ rerun app.rb
40
+
41
+ Or if you're using Thin to run a Rack app that's configured in config.ru
42
+ but you want it on port 4000 and in debug mode, and only want to watch
43
+ the `app` subdirectory:
44
+
45
+ rerun --dir app -- thin start --debug --port=4000 -R config.ru
45
46
 
46
- Or if you're running a Rack app that's configured in config.ru
47
- but you want it on port 4000 and in debug mode:
47
+ The `--` is to separate rerun options from cmd options. You can also
48
+ use a quoted string for the command, e.g.
49
+
50
+ rerun --dir app "thin start --debug --port=4000 -R config.ru"
51
+
52
+ Rackup can also be used to launch a Rack server, so let's try that:
53
+
54
+ rerun -- rackup --port 4000 config.ru
48
55
 
49
- rerun "thin start --debug --port=4000 -R config.ru"
50
56
 
51
57
  # Options:
52
58
 
53
59
  --dir directory to watch (default = ".")
54
60
 
55
- --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. By default it watches .rb, .erb, .js, and .css files.
61
+ --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.
62
+ By default it watches .rb, .erb, .js, .css, and .ru files.
56
63
 
57
64
  Also --version and --help.
58
65
 
59
66
  # To Do:
60
67
 
61
- * If the cmd is, or starts with, a ".rb" file, then run it with ruby
62
- * Watch arbitrary file types via globbing
68
+ * If the last element of the command is a `.ru` file and there's no other command then use `rackup`
63
69
  * Allow arbitrary sets of directories and file types, possibly with "include" and "exclude" sets
64
70
  * ".rerun" file to specify options per project or in $HOME.
65
71
  * Test on Linux.
66
72
  * Test on Mac without Growlnotify.
67
- * Merge with Kicker (using it as a library and writing a Rerun recipe)
73
+ * Merge with Kicker (using it as a library and writing a Rerun recipe) or Watchr
74
+ * On OS X, use a C library using growl's developer API <http://growl.info/developer/>
68
75
 
69
76
  # Other projects that do similar things
70
77
 
71
- Restartomatic: <http://github.com/adammck/restartomatic>
72
-
73
- Shotgun: <http://github.com/rtomayko/shotgun>
74
-
75
- Rack::Reloader middleware: <http://github.com/rack/rack/blob/5ca8f82fb59f0bf0e8fd438e8e91c5acf3d98e44/lib/rack/reloader.rb>
76
-
77
- and the Sinatra FAQ has a discussion at <http://www.sinatrarb.com/faq.html#reloading>
78
-
79
- Kicker: <http://github.com/alloy/kicker/>
78
+ * Restartomatic: <http://github.com/adammck/restartomatic>
79
+ * Shotgun: <http://github.com/rtomayko/shotgun>
80
+ * Rack::Reloader middleware: <http://github.com/rack/rack/blob/5ca8f82fb59f0bf0e8fd438e8e91c5acf3d98e44/lib/rack/reloader.rb>
81
+ * The Sinatra FAQ has a discussion at <http://www.sinatrarb.com/faq.html#reloading>
82
+ * Kicker: <http://github.com/alloy/kicker/>
83
+ * Watchr: <https://github.com/mynyml/watchr>
80
84
 
81
85
  # Why would I use this instead of Shotgun?
82
86
 
@@ -141,6 +145,7 @@ FileSystemWatcher: <http://paulhorman.com/filesystemwatcher/>
141
145
  Patches by:
142
146
 
143
147
  David Billskog <billskog@gmail.com>
148
+ Jens B <https://github.com/dpree>
144
149
 
145
150
  # License
146
151
 
data/Rakefile CHANGED
@@ -56,9 +56,5 @@ end
56
56
 
57
57
  desc 'Publish gem and tarball to rubyforge'
58
58
  task 'release' => [package('.gem'), package('.tar.gz')] do |t|
59
- sh <<-end
60
- rubyforge add_release #{$rubyforge_project} #{$spec.name} #{$spec.version} #{package('.gem')} &&
61
- rubyforge add_file #{$rubyforge_project} #{$spec.name} #{$spec.version} #{package('.tar.gz')}
62
- end
59
+ sh "gem push #{package('.gem')}"
63
60
  end
64
- 5
data/bin/rerun CHANGED
@@ -26,8 +26,8 @@ opts = OptionParser.new("", 24, ' ') { |opts|
26
26
  options[:dir] = dir
27
27
  end
28
28
 
29
- opts.on("-p pattern", "--pattern pattern", "file glob, default = \"#{Rerun::DEFAULT_PATTERN}\"") do |dir|
30
- options[:dir] = dir
29
+ opts.on("-p pattern", "--pattern pattern", "file glob, default = \"#{Rerun::DEFAULT_PATTERN}\"") do |pattern|
30
+ options[:pattern] = pattern
31
31
  end
32
32
 
33
33
  opts.on_tail("-h", "--help", "--usage", "show this message") do
data/lib/rerun.rb CHANGED
@@ -6,14 +6,15 @@ require "fswatcher"
6
6
  # todo: make sure this works in non-Mac environments (also Macs without growlnotify)
7
7
  module Rerun
8
8
 
9
- DEFAULT_PATTERN = "**/*.{rb,js,css,erb}"
10
-
9
+ DEFAULT_PATTERN = "**/*.{rb,js,css,erb,ru}"
10
+
11
11
  class Runner
12
12
 
13
13
  include System
14
14
 
15
15
  def initialize(run_command, options = {})
16
16
  @run_command, @options = run_command, options
17
+ @run_command = "ruby #{@run_command}" if @run_command.split(' ').first =~ /\.rb$/
17
18
  end
18
19
 
19
20
  def restart
data/lib/watcher.rb CHANGED
@@ -172,7 +172,7 @@ module Rerun
172
172
  end
173
173
 
174
174
  def files()
175
- return Dir[@dir + "/" + @expression]
175
+ return Dir["#{@dir}/#{@expression}"]
176
176
  end
177
177
  end
178
178
 
data/rerun.gemspec CHANGED
@@ -3,8 +3,8 @@ $spec = Gem::Specification.new do |s|
3
3
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
4
4
 
5
5
  s.name = 'rerun'
6
- s.version = '0.5.2'
7
- s.date = '2009-12-03'
6
+ s.version = '0.5.4'
7
+ s.date = '2010-11-20'
8
8
 
9
9
  s.description = "Restarts your app when a file changes"
10
10
  s.summary = "Launches an app, and restarts it whenever the filesystem changes."
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rerun
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 5
8
+ - 4
9
+ version: 0.5.4
5
10
  platform: ruby
6
11
  authors:
7
12
  - Alex Chaffee
@@ -9,7 +14,7 @@ autorequire:
9
14
  bindir: bin
10
15
  cert_chain: []
11
16
 
12
- date: 2009-12-03 00:00:00 -08:00
17
+ date: 2010-11-20 00:00:00 -08:00
13
18
  default_executable:
14
19
  dependencies: []
15
20
 
@@ -42,21 +47,25 @@ rdoc_options: []
42
47
  require_paths:
43
48
  - lib
44
49
  required_ruby_version: !ruby/object:Gem::Requirement
50
+ none: false
45
51
  requirements:
46
52
  - - ">="
47
53
  - !ruby/object:Gem::Version
54
+ segments:
55
+ - 0
48
56
  version: "0"
49
- version:
50
57
  required_rubygems_version: !ruby/object:Gem::Requirement
58
+ none: false
51
59
  requirements:
52
60
  - - ">="
53
61
  - !ruby/object:Gem::Version
62
+ segments:
63
+ - 0
54
64
  version: "0"
55
- version:
56
65
  requirements: []
57
66
 
58
67
  rubyforge_project: pivotalrb
59
- rubygems_version: 1.3.5
68
+ rubygems_version: 1.3.7
60
69
  signing_key:
61
70
  specification_version: 2
62
71
  summary: Launches an app, and restarts it whenever the filesystem changes.