guard 2.0.3 → 2.0.4

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
  SHA1:
3
- metadata.gz: e49133e02a08d182dd7ee09ca5dcee0a2e0949f5
4
- data.tar.gz: 9a2ed142aa0a4c7b1c2bc224fddc951a428a93e4
3
+ metadata.gz: efd4e83bdc08e364c81e2d39245a9148e72534ba
4
+ data.tar.gz: 38e624d192902e6ca16f3851c9ef77503be1defa
5
5
  SHA512:
6
- metadata.gz: 866934042ebebbef9855f9be0a9c620e49e7f62b51eabda81247d15e2ba1f07ca0fd28cfb4ddc946688bec86184021fc91a74be28f19e6179629f2d75b497190
7
- data.tar.gz: a45d6770d5f5d2c03f12df7674a71682f8266f3ff55022a94bed99641b28cc012f3ff802cd637d807e98e4162cde64a0ca9de65d1d35f8f26bfec6e39ed3cbde
6
+ metadata.gz: 09f3d2477a9454d0d02499c77f6c62ff21f79ec113b4b38907c13f384ee884cbca53df241f41db39041d8f532f0afbc7014f5eddb29671c48ce305ae214e7d95
7
+ data.tar.gz: a31602bbbdea1643e9ebebe118e881aa1a899f895e3896013997914ace5ccae7c783b6598fbfdac8bec28abb2981d775ecb7927d94c35fd9b699033417e1c743
data/README.md CHANGED
@@ -172,7 +172,7 @@ $ bundle exec guard -c # shortcut
172
172
  You can add the following snippet to your `~/.guardrc` to have the clear option always be enabled:
173
173
 
174
174
  ```
175
- Guard.options.clear = true
175
+ Guard.options[:clear] = true
176
176
  ```
177
177
 
178
178
  #### `-n`/`--notify` option
data/lib/guard/dsl.rb CHANGED
@@ -299,7 +299,7 @@ module Guard
299
299
  end
300
300
  end
301
301
 
302
- ::Guard::UI.options = ::Guard::UI.options.marshal_dump.merge options
302
+ ::Guard::UI.options.merge!(options)
303
303
  end
304
304
 
305
305
  # Sets the default scope on startup
@@ -1,3 +1,5 @@
1
+ require 'guard/options'
2
+
1
3
  module Guard
2
4
  module Guardfile
3
5
 
@@ -16,7 +18,7 @@ module Guard
16
18
  # @option opts [String] guardfile_contents a string representing the content of a valid Guardfile
17
19
  #
18
20
  def initialize(opts = {})
19
- @options = ::Guard::Options.new([:guardfile, :guardfile_contents].reduce({}) { |h, key| h[key] = opts[key]; h })
21
+ @options = ::Guard::Options.new(opts.select { |k, _| [:guardfile, :guardfile_contents].include?(k.to_sym) })
20
22
  end
21
23
 
22
24
  # Evaluates the DSL methods in the `Guardfile`.
@@ -84,7 +86,7 @@ module Guard
84
86
  # the Guardfile has been specified via the `:guardfile_contents` option.
85
87
  #
86
88
  def guardfile_path
87
- options.guardfile_path || ''
89
+ options[:guardfile_path] || ''
88
90
  end
89
91
 
90
92
  # Gets the content of the `Guardfile` concatenated with the global
@@ -103,21 +105,12 @@ module Guard
103
105
 
104
106
  private
105
107
 
106
- # Gets the default path of the `Guardfile`. This returns the `Guardfile`
107
- # from the current directory when existing, or the global `~/.Guardfile`.
108
- #
109
- # @return [String] the path to the Guardfile
110
- #
111
- def _guardfile_default_path
112
- File.exist?(_local_guardfile_path) ? _local_guardfile_path : _home_guardfile_path
113
- end
114
-
115
108
  # Gets the content of the `Guardfile`.
116
109
  #
117
110
  # @return [String] the Guardfile content
118
111
  #
119
112
  def _guardfile_contents_without_user_config
