guard 1.5.3 → 1.5.4

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,9 +1,19 @@
1
+ ## 1.5.4 - 9 November, 2012
2
+
3
+ ### Improvements
4
+
5
+ - Thread handling improved and added thread debug mode. ([@netzpirat][])
6
+
7
+ ## Bug fix
8
+
9
+ - [#358][] Ignore `~/.pryrc` since it breaks Guard when loading the Rails env. ([@netzpirat][])
10
+
1
11
  ## 1.5.3 - 31 October, 2012
2
12
 
3
13
  ### Bug fix
4
14
 
5
15
  - [#352][] Guard always reloading twice. ([@netzpirat][])
6
- - [#354][] Ignore `~/.pryrc` since it breaks Guard when loading the Rails env. ([@netzpirat][])
16
+ - [#354][] Ignore `./.pryrc` since it breaks Guard when loading the Rails env. ([@netzpirat][])
7
17
 
8
18
  ## 1.5.2 - 29 October, 2012
9
19
 
@@ -643,7 +653,10 @@ The Listen integration has been supervised by [@thibaudgg][] and executed by [@M
643
653
  [#345]: https://github.com/guard/guard/issues/345
644
654
  [#348]: https://github.com/guard/guard/issues/348
645
655
  [#351]: https://github.com/guard/guard/issues/351
656
+ [#352]: https://github.com/guard/guard/issues/352
646
657
  [#353]: https://github.com/guard/guard/issues/353
658
+ [#354]: https://github.com/guard/guard/issues/354
659
+ [#358]: https://github.com/guard/guard/issues/358
647
660
  [@Gazer]: https://github.com/Gazer
648
661
  [@Maher4Ever]: https://github.com/Maher4Ever
649
662
  [@alandipert]: https://github.com/alandipert
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- Guard [![Build Status](https://secure.travis-ci.org/guard/guard.png?branch=master)](http://travis-ci.org/guard/guard) [![Dependency Status](https://gemnasium.com/guard/guard.png)](https://gemnasium.com/guard/guard)
1
+ Guard [![Build Status](https://secure.travis-ci.org/guard/guard.png?branch=master)](http://travis-ci.org/guard/guard) [![Dependency Status](https://gemnasium.com/guard/guard.png)](https://gemnasium.com/guard/guard) [![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/guard/guard)
2
2
  =====
3
3
 
4
4
  Guard is a command line tool to easily handle events on file system modifications.
@@ -52,25 +52,25 @@ Generate an empty `Guardfile` with:
52
52
  $ guard init
53
53
  ```
54
54
 
55
- **It's important that you always run Guard through Bundler to avoid errors.** If you're getting sick of typing `bundle exec` all
56
- the time, try the [Rubygems Bundler](https://github.com/mpapis/rubygems-bundler).
55
+ **It's important that you always run Guard through Bundler to avoid errors.** If you're getting sick of typing
56
+ `bundle exec` all the time, try the [Rubygems Bundler](https://github.com/mpapis/rubygems-bundler).
57
+
58
+ If you are on Mac OS X and have problems with either Guard not reacting to file changes or Pry behaving strange, then
59
+ you should [add proper Readline support to Ruby on Mac OS X](https://github.com/guard/guard/wiki/Add-proper-Readline-support-to-Ruby-on-Mac-OS-X).
57
60
 
58
61
  ## Efficient Filesystem Handling
59
62
 
60
- Various operating systems are willing to notify you of changes to files, but the API to
61
- register/receive updates varies (see [rb-fsevent](https://github.com/thibaudgg/rb-fsevent) for
62
- OS X, [rb-inotify](https://github.com/nex3/rb-inotify) for Linux, and
63
- [rb-fchange](https://github.com/stereobooster/rb-fchange) for Windows). If you do not supply
64
- one of the supported gems for these methods, Guard will fall back to polling, and give you a
65
- warning about it doing so.
63
+ Various operating systems are willing to notify you of changes to files, but the API to register/receive updates varies
64
+ (see [rb-fsevent](https://github.com/thibaudgg/rb-fsevent) for OS X, [rb-inotify](https://github.com/nex3/rb-inotify)
65
+ for Linux, and [rb-fchange](https://github.com/stereobooster/rb-fchange) for Windows). If you do not supply one of the
66
+ supported gems for these methods, Guard will fall back to polling, and give you a warning about it doing so.
66
67
 
67
- A challenge arises when trying to make these dependencies work with [Bundler](http://gembundler.com/).
68
- If you simply put one of these dependencies into you `Gemfile`, even if it is conditional on a
69
- platform match, the platform-specific gem will end up in the `Gemfile.lock`, and developers will
70
- thrash the file back and forth.
68
+ A challenge arises when trying to make these dependencies work with [Bundler](http://gembundler.com/). If you simply put
69
+ one of these dependencies into you `Gemfile`, even if it is conditional on a platform match, the platform-specific gem
70
+ will end up in the `Gemfile.lock`, and developers will thrash the file back and forth.
71
71
 
72
- There is a good solution. All three gems will successfully, quietly install on all three operating
73
- systems, and `guard/listen` will only pull in the one you need. This is a more proper `Gemfile`:
72
+ There is a good solution. All three gems will successfully, quietly install on all three operating systems, and
73
+ `guard/listen` will only pull in the one you need. This is a more proper `Gemfile`:
74
74
 
75
75
  ```Ruby
76
76
  group :development do
@@ -816,14 +816,18 @@ using?
816
816
 
817
817
  When you file a bug, please try to follow these simple rules if applicable:
818
818
 
819
+ * Make sure you've read the README carefully.
819
820
  * Make sure you run Guard with `bundle exec` first.
820
821
  * Add debug information to the issue by running Guard with the `--debug` option.
821
822
  * Add your `Guardfile` and `Gemfile` to the issue.
823
+ * Provide information about your environment:
824
+ * Your current versions of your OS, Ruby, Rubygems and Bundler.
825
+ * Shared project folder with services like Dropbox, NFS, etc.
822
826
  * Make sure that the issue is reproducible with your description.
823
827
 
824
828
  **It's most likely that your bug gets resolved faster if you provide as much information as possible!**
825
829
 
826
- Development [![Dependency Status](https://gemnasium.com/guard/guard.png?branch=master)](https://gemnasium.com/guard/guard) [![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/guard/guard)
830
+ Development
827
831
  -----------
828
832
 
829
833
  * Documentation hosted at [RubyDoc](http://rubydoc.info/github/guard/guard/master/frames).
data/lib/guard.rb CHANGED
@@ -44,7 +44,12 @@ module Guard
44
44
  @options = options.dup
45
45
  @watchdir = (options[:watchdir] && File.expand_path(options[:watchdir])) || Dir.pwd
46
46
  @runner = ::Guard::Runner.new
47
- @allow_stop = Listen::Turnstile.new
47
+
48
+ if @options[:debug]
49
+ Thread.abort_on_exception = true
50
+ ::Guard::UI.options[:level] = :debug
51
+ debug_command_execution
52
+ end
48
53
 
49
54
  ::Guard::UI.clear(:force => true)
50
55
  deprecated_options_warning
@@ -59,11 +64,6 @@ module Guard
59
64
 
60
65
  runner.deprecation_warning if @options[:show_deprecations]
61
66
 
62
- if @options[:debug]
63
- ::Guard::UI.options[:level] = :debug
64
- debug_command_execution
65
- end
66
-
67
67
  setup_notifier
68
68
  setup_interactor
69
69
 
@@ -162,20 +162,20 @@ module Guard
162
162
  runner.run(:start)
163
163
  end
164
164
 
165
- listener.start(false)
166
-
167
- @allow_stop.wait if @allow_stop
165
+ # Blocks main thread
166
+ listener.start
168
167
  end
169
168
 
170
169
  # Stop Guard listening to file changes
171
170
  #
172
171
  def stop
173
- listener.stop
174
- interactor.stop if interactor
175
- runner.run(:stop)
176
- ::Guard::UI.info 'Bye bye...', :reset => true
172
+ within_preserved_state(false) do
173
+ runner.run(:stop)
174
+ ::Guard::UI.info 'Bye bye...', :reset => true
177
175
 
178
- @allow_stop.signal if @allow_stop
176
+ # Unblocks main thread
177
+ listener.stop
178
+ end
179
179
  end
180
180
 
181
181
  # Reload Guardfile and all Guard plugins currently enabled.
@@ -324,9 +324,10 @@ module Guard
324
324
  # blocked and execution is synchronized
325
325
  # to avoid state inconsistency.
326
326
  #
327
+ # @param [Boolean] restart_interactor whether to restart the interactor or not
327
328
  # @yield the block to run
328
329
  #
329
- def within_preserved_state
330
+ def within_preserved_state(restart_interactor = true)
330
331
  lock.synchronize do
331
332
  begin
332
333
  interactor.stop if interactor
@@ -334,8 +335,9 @@ module Guard
334
335
  rescue Interrupt
335
336
  end
336
337
 
337
- interactor.start if interactor
338
+ interactor.start if interactor && restart_interactor
338
339
  end
340
+
339
341
  @result
340
342
  end
341
343
 
@@ -27,6 +27,7 @@ module Guard
27
27
  def initialize
28
28
  return if ENV['GUARD_ENV'] == 'test'
29
29
 
30
+ Pry.config.should_load_rc = false
30
31
  Pry.config.should_load_local_rc = false
31
32
  Pry.config.history.file = HISTORY_FILE
32
33
 
@@ -145,6 +146,7 @@ module Guard
145
146
  return if !@thread || ENV['GUARD_ENV'] == 'test'
146
147
 
147
148
  unless Thread.current == @thread
149
+ ::Guard::UI.reset_line
148
150
  ::Guard::UI.debug 'Stop interactor'
149
151
  @thread.kill
150
152
  end
@@ -194,6 +194,7 @@ module Guard
194
194
  #
195
195
  def auto_detect_notification
196
196
  available = nil
197
+ self.notifications = []
197
198
 
198
199
  NOTIFIERS.each do |group|
199
200
  added = group.map { |n| n.first }.find { |notifier| add_notification(notifier, { }, true) }
@@ -23,11 +23,7 @@ module Guard
23
23
  #
24
24
  def notify(type, title, message, image, options = { })
25
25
  first_line = message.sub(/^\n/, '').sub(/\n.*/m, '')
26
- set_terminal_title("[#{title}] #{first_line}")
27
- end
28
-
29
- def set_terminal_title(text)
30
- puts "\e]2;#{text}\a"
26
+ puts("\e]2;[#{ title }] #{ first_line }\a")
31
27
  end
32
28
  end
33
29
  end
data/lib/guard/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Guard
2
2
  # The current gem version of Guard
3
- VERSION = '1.5.3'
3
+ VERSION = '1.5.4'
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guard
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.3
4
+ version: 1.5.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-31 00:00:00.000000000 Z
12
+ date: 2012-11-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
@@ -185,9 +185,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
185
185
  - - ! '>='
186
186
  - !ruby/object:Gem::Version
187
187
  version: '0'
188
- segments:
189
- - 0
190
- hash: -1910218198348656087
191
188
  required_rubygems_version: !ruby/object:Gem::Requirement
192
189
  none: false
193
190
  requirements:
@@ -196,7 +193,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
196
193
  version: 1.3.6
197
194
  requirements: []
198
195
  rubyforge_project: guard
199
- rubygems_version: 1.8.24
196
+ rubygems_version: 1.8.23
200
197
  signing_key:
201
198
  specification_version: 3
202
199
  summary: Guard keeps an eye on your file modifications