rerun 0.13.0 → 0.13.1

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
- SHA1:
3
- metadata.gz: 9e76ba084873582659cd7594bc0dd2bb16f59848
4
- data.tar.gz: 8c19a2d63d189d9876ba85f6b344539b8cbb3c2f
2
+ SHA256:
3
+ metadata.gz: 12916c529d417f7435294064c61ab8bc9b3e4811e61ab162725b84dc42730212
4
+ data.tar.gz: 2d32573a380ae73f845564580eced58064271d3347a09da7c5e13ad72882a8c5
5
5
  SHA512:
6
- metadata.gz: 966e3c6d41605dfce0df54232dfeba72dcd805ad30c62a544bc487a9b93af7f8ea2f926efe203519c3201aaab596581ecab165fc17b3817ca0695f319220fdfa
7
- data.tar.gz: f2276408f9d310cfff3fa637edf29d5e636206ebbacdecfbd75c42244e5431f8eb5e2b5df0d4303e6792f2f5fdc845c499f2806725db8eef36a5e10581d89ede
6
+ metadata.gz: a3d9ed3d68053c23b3c9665abc33cde89d4fd5893fa1d9930fbcb93113459450810ced0d3d0cd7e83c2bc4dc9da27446228f1104dc2a46cdb01ef53dc8bc5f48
7
+ data.tar.gz: 1df642c255cd253271015b111f2b0fa4b9023c0fd697b1bd03405b2fccb9d716658f840a82884dfa7b042395c07664205f6427c08a9b432f8742ce58413792cd
data/README.md CHANGED
@@ -20,9 +20,9 @@ Use the `--pattern` option if you want to change this.
20
20
  As of version 0.7.0, we use the Listen gem, which tries to use your OS's
21
21
  built-in facilities for monitoring the filesystem, so CPU use is very light.
22
22
 
23
- **UPDATE**: Now Rerun *does* work on Windows. Caveats:
23
+ **UPDATE**: Now Rerun *does* work on Windows! Caveats:
24
24
  * not well-tested
25
- * after running, it may continue to slurp up some of your console input, so run it in a separate window, and/or use `--background` to disable on-the-fly commands, and/or press `q` to quit instead of CTRL-C
25
+ * you need to press Enter after keypress input
26
26
  * you may need to install the `wdm` gem manually: `gem install wdm`
27
27
  * You may see this persistent `INFO` error message; to remove it, use`--no-notify`:
28
28
  * `INFO: Could not find files for the given pattern(s)`
@@ -57,6 +57,26 @@ On *BSD, use
57
57
 
58
58
  gem install rb-kqueue
59
59
 
60
+ ## Installation via Gemfile / Bundler
61
+
62
+ If you are using rerun inside an existing Ruby application (like a Rails or Sinatra app), you can add it to your Gemfile:
63
+
64
+ ``` ruby
65
+ group :development, :test do
66
+ gem "rerun"
67
+ end
68
+ ```
69
+
70
+ Using a Gemfile is also an easy way to use the pre-release branch, which may have bugfixes or features you want:
71
+
72
+ ``` ruby
73
+ group :development, :test do
74
+ gem "rerun", git: "https://github.com/alexch/rerun.git"
75
+ end
76
+ ```
77
+
78
+ 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.
79
+
60
80
  # Usage:
61
81
 
62
82
  rerun [options] [--] cmd
@@ -138,7 +158,7 @@ Run `rerun --help` to see the actual list.
138
158
  `--ignore pattern` file glob to ignore (can be set many times). To ignore a directory, you must append `'/*'` e.g.
139
159
  `--ignore 'coverage/*'`.
140
160
 
141
- *On top of --pattern and --ignore, we ignore any changes to files and dirs starting with a dot.*
161
+ `--[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.
142
162
 
143
163
  `--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.
144
164
  This may be useful for forcing the respective process to terminate as quickly as possible.
@@ -242,14 +262,6 @@ If running inside a shared directory using Vagrant and VirtualBox, you must pass
242
262
 
243
263
  # Troubleshooting
244
264
 