120
- options.guardfile_contents || ''
113
+ options[:guardfile_contents] || ''
121
114
  end
122
115
 
123
116
  # Evaluates the content of the `Guardfile`.
@@ -125,7 +118,7 @@ module Guard
125
118
  # @param [String] contents the content to evaluate.
126
119
  #
127
120
  def _instance_eval_guardfile(contents)
128
- ::Guard::Dsl.new.instance_eval(contents, options.guardfile_path, 1)
121
+ ::Guard::Dsl.new.instance_eval(contents, options[:guardfile_path], 1)
129
122
  rescue => ex
130
123
  ::Guard::UI.error "Invalid Guardfile, original error is:\n#{ $! }"
131
124
  raise ex
@@ -135,40 +128,65 @@ module Guard
135
128
  # the options as `:guardfile_contents`.
136
129
  #
137
130
  def _fetch_guardfile_contents
138
- if options.guardfile_contents
139
- ::Guard::UI.info 'Using inline Guardfile.'
140
- options.guardfile_path = 'Inline Guardfile'
141
-
142
- elsif options.guardfile
143
- if File.exist?(options.guardfile)
144
- _read_guardfile(options.guardfile)
145
- ::Guard::UI.info "Using Guardfile at #{ options.guardfile }."
146
- else
147
- ::Guard::UI.error "No Guardfile exists at #{ options.guardfile }."
148
- exit 1
149
- end
131
+ _use_inline_guardfile || _use_provided_guardfile || _use_default_guardfile
150
132
 
133
+ unless _guardfile_contents_usable?
134
+ ::Guard::UI.error 'No Guard plugins found in Guardfile, please add at least one.'
135
+ end
136
+ end
137
+
138
+ # Use the provided inline Guardfile if provided.
139
+ #
140
+ def _use_inline_guardfile
141
+ return false unless options[:guardfile_contents]
142
+
143
+ ::Guard::UI.info 'Using inline Guardfile.'
144
+ options[:guardfile_path] = 'Inline Guardfile'
145
+ end
146
+
147
+ # Try to use the provided Guardfile. Exits Guard if the Guardfile cannot
148
+ # be found.
149
+ #
150
+ def _use_provided_guardfile
151
+ return false unless options[:guardfile]
152
+
153
+ options[:guardfile] = File.expand_path(options[:guardfile])
154
+ if File.exist?(options[:guardfile])
155
+ _read_guardfile(options[:guardfile])
156
+ ::Guard::UI.info "Using Guardfile at #{ options[:guardfile] }."
157
+ true
151
158
  else
152
- if File.exist?(_guardfile_default_path)
153
- _read_guardfile(_guardfile_default_path)
154
- else
155
- ::Guard::UI.error 'No Guardfile found, please create one with `guard init`.'
156
- exit 1
157
- end
159
+ ::Guard::UI.error "No Guardfile exists at #{ options[:guardfile] }."
160
+ exit 1
158
161
  end
162
+ end
159
163
 
160
- unless _guardfile_contents_usable?
161
- ::Guard::UI.error 'No Guard plugins found in Guardfile, please add at least one.'
164
+ # Try to use one of the default Guardfiles (local or home Guardfile).
165
+ # Exits Guard if no Guardfile is found.
166
+ #
167
+ def _use_default_guardfile
168
+ if guardfile_path = _find_default_guardfile
169
+ _read_guardfile(guardfile_path)
170
+ else
171
+ ::Guard::UI.error 'No Guardfile found, please create one with `guard init`.'
172
+ exit 1
162
173
  end
163
174
  end
164
175
 
176
+ # Returns the first default Guardfile (either local or home Guardfile)
177
+ # or nil otherwise.
178
+ #
179
+ def _find_default_guardfile
180
+ [_local_guardfile_path, _home_guardfile_path].find { |path| File.exist?(path) }
181
+ end
182
+
165
183
  # Reads the current `Guardfile` content.
166
184
  #
167
185
  # @param [String] guardfile_path the path to the Guardfile
168
186
  #
169
187
  def _read_guardfile(guardfile_path)
