guard 1.8.1 → 1.8.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ba8f46c161c351e6bea4e1e081dbdf03f3fb5d69
4
- data.tar.gz: 72f8a3b0ebff20f11ca2965ac0048c60944c0e4b
3
+ metadata.gz: d8fb762e56c86e00c5fd53652c39889555015b3b
4
+ data.tar.gz: d812a81ec1891b959909135b2e4f4f62d83139cc
5
5
  SHA512:
6
- metadata.gz: 20a022bdd9430729254a79114ce133948a683a20b7612784d86b943be1529e6840b0837dfe2a911fd387fb518b9ce1bf064bf6d38bfe5b1f0d6ca72dd9cda7fd
7
- data.tar.gz: bbc15b8533dc34a8ddf931699159e4b922c767b28e86b38461e3b57c8f929d6504dcefba2e368a2187e58d0f7cbe8851bf367dff85f558d89511dfe171cf71ba
6
+ metadata.gz: 7451a09fc44f143356690ede3f094d1a5d6b0d46d0ed74958b21d9422f87ba6950b408f5c98122c0afac8080cfc28e9d7eff5c68c651aa896a1eade79b3a496b
7
+ data.tar.gz: 3d233757055d728a941375914c2070175490ea6759f23606955bb7b24783f8f5d768ba641cbd73f3aae77080c87961f3faa2c1d75348e739e94929219090ca47
data/CHANGELOG.md CHANGED
@@ -1,6 +1,17 @@
1
1
  ## Master
2
2
 