245
- ## Vagrant ##
246
-
247
- Rerun will not pick up changes made to shared folders. This means that the common
248
- method of using Vagrant for an execution environment and using the `/vagrant`
249
- shared folder for source code will not work.
250
-
251
- Instead, use [shotgun](https://rubygems.org/gems/shotgun).
252
-
253
265
  ## zsh ##
254
266
 
255
267
  If you are using `zsh` as your shell, and you are specifying your `--pattern` as `**/*.rb`, you may face this error
@@ -288,13 +300,13 @@ rerun -p "**/*.rb" rake test
288
300
 
289
301
  # Other projects that do similar things
290
302
 
303
+ * Guard: <http://github.com/guard/guard>
291
304
  * Restartomatic: <http://github.com/adammck/restartomatic>
292
305
  * Shotgun: <http://github.com/rtomayko/shotgun>
293
306
  * Rack::Reloader middleware: <http://github.com/rack/rack/blob/5ca8f82fb59f0bf0e8fd438e8e91c5acf3d98e44/lib/rack/reloader.rb>
294
307
  * The Sinatra FAQ has a discussion at <http://www.sinatrarb.com/faq.html#reloading>
295
308
  * Kicker: <http://github.com/alloy/kicker/>
296
309
  * Watchr: <https://github.com/mynyml/watchr>
297
- * Guard: <http://github.com/guard/guard>
298
310
  * Autotest: <https://github.com/grosser/autotest>
299
311
 
300
312
  # Why would I use this instead of Shotgun?
@@ -387,6 +399,9 @@ Based upon and/or inspired by:
387
399
 
388
400
  # Version History
389
401
 
402
+ *
403
+ * --no-ignore-dotfiles option
404
+
390
405
  * v0.13.0 26 January 2018
391
406
  * bugfix: pause/unpause works again (thanks Barry!)
392
407
  * `.rerun` config file
@@ -399,8 +414,6 @@ Based upon and/or inspired by:
399
414
  * support for Windows
400
415
  * use `Kernel.spawn` instead of `fork`
401
416
  * use `wdm` gem for Windows Directory Monitor
402
- * TODO: fix `INFO` error message
403
- * TODO: fix console input contention bug
404
417
  * support for notifications on GNU/Linux using [notify-send](http://www.linuxjournal.com/content/tech-tip-get-notifications-your-scripts-notify-send) (thanks terceiro)
405
418
  * fix `Gem::LoadError - terminal-notifier is not part of the bundle` [bug](https://github.com/alexch/rerun/issues/108) (thanks mattheworiordan)
406
419
 
data/Rakefile CHANGED
@@ -1,83 +1,82 @@
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('rerun.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
- puts state
38
- warn "can't do that on an unclean git dir"
39
- # exit 1
40
- end
41
- end
42
-
43
- desc 'Build packages'
44
- task :package => %w[.gem .tar.gz].map { |e| package(e) }
45
-
46
- desc 'Build and install as local gem'
47
- task :install => package('.gem') do
48
- sh "gem install #{package('.gem')}"
49
- end
50
-
51
- directory 'pkg/'
52
- CLOBBER.include('pkg')
53
-
54
- file package('.gem') => %W[pkg/ #{$spec.name}.gemspec] + $spec.files do |f|
55
- sh "gem build #{$spec.name}.gemspec"
56
- mv File.basename(f.name), f.name
57
- end
58
-
59
- file package('.tar.gz') => %w[pkg/] + $spec.files do |f|
60
- cmd = <<-SH
61
- git archive \
62
- --prefix=#{$spec.name}-#{$spec.version}/ \
63
- --format=tar \
64
- HEAD | gzip > #{f.name}
65
- SH
66
- sh cmd.gsub(/ +/, ' ')
67
- end
68
-
69
- desc 'Publish gem and tarball to rubyforge'
70
- task 'release' => [:check_git, package('.gem'), package('.tar.gz')] do |t|
71
- puts "Releasing #{$spec.version}"
72
- sh "gem push #{package('.gem')}"
73
- puts "Tagging and pushing"
74
- sh "git tag v#{$spec.version}"
75
- sh "git push && git push --tags"
76
- end
77
-
78
- desc 'download github issues and pull requests'
79
- task 'github' do
80
- %w(issues pulls).each do |type|
81
- sh "curl -o #{type}.json https://api.github.com/repos/alexch/rerun/#{type}"
82
- end
83
- end
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('rerun.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
76
+
77
+ desc 'download github issues and pull requests'
78
+ task 'github' do
79
+ %w(issues pulls).each do |type|
80
+ sh "curl -o #{type}.json https://api.github.com/repos/alexch/rerun/#{type}"
81
+ end
82
+ end
data/bin/rerun CHANGED
@@ -1,18 +1,18 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'rubygems'
4
- libdir = "#{File.expand_path(File.dirname(File.dirname(__FILE__)))}/lib"
5
- $LOAD_PATH.unshift libdir unless $LOAD_PATH.include?(libdir)
6
-
7
- require 'rerun'
8
- require 'optparse'
9
-
10
- options = Rerun::Options.parse config_file: ".rerun"
11
-
12
- if options and options[:verbose]
13
- puts "\nrerun options:\n\t#{options}"
14
- end
15
-
16
- exit if options.nil? or options[:cmd].nil? or options[:cmd].empty?
17
-
18
- Rerun::Runner.keep_running(options[:cmd], options)
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+ libdir = "#{File.expand_path(File.dirname(File.dirname(__FILE__)))}/lib"
5
+ $LOAD_PATH.unshift libdir unless $LOAD_PATH.include?(libdir)
6
+
7
+ require 'rerun'
8
+ require 'optparse'
9
+
10
+ options = Rerun::Options.parse config_file: ".rerun"
11
+
12
+ if options and options[:verbose]
13
+ puts "\nrerun options:\n\t#{options}"
14
+ end
15
+
16
+ exit if options.nil? or options[:cmd].nil? or options[:cmd].empty?
17
+
18
+ Rerun::Runner.keep_running(options[:cmd], options)
data/lib/goo.rb CHANGED
@@ -1,3 +1,3 @@
1
- goooo
2
- goooo
3
- goooo
1
+ goooo
2
+ goooo
3
+ goooo
@@ -1,15 +1,15 @@
1
- here = File.expand_path(File.dirname(__FILE__))
2
- $: << here unless $:.include?(here)
3
-
4
- require "listen" # pull in the Listen gem
5
- require "rerun/options"
6
- require "rerun/system"
7
- require "rerun/notification"
8
- require "rerun/runner"
9
- require "rerun/watcher"
10
- require "rerun/glob"
11
-
12
- module Rerun
13
-
14
- end
15
-
1
+ here = File.expand_path(File.dirname(__FILE__))
2
+ $: << here unless $:.include?(here)
3
+
4
+ require "listen" # pull in the Listen gem
5
+ require "rerun/options"
6
+ require "rerun/system"
7
+ require "rerun/notification"
8
+ require "rerun/runner"
9
+ require "rerun/watcher"
10
+ require "rerun/glob"
11
+
12
+ module Rerun
13
+
14
+ end
15
+
@@ -1,82 +1,82 @@
1
- # todo: unit tests
2
-
3
- module Rerun
4
- class Notification
5
- include System
6
-
7
- attr_reader :title, :body, :options
8
-
9
- def initialize(title, body, options = Options::DEFAULTS.dup)
10
- @title = title
11
- @body = body
12
- @options = options
13
- end
14
-
15
- def command
16
- # todo: strategy or subclass
17
-
18
- s = nil
19
-
20
- if options[:notify] == true or options[:notify] == "growl"
21
- if (cmd = command_named("growlnotify"))
22
- # todo: check version of growlnotify and warn if it's too old
23
- icon_str = ("--image \"#{icon}\"" if icon)
24
- s = "#{cmd} -n \"#{app_name}\" -m \"#{body}\" \"#{app_name} #{title}\" #{icon_str}"
25
- end
26
- end
27
-
28
- if s.nil? and options[:notify] == true or options[:notify] == "osx"
29
- if (cmd = command_named("terminal-notifier"))
30
- icon_str = ("-appIcon \"#{icon}\"" if icon)
31
- s = "#{cmd} -title \"#{app_name}\" -message \"#{body}\" \"#{app_name} #{title}\" #{icon_str}"
32
- end
33
- end
34
-
35
- if s.nil? and options[:notify] == true or options[:notify] == "notify-send"
36
- if (cmd = command_named('notify-send'))
37
- icon_str = "--icon #{icon}" if icon
38
- s = "#{cmd} -t 500 --hint=int:transient:1 #{icon_str} \"#{app_name}: #{title}\" \"#{body}\""
39
- end
40
- end
41
-
42
- s
43
- end
44
-
45
- def command_named(name)
46
- which_command = windows? ? 'where.exe' : 'which'
47
- # TODO: remove 'INFO' error message
48
- path = `#{which_command} #{name}`.chomp
49
- path.empty? ? nil : path
50
- end
51
-
52
- def send(background = true)
53
- return unless command
54
- with_clean_env do
55
- `#{command}#{" &" if background}`
56
- end
57
- end
58
-
59
- def app_name
60
- options[:name]
61
- end
62
-
63
- def icon
64
- "#{icon_dir}/rails_red_sml.png" if rails?
65
- end
66
-
67
- def icon_dir
68
- here = File.expand_path(File.dirname(__FILE__))
69
- File.expand_path("#{here}/../../icons")
70
- end
71
-
72
- def with_clean_env
73
- if defined?(Bundler)
74
- Bundler.with_clean_env do
75
- yield
76
- end
77
- else
78
- yield
79
- end
80
- end
81
- end
82
- end
1
+ # todo: unit tests
2
+
3
+ module Rerun
4
+ class Notification
5
+ include System
6
+
7
+ attr_reader :title, :body, :options
8
+
9
+ def initialize(title, body, options = Options::DEFAULTS.dup)
10
+ @title = title
11
+ @body = body
12
+ @options = options
13
+ end
14
+
15
+ def command
16
+ # todo: strategy or subclass
17
+
18
+ s = nil
19
+
20
+ if options[:notify] == true or options[:notify] == "growl"
21
+ if (cmd = command_named("growlnotify"))
22
+ # todo: check version of growlnotify and warn if it's too old
23
+ icon_str = ("--image \"#{icon}\"" if icon)
24
+ s = "#{cmd} -n \"#{app_name}\" -m \"#{body}\" \"#{app_name} #{title}\" #{icon_str}"
25
+ end
26
+ end
27
+
28
+ if s.nil? and options[:notify] == true or options[:notify] == "osx"
29
+ if (cmd = command_named("terminal-notifier"))
30
+ icon_str = ("-appIcon \"#{icon}\"" if icon)
31
+ s = "#{cmd} -title \"#{app_name}\" -message \"#{body}\" \"#{app_name} #{title}\" #{icon_str}"
32
+ end
33
+ end
34
+
35
+ if s.nil? and options[:notify] == true or options[:notify] == "notify-send"
36
+ if (cmd = command_named('notify-send'))
37
+ icon_str = "--icon #{icon}" if icon
38
+ s = "#{cmd} -t 500 --hint=int:transient:1 #{icon_str} \"#{app_name}: #{title}\" \"#{body}\""
39
+ end
40
+ end
41
+
42
+ s
43
+ end
44
+
45
+ def command_named(name)
46
+ which_command = windows? ? 'where.exe %{cmd}' : 'which %{cmd} 2> /dev/null'
47
+ # TODO: remove 'INFO' error message
48
+ path = `#{which_command % {cmd: name}}`.chomp
49
+ path.empty? ? nil : path
50
+ end
51
+
52
+ def send(background = true)
53
+ return unless command
54
+ with_clean_env do
55
+ `#{command}#{" &" if background}`
56
+ end
57
+ end
58
+
59
+ def app_name
60
+ options[:name]
61
+ end
62
+
63
+ def icon
64
+ "#{icon_dir}/rails_red_sml.png" if rails?
65
+ end
66
+
67
+ def icon_dir
68
+ here = File.expand_path(File.dirname(__FILE__))
69
+ File.expand_path("#{here}/../../icons")
70
+ end
71
+
72
+ def with_clean_env
73
+ if defined?(Bundler)
74
+ Bundler.with_clean_env do
75
+ yield
76
+ end
77
+ else
78
+ yield
79
+ end
80
+ end
81
+ end
82
+ end