170
- options.guardfile_path = guardfile_path
171
- options.guardfile_contents = File.read(guardfile_path)
188
+ options[:guardfile_path] = guardfile_path
189
+ options[:guardfile_contents] = File.read(guardfile_path)
172
190
  rescue => ex
173
191
  ::Guard::UI.error ex.inspect
174
192
  ::Guard::UI.error("Error reading file #{ guardfile_path }")
@@ -182,9 +200,8 @@ module Guard
182
200
  ::Guard.runner.run(:stop)
183
201
  ::Guard.reset_groups
184
202
  ::Guard.reset_plugins
203
+ ::Guard.reset_scope
185
204
  ::Guard::Notifier.clear_notifiers
186
-
187
- options.guardfile_contents
188
205
  end
189
206
 
190
207
  # Starts Guard and notification and show a message
@@ -218,7 +235,7 @@ module Guard
218
235
  # @return [String] the path to the local Guardfile
219
236
  #
220
237
  def _local_guardfile_path
221
- File.join(Dir.pwd, 'Guardfile')
238
+ File.expand_path(File.join(Dir.pwd, 'Guardfile'))
222
239
  end
223
240
 
224
241
  # The path to the `.Guardfile` that is located at
@@ -91,7 +91,7 @@ module Guard
91
91
  # Guard auto detects the first available library.
92
92
  #
93
93
  def turn_on
94
- _auto_detect_notification if notifiers.empty? && (!::Guard.options || ::Guard.options.notify)
94
+ _auto_detect_notification if notifiers.empty? && (!::Guard.options || ::Guard.options[:notify])
95
95
 
96
96
  if notifiers.empty?
97
97
  turn_off
@@ -43,13 +43,13 @@ module Guard
43
43
  # @return [Boolean] the availability status
44
44
  #
45
45
  def self.available?(opts = {})
46
- unless _supported_host?
46
+ if _supported_host?
47
+ true
48
+ else
47
49
  hosts = supported_hosts.map { |host| HOSTS[host.to_sym] }.join(', ')
48
50
  ::Guard::UI.error "The :#{name} notifier runs only on #{hosts}." unless opts.fetch(:silent) { false }
49
- return false
51
+ false
50
52
  end
51
-
52
- true
53
53
  end
54
54
 
55
55
  # This method must be overriden.
@@ -19,9 +19,15 @@ module Guard
19
19
  }
20
20
 
21
21
  def self.available?(opts = {})
22
- super
23
- result = `#{ opts.fetch(:client, DEFAULTS[:client]) } --eval '1' 2> #{DEV_NULL} || echo 'N/A'`
22
+ super and _emacs_client_available?(opts)
23
+ end
24
24
 
25
+ # @private
26
+ #
27
+ # @return [Boolean] whether or not the emacs client is available
28
+ #
29
+ def self._emacs_client_available?(opts)
30
+ result = `#{opts.fetch(:client, DEFAULTS[:client])} --eval '1' 2> #{DEV_NULL} || echo 'N/A'`
25
31
  !%w(N/A 'N/A').include?(result.chomp!)
26
32
  end
27
33
 
@@ -19,8 +19,7 @@ module Guard
19
19
  # results will be written
20
20
  #
21
21
  def self.available?(opts = {})
22
- super
23
- opts.has_key?(:path)
22
+ super and opts.has_key?(:path)
24
23
  end
25
24
 
26
25
  # Writes the notification to a file. By default it writes type, title,
@@ -49,8 +49,7 @@ module Guard
49
49
  end
50
50
 
51
51
  def self.available?(opts = {})
52
- super
53
- require_gem_safely(opts)
52
+ super and require_gem_safely(opts)
54
53
  end
55
54
 
56
55
  # Shows a system notification.
@@ -43,8 +43,25 @@ module Guard
43
43
  end
44
44
 
45
45
  def self.available?(opts = {})