3
- No changes.
3
+ No changes yet.
4
+
5
+ ## 1.8.2 - 30 July, 2013
6
+
7
+ ### Bug fix
8
+
9
+ - [#443][] Escape `notify-send` arguments. ([@netzpirat][])
10
+
11
+ ### Improvements
12
+
13
+ - [#460][], [#463][] Better Windows support. ([@cablegram][])
14
+ - [#450][] Allow multiple watch directories. ([@timmfin][])
4
15
 
5
16
  ## 1.8.1 - 17 June, 2013
6
17
 
@@ -776,7 +787,10 @@ The Listen integration has been supervised by [@thibaudgg][] and executed by [@M
776
787
  [#414]: https://github.com/guard/guard/issues/414
777
788
  [#416]: https://github.com/guard/guard/issues/416
778
789
  [#443]: https://github.com/guard/guard/issues/443
790
+ [#450]: https://github.com/guard/guard/issues/450
779
791
  [#453]: https://github.com/guard/guard/issues/453
792
+ [#460]: https://github.com/guard/guard/issues/460
793
+ [#463]: https://github.com/guard/guard/issues/463
780
794
  [@Gazer]: https://github.com/Gazer
781
795
  [@Maher4Ever]: https://github.com/Maher4Ever
782
796
  [@Nerian]: https://github.com/Nerian
@@ -860,6 +874,7 @@ The Listen integration has been supervised by [@thibaudgg][] and executed by [@M
860
874
  [@tarsolya]: https://github.com/tarsolya
861
875
  [@thibaudgg]: https://github.com/thibaudgg
862
876
  [@thierryhenrio]: https://github.com/thierryhenrio
877
+ [@timmfin]: https://github.com/timmfin
863
878
  [@tinogomes]: https://github.com/tinogomes
864
879
  [@tomas-zemres]: https://github.com/tomas-zemres
865
880
  [@tpope]: https://github.com/tpope
data/README.md CHANGED
@@ -218,10 +218,11 @@ $ guard -d # shortcut
218
218
 
219
219
  #### `-w`/`--watchdir` option
220
220
 
221
- Guard can watch any directory instead of the current directory:
221
+ Guard can watch any number of directories instead of only the current directory:
222
222
 
223
223
  ```bash
224
224
  $ guard --watchdir ~/your/fancy/project
225
+ $ guard -w ~/your/fancy/project ~/your/fancier/project2 #multiple directories
225
226
  $ guard -w ~/your/fancy/project # shortcut
226
227
  ```
227
228
 
data/lib/guard.rb CHANGED
@@ -38,20 +38,25 @@ module Guard
38
38
  # @option options [Boolean] notify if system notifications should be shown
39
39
  # @option options [Boolean] debug if debug output should be shown
40
40
  # @option options [Array<String>] group the list of groups to start
41
- # @option options [String] watchdir the director to watch
41
+ # @option options [Array<String>] watchdir the directories to watch
42
42
  # @option options [String] guardfile the path to the Guardfile
43
43
  # @deprecated @option options [Boolean] watch_all_modifications watches all file modifications if true
44
44
  # @deprecated @option options [Boolean] no_vendor ignore vendored dependencies
45
45
  #
46
46
  def setup(options = {})
47
- @running = true
48
- @lock = Mutex.new
49
- @options = options.dup
50
- @watchdir = (options[:watchdir] && File.expand_path(options[:watchdir])) || Dir.pwd
51
- @runner = ::Guard::Runner.new
52
- @scope = { :plugins => [], :groups => [] }
53
-
54
- Dir.chdir(@watchdir)
47
+ @running = true
48
+ @lock = Mutex.new
49
+ @options = options.dup
50
+ @runner = ::Guard::Runner.new
51
+ @scope = { :plugins => [], :groups => [] }
52
+
53
+ @watchdirs = [Dir.pwd]
54
+
55
+ if options[:watchdir]
56
+ # Ensure we have an array
57
+ @watchdirs = Array(options[:watchdir]).map { |dir| File.expand_path dir }
58
+ end
59
+
55
60
  ::Guard::UI.clear(:force => true)
56
61
  setup_debug
57
62
  deprecated_options_warning
@@ -99,6 +104,19 @@ module Guard
99
104
  #
100
105
  def setup_listener
101
106
  listener_callback = lambda do |modified, added, removed|
107
+
108
+ # Convert to relative paths (respective to the watchdir it came from)
109
+ @watchdirs.each do |watchdir|
110
+ [modified, added, removed].each do |paths|
111
+ paths.map! do |path|
112
+ if path.start_with? watchdir
113
+ path.sub "#{watchdir}#{File::SEPARATOR}", ''
114
+ else
115
+ path
116
+ end
117
+ end
118
+ end
119
+ end
102
120
  ::Guard::Dsl.reevaluate_guardfile if ::Guard::Watcher.match_guardfile?(modified)
103
121
 
104
122
  ::Guard.within_preserved_state do
@@ -106,12 +124,13 @@ module Guard
106
124
  end
107
125
  end
108
126
 
109
- listener_options = { :relative_paths => true }
127
+ listener_options = {}
110
128
  %w[latency force_polling].each do |option|
111
129
  listener_options[option.to_sym] = options[option] if options.key?(option)
112
130
  end
113
131
 
114
- @listener = Listen.to(@watchdir, listener_options).change(&listener_callback)
132
+ listen_args = @watchdirs + [listener_options]
133
+ @listener = Listen.to(*listen_args).change(&listener_callback)
115
134
  end
116
135
 
117
136
  # Sets up traps to catch signals used to control Guard.
@@ -190,7 +209,7 @@ module Guard
190
209
  within_preserved_state do
191
210
  ::Guard::UI.debug 'Guard starts all plugins'
192
211
  runner.run(:start)
193
- ::Guard::UI.info "Guard is now watching at '#{ @watchdir }'"
212
+ ::Guard::UI.info "Guard is now watching at '#{ @watchdirs.join "', '" }'"
194
213
  listener.start
195
214
  end
196
215
  end
data/lib/guard/cli.rb CHANGED
@@ -48,9 +48,9 @@ module Guard
48
48
  :banner => 'Run only the passed plugins'
49
49
 
50
50
  method_option :watchdir,
51
- :type => :string,
51
+ :type => :array,
52
52
  :aliases => '-w',
53
- :banner => 'Specify the directory to watch'
53
+ :banner => 'Specify the directories to watch'
54
54
 
55
55
  method_option :guardfile,
56
56
  :type => :string,
@@ -89,6 +89,7 @@ module Guard
89
89
  Pry.config.should_load_local_rc = false
90
90
  Pry.config.history.file = File.expand_path(self.class.options[:history_file] || HISTORY_FILE)
91
91
 
92
+ @stty_exists = nil
92
93
  add_hooks
93
94
 
94
95
  replace_reset_command
@@ -120,7 +121,7 @@ module Guard
120
121
 
121
122
  if stty_exists?
122
123
  Pry.config.hooks.add_hook :after_eval, :restore_visibility do
123
- system('stty echo 2>/dev/null')
124
+ system("stty echo 2>#{ DEV_NULL }")
124
125
  end
125
126
  end
126
127
  end
@@ -240,7 +241,7 @@ module Guard
240
241
 
241
242
  store_terminal_settings if stty_exists?
242
243
 
243
- if !@thread || !@thread.alive?
244
+ if !@thread || !['sleep', 'run'].include?(@thread.status)
244
245
  ::Guard::UI.debug 'Start interactor'
245
246
 
246
247
  @thread = Thread.new do
@@ -270,7 +271,8 @@ module Guard
270
271
  # @return [Boolean] the status of stty
271
272
  #
272
273
  def stty_exists?
273
- @stty_exists ||= system('hash', 'stty')
274
+ @stty_exists ||= system('hash', 'stty') ? true : false if @stty_exists.nil?
275
+ @stty_exists
274
276
  end
275
277
 
276
278
  # Stores the terminal settings so we can resore them
@@ -104,7 +104,7 @@ module Guard
104
104
  ENV['GUARD_NOTIFY'] = 'false'
105
105
  else
106
106
  notifications.each do |notification|
107
- ::Guard::UI.info "Guard uses #{ get_notifier_module(notification[:name]).to_s.split('::').last } to send notifications."
107
+ ::Guard::UI.info "Guard is using #{ get_notifier_module(notification[:name]).to_s.split('::').last } to send notifications."
108
108
  notifier = get_notifier_module(notification[:name])
109
109
  notifier.turn_on(notification[:options]) if notifier.respond_to?(:turn_on)
110
110
  end
@@ -164,7 +164,7 @@ module Guard
164
164
  private
165
165
 
166
166
  def system(args)
167
- args += " >/dev/null 2>&1" if ENV['GUARD_ENV'] == 'test'
167
+ args += " >#{ DEV_NULL } 2>&1" if ENV['GUARD_ENV'] == 'test'
168
168
  super
169
169
  end
170
170
 
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.8.1'
3
+ VERSION = '1.8.2'
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guard
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.1
4
+ version: 1.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thibaud Guillaume-Gentil
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-06-17 00:00:00.000000000 Z
11
+ date: 2013-07-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -98,16 +98,16 @@ dependencies:
98
98
  name: rspec
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ~>
101
+ - - '>='
102
102
  - !ruby/object:Gem::Version
103
- version: 2.13.0
103
+ version: 2.14.1
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ~>
108
+ - - '>='
109
109
  - !ruby/object:Gem::Version
110
- version: 2.13.0
110
+ version: 2.14.1
111
111
  description: Guard is a command line tool to easily handle events on file system modifications.
112
112
  email:
113
113
  - thibaud@thibaud.me
@@ -161,7 +161,8 @@ files:
161
161
  - man/guard.1.html
162
162
  - README.md
163
163
  homepage: http://guardgem.org
164
- licenses: []
164
+ licenses:
165
+ - MIT
165
166
  metadata: {}
166
167
  post_install_message:
167
168
  rdoc_options: []