46
- super
47
- _register!(opts) if require_gem_safely(opts)
46
+ super and require_gem_safely(opts) and _register!(opts)
47
+ end
48
+
49
+ # @private
50
+ #
51
+ # Detects if the Growl gem is available and if not, displays an
52
+ # error message unless `opts[:silent]` is true.
53
+ #
54
+ # @return [Boolean] whether or not Growl is installed
55
+ #
56
+ def self._register!(opts)
57
+ if ::Growl.installed?
58
+ true
59
+ else
60
+ unless opts[:silent]
61
+ ::Guard::UI.error "Please install the 'growlnotify' executable (available by installing the 'growl' gem)."
62
+ end
63
+ false
64
+ end
48
65
  end
49
66
 
50
67
  # Shows a system notification.
@@ -80,17 +97,6 @@ module Guard
80
97
  ::Growl.notify(message, opts)
81
98
  end
82
99
 
83
- # @private
84
- #
85
- def self._register!(options)
86
- unless ::Growl.installed?
87
- ::Guard::UI.error "Please install the 'growlnotify' executable." unless options[:silent]
88
- return false
89
- end
90
-
91
- true
92
- end
93
-
94
100
  end
95
101
 
96
102
  end
@@ -32,8 +32,33 @@ module Guard
32
32
  end
33
33
 
34
34
  def self.available?(opts = {})
35
- super
36
- _register!(opts) if require_gem_safely(opts)
35
+ super and require_gem_safely(opts) and _register!(opts)
36
+ end
37
+
38
+ # @private
39
+ #
40
+ # Detects if the GrowlNotify gem is available and if not, displays an
41
+ # error message unless `opts[:silent]` is true. If it's available,
42
+ # GrowlNotify is configured for Guard.
43
+ #
44
+ # @return [Boolean] whether or not GrowlNotify is available
45
+ #
46
+ def self._register!(options)
47
+ if ::GrowlNotify.application_name != 'Guard'
48
+ ::GrowlNotify.config do |c|
49
+ c.notifications = %w(success pending failed notify)
50
+ c.default_notifications = 'notify'
51
+ c.application_name = 'Guard'
52
+ end
53
+ end
54
+
55
+ true
56
+
57
+ rescue ::GrowlNotify::GrowlNotFound
58
+ unless options[:silent]
59
+ ::Guard::UI.error 'Please install Growl from http://growl.info'
60
+ end
61
+ false
37
62
  end
38
63
 
39
64
  # Shows a system notification.
@@ -62,26 +87,6 @@ module Guard
62
87
  ::GrowlNotify.send_notification(opts)
63
88
  end
64
89
 
65
- # @private
66
- #
67
- def self._register!(options)
68
- if ::GrowlNotify.application_name != 'Guard'
69
- ::GrowlNotify.config do |c|
70
- c.notifications = %w(success pending failed notify)
71
- c.default_notifications = 'notify'
72
- c.application_name = 'Guard'
73
- end
74
- end
75
-
76
- true
77
-
78
- rescue ::GrowlNotify::GrowlNotFound
79
- unless options[:silent]
80
- ::Guard::UI.error 'Please install Growl from http://growl.info'
81
- end
82
- false
83
- end
84
-
85
90
  end
86
91
 
87
92
  end
@@ -35,8 +35,7 @@ module Guard
35
35
  end
36
36
 
37
37
  def self.available?(opts = {})
38
- super
39
- require_gem_safely(opts)
38
+ super and require_gem_safely(opts)
40
39
  end
41
40
 
42
41
  # Shows a system notification.
@@ -25,8 +25,33 @@ module Guard
25
25
  end
26
26
 
27
27
  def self.available?(opts = {})
28
- super
29
- _register!(opts)
28
+ super and _register!(opts)
29
+ end
30
+
31
+ # @private
32
+ #
33
+ # @return [Boolean] whether or not the notify-send binary is available
34
+ #
35
+ def self._notifysend_binary_available?
36
+ !`which notify-send`.empty?
37
+ end
38
+
39
+ # @private
40
+ #
41
+ # Detects if the notify-send binary is available and if not, displays an
42
+ # error message unless `opts[:silent]` is true.
43
+ #
44
+ # @return [Boolean] whether or not the notify-send binary is available
45
+ #
46
+ def self._register!(opts)
47
+ if _notifysend_binary_available?
48
+ true
49
+ else
50
+ unless opts[:silent]
51
+ ::Guard::UI.error 'The :notifysend notifier runs only on Linux, FreeBSD, OpenBSD and Solaris with the libnotify-bin package installed.'
52
+ end
53
+ false
54
+ end
30
55
  end
31
56
 
32
57
  # Shows a system notification.
@@ -69,36 +94,15 @@ module Guard
69
94
  #
70
95
  # @param [String] command the command execute
71
96
  # @param [Array] supported list of supported option flags
72
- # @param [Hash] options additional command options
97
+ # @param [Hash] opts additional command options
73
98
  # @return [Array<String>] the command and its options converted to a shell command.
74
99
  #
75
- def _to_arguments(command, supported, options = {})
76
- options.reduce(command) do |cmd, (flag, value)|
100
+ def _to_arguments(command, supported, opts = {})
101
+ opts.reduce(command) do |cmd, (flag, value)|
77
102
  supported.include?(flag) ? (cmd << "-#{ flag }" << value.to_s) : cmd
78
103
  end
79
104
  end
80
105
 
81
- # @private
82
- #
83
- # @return [Boolean] whether or not the notify-send binary is available
84
- #
85
- def self._notifysend_binary_available?
86
- !`which notify-send`.empty?
87
- end
88
-
89
- # @private
90
- #
91
- def self._register!(options)
92
- unless _notifysend_binary_available?
93
- unless options[:silent]
94
- ::Guard::UI.error 'The :notifysend notifier runs only on Linux, FreeBSD, OpenBSD and Solaris with the libnotify-bin package installed.'
95
- end
96
- false
97
- end
98
-
99
- true
100
- end
101
-
102
106
  end
103
107
 
104
108
  end
@@ -41,8 +41,7 @@ module Guard
41
41
  end
42
42
 
43
43
  def self.available?(opts = {})
44
- super
45
- require_gem_safely(opts)
44
+ super and require_gem_safely(opts)
46
45
  end
47
46
 
48
47
  # Shows a system notification.
@@ -32,8 +32,7 @@ module Guard
32
32
  end
33
33
 
34
34
  def self.available?(opts = {})
35
- super
36
- _register!(opts) if require_gem_safely(opts)
35
+ super and require_gem_safely(opts) and _register!(opts)
37
36
  end
38
37
 
39
38
  # Shows a system notification.
@@ -62,11 +61,16 @@ module Guard
62
61
 
63
62
  # @private
64
63
  #
65
- def self._register!(options)
64
+ # Detects if the terminal-notifier-guard gem is available and if not,
65
+ # displays an error message unless `opts[:silent]` is true.
66
+ #
67
+ # @return [Boolean] whether or not the terminal-notifier-guard gem is available
68
+ #
69
+ def self._register!(opts)
66
70
  if ::TerminalNotifier::Guard.available?
67
71
  true
68
72
  else
69
- unless options[:silent]
73
+ unless opts[:silent]
70
74
  ::Guard::UI.error 'The :terminal_notifier only runs on Mac OS X 10.8 and later.'
71
75
  end
72
76
  false
@@ -35,15 +35,32 @@ module Guard
35
35
  }
36
36
 
37
37
  def self.available?(opts = {})
38
- super
38
+ super and _register!(opts)
39
+ end
39
40
 
40
- if ENV[opts.fetch(:tmux_environment, DEFAULTS[:tmux_environment])].nil?
41
+ # @private
42
+ #
43
+ # @return [Boolean] whether or not a TMUX environment is available
44
+ #
45
+ def self._tmux_environment_available?(opts)
46
+ !ENV[opts.fetch(:tmux_environment, DEFAULTS[:tmux_environment])].nil?
47
+ end
48
+
49
+ # @private
50
+ #
51
+ # Detects if a TMUX environment is available and if not,
52
+ # displays an error message unless `opts[:silent]` is true.
53
+ #
54
+ # @return [Boolean] whether or not a TMUX environment is available
55
+ #
56
+ def self._register!(opts)
57
+ if _tmux_environment_available?(opts)
58
+ true
59
+ else
41
60
  unless opts[:silent]
42
61
  ::Guard::UI.error 'The :tmux notifier runs only on when Guard is executed inside of a tmux session.'
43
62
  end
44
63
  false
45
- else
46
- true
47
64
  end
48
65
  end
49
66
 
data/lib/guard/options.rb CHANGED
@@ -1,10 +1,10 @@
1
- require 'ostruct'
1
+ require 'thor/core_ext/hash_with_indifferent_access'
2
2
 
3
3
  module Guard
4
4
 
5
5
  # A class that holds options. Can be instantiated with default options.
6
6
  #
7
- class Options < OpenStruct
7
+ class Options < Thor::CoreExt::HashWithIndifferentAccess
8
8
 
9
9
  # Initializes an Guard::Options object. `default_opts` is merged into
10
10
  # `opts`.
@@ -13,7 +13,7 @@ module Guard
13
13
  # @param [Hash] default_opts the default options
14
14
  #
15
15
  def initialize(opts = {}, default_opts = {})
16
- super(default_opts.dup.merge(opts.dup))
16
+ super(default_opts.merge(opts || {}))
17
17
  end
18
18
 
19
19
  end
@@ -123,8 +123,8 @@ module Guard
123
123
  # Returns the plugin's name (without "guard-").
124
124
  #
125
125
  # @example Name for Guard::RSpec
126
- # > Guard::RSpec.new.name
127
- # => "rspec"
126
+ # Guard::RSpec.new.name
127
+ # #=> "rspec"
128
128
  #
129
129
  # @return [String]
130
130
  #
@@ -135,8 +135,8 @@ module Guard
135
135
  # Returns the plugin's class name without the Guard:: namespace.
136
136
  #
137
137
  # @example Title for Guard::RSpec
138
- # > Guard::RSpec.new.title
139
- # => "RSpec"
138
+ # Guard::RSpec.new.title
139
+ # #=> "RSpec"
140
140
  #
141
141
  # @return [String]
142
142
  #
data/lib/guard/setuper.rb CHANGED
@@ -45,13 +45,13 @@ module Guard
45
45
  @watchdirs = [Dir.pwd]
46
46
  @runner = ::Guard::Runner.new
47
47
 
48
- if options.watchdir
48
+ if options[:watchdir]
49
49
  # Ensure we have an array
50
- @watchdirs = Array(options.watchdir).map { |dir| File.expand_path dir }
50
+ @watchdirs = Array(options[:watchdir]).map { |dir| File.expand_path dir }
51
51
  end
52
52
 
53
53
  ::Guard::UI.clear(force: true)
54
- _setup_debug if options.debug
54
+ _setup_debug if options[:debug]
55
55
  _setup_listener
56
56
  _setup_signal_traps
57
57
 
@@ -61,7 +61,7 @@ module Guard
61
61
 
62
62
  evaluate_guardfile
63
63
 
64
- setup_scope(groups: options.group, plugins: options.plugin)
64
+ setup_scope(groups: options[:group], plugins: options[:plugin])
65
65
 
66
66
  _setup_notifier
67
67
 
@@ -71,7 +71,7 @@ module Guard
71
71
  # Lazy initializer for Guard's options hash
72
72
  #
73
73
  def options
74
- @options ||= ::Guard::Options.new(@opts || {}, DEFAULT_OPTIONS)
74
+ @options ||= ::Guard::Options.new(@opts, DEFAULT_OPTIONS)
75
75
  end
76
76
 
77
77
  # Lazy initializer for Guardfile evaluator
@@ -83,7 +83,7 @@ module Guard
83
83
  # Lazy initializer the interactor unless the user has specified not to.
84
84
  #
85
85
  def interactor
86
- return if options.no_interactions || !::Guard::Interactor.enabled
86
+ return if options[:no_interactions] || !::Guard::Interactor.enabled
87
87
 
88
88
  @interactor ||= ::Guard::Interactor.new
89
89
  end
@@ -163,7 +163,7 @@ module Guard
163
163
  #
164
164
  def _setup_debug
165
165
  Thread.abort_on_exception = true
166
- ::Guard::UI.options.level = :debug
166
+ ::Guard::UI.options[:level] = :debug
167
167
  _debug_command_execution
168
168
  end
169
169
 
@@ -191,8 +191,8 @@ module Guard
191
191
  end
192
192
 
193
193
  listener_options = {}
194
- %w[latency force_polling].each do |option|
195
- listener_options[option.to_sym] = options.send(option) if options.send(option)
194
+ [:latency, :force_polling].each do |option|
195
+ listener_options[option] = options[option] if options[option]
196
196
  end
197
197
 
198
198
  listen_args = @watchdirs + [listener_options]
@@ -231,7 +231,7 @@ module Guard
231
231
  # Enables or disables the notifier based on user's configurations.
232
232
  #
233
233
  def _setup_notifier
234
- if options.notify && ENV['GUARD_NOTIFY'] != 'false'
234
+ if options[:notify] && ENV['GUARD_NOTIFY'] != 'false'
235
235
  ::Guard::Notifier.turn_on
236
236
  else
237
237
  ::Guard::Notifier.turn_off
data/lib/guard/ui.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require 'lumberjack'
2
2
 
3
+ require 'guard/options'
3
4
  require 'guard/ui/colors'
4
5
 
5
6
  module Guard
@@ -20,8 +21,7 @@ module Guard
20
21
  #
21
22
  def logger
22
23
  @logger ||= begin
23
- opts = options.marshal_dump
24
- Lumberjack::Logger.new(opts.delete(:device) { $stderr }, opts)
24
+ Lumberjack::Logger.new(options.fetch(:device) { $stderr }, options)
25
25
  end
26
26
  end
27
27
 
@@ -82,7 +82,7 @@ module Guard
82
82
  # @option options [String] plugin manually define the calling plugin
83
83
  #
84
84
  def deprecation(message, options = {})
85
- warning(message, options) if ::Guard.options.show_deprecations
85
+ warning(message, options) if ::Guard.options[:show_deprecations]
86
86
  end
87
87
 
88
88
  # Show a debug message that is prefixed with DEBUG and a timestamp.
@@ -104,7 +104,7 @@ module Guard
104
104
  # Clear the output if clearable.
105
105
  #
106
106
  def clear(options = {})
107
- if ::Guard.options.clear && (@clearable || options[:force])
107
+ if ::Guard.options[:clear] && (@clearable || options[:force])
108
108
  @clearable = false
109
109
  system('clear;')
110
110
  end
@@ -150,8 +150,8 @@ module Guard
150
150
  # @yieldparam [String] param the calling plugin name
151
151
  #
152
152
  def _filter(plugin)
153
- only = options.only
154
- except = options.except
153
+ only = options[:only]
154
+ except = options[:except]
155
155
  plugin = plugin || calling_plugin_name
156
156
 
157
157
  if (!only && !except) || (only && only.match(plugin)) || (except && !except.match(plugin))
data/lib/guard/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Guard
2
- VERSION = '2.0.3'
2
+ VERSION = '2.0.4'
3
3
  end
data/lib/guard/watcher.rb CHANGED
@@ -89,7 +89,7 @@ module Guard
89
89
  # @return [Boolean] whether one of these files is the Guardfile
90
90
  #
91
91
  def self.match_guardfile?(files)
92
- files.any? { |file| "#{ Dir.pwd }/#{ file }" == ::Guard.evaluator.guardfile_path }
92
+ files.any? { |file| File.expand_path(file) == ::Guard.evaluator.guardfile_path }
93
93
  end
94
94
 
95
95
  # Test the watchers pattern against a file.
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: 2.0.3
4
+ version: 2.0.4
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-10-06 00:00:00.000000000 Z
11
+ date: 2013-10-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor