guard 1.4.0 → 2.18.0
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 +7 -0
- data/CHANGELOG.md +1 -677
- data/LICENSE +4 -2
- data/README.md +91 -753
- data/bin/_guard-core +11 -0
- data/bin/guard +108 -3
- data/lib/guard/aruba_adapter.rb +59 -0
- data/lib/guard/cli/environments/bundler.rb +22 -0
- data/lib/guard/cli/environments/evaluate_only.rb +35 -0
- data/lib/guard/cli/environments/valid.rb +69 -0
- data/lib/guard/cli.rb +129 -128
- data/lib/guard/commander.rb +104 -0
- data/lib/guard/commands/all.rb +37 -0
- data/lib/guard/commands/change.rb +31 -0
- data/lib/guard/commands/notification.rb +26 -0
- data/lib/guard/commands/pause.rb +29 -0
- data/lib/guard/commands/reload.rb +36 -0
- data/lib/guard/commands/scope.rb +38 -0
- data/lib/guard/commands/show.rb +24 -0
- data/lib/guard/config.rb +18 -0
- data/lib/guard/deprecated/dsl.rb +45 -0
- data/lib/guard/deprecated/evaluator.rb +39 -0
- data/lib/guard/deprecated/guard.rb +328 -0
- data/lib/guard/deprecated/guardfile.rb +84 -0
- data/lib/guard/deprecated/watcher.rb +27 -0
- data/lib/guard/dsl.rb +332 -363
- data/lib/guard/dsl_describer.rb +132 -122
- data/lib/guard/dsl_reader.rb +51 -0
- data/lib/guard/group.rb +34 -14
- data/lib/guard/guardfile/evaluator.rb +232 -0
- data/lib/guard/guardfile/generator.rb +128 -0
- data/lib/guard/guardfile.rb +24 -60
- data/lib/guard/interactor.rb +31 -255
- data/lib/guard/internals/debugging.rb +68 -0
- data/lib/guard/internals/groups.rb +40 -0
- data/lib/guard/internals/helpers.rb +13 -0
- data/lib/guard/internals/plugins.rb +53 -0
- data/lib/guard/internals/queue.rb +51 -0
- data/lib/guard/internals/scope.rb +121 -0
- data/lib/guard/internals/session.rb +180 -0
- data/lib/guard/internals/state.rb +25 -0
- data/lib/guard/internals/tracing.rb +33 -0
- data/lib/guard/internals/traps.rb +10 -0
- data/lib/guard/jobs/base.rb +21 -0
- data/lib/guard/jobs/pry_wrapper.rb +336 -0
- data/lib/guard/jobs/sleep.rb +26 -0
- data/lib/guard/notifier.rb +46 -212
- data/lib/guard/options.rb +22 -0
- data/lib/guard/plugin.rb +303 -0
- data/lib/guard/plugin_util.rb +191 -0
- data/lib/guard/rake_task.rb +42 -0
- data/lib/guard/runner.rb +80 -140
- data/lib/guard/templates/Guardfile +14 -0
- data/lib/guard/terminal.rb +13 -0
- data/lib/guard/ui/colors.rb +56 -0
- data/lib/guard/ui/config.rb +70 -0
- data/lib/guard/ui/logger.rb +30 -0
- data/lib/guard/ui.rb +163 -128
- data/lib/guard/version.rb +1 -2
- data/lib/guard/watcher/pattern/deprecated_regexp.rb +45 -0
- data/lib/guard/watcher/pattern/match_result.rb +18 -0
- data/lib/guard/watcher/pattern/matcher.rb +33 -0
- data/lib/guard/watcher/pattern/pathname_path.rb +15 -0
- data/lib/guard/watcher/pattern/simple_path.rb +23 -0
- data/lib/guard/watcher/pattern.rb +24 -0
- data/lib/guard/watcher.rb +52 -95
- data/lib/guard.rb +108 -376
- data/lib/tasks/releaser.rb +116 -0
- data/man/guard.1 +12 -9
- data/man/guard.1.html +18 -12
- metadata +148 -77
- data/images/guard.png +0 -0
- data/lib/guard/guard.rb +0 -156
- data/lib/guard/hook.rb +0 -120
- data/lib/guard/interactors/coolline.rb +0 -64
- data/lib/guard/interactors/helpers/completion.rb +0 -32
- data/lib/guard/interactors/helpers/terminal.rb +0 -46
- data/lib/guard/interactors/readline.rb +0 -94
- data/lib/guard/interactors/simple.rb +0 -19
- data/lib/guard/notifiers/emacs.rb +0 -69
- data/lib/guard/notifiers/gntp.rb +0 -118
- data/lib/guard/notifiers/growl.rb +0 -99
- data/lib/guard/notifiers/growl_notify.rb +0 -92
- data/lib/guard/notifiers/libnotify.rb +0 -96
- data/lib/guard/notifiers/notifysend.rb +0 -84
- data/lib/guard/notifiers/rb_notifu.rb +0 -102
- data/lib/guard/notifiers/terminal_notifier.rb +0 -66
- data/lib/guard/notifiers/tmux.rb +0 -69
- data/lib/guard/version.rbc +0 -130
@@ -0,0 +1,328 @@
|
|
1
|
+
require "guard/config"
|
2
|
+
fail "Deprecations disabled (strict mode)" if Guard::Config.new.strict?
|
3
|
+
|
4
|
+
require "forwardable"
|
5
|
+
|
6
|
+
require "guard/ui"
|
7
|
+
require "guard/internals/session"
|
8
|
+
require "guard/internals/state"
|
9
|
+
require "guard/guardfile/evaluator"
|
10
|
+
|
11
|
+
module Guard
|
12
|
+
# @deprecated Every method in this module is deprecated
|
13
|
+
module Deprecated
|
14
|
+
module Guard
|
15
|
+
def self.add_deprecated(klass)
|
16
|
+
klass.send(:extend, ClassMethods)
|
17
|
+
end
|
18
|
+
|
19
|
+
module ClassMethods
|
20
|
+
MORE_INFO_ON_UPGRADING_TO_GUARD_2 = <<-EOS.gsub(/^\s*/, "")
|
21
|
+
For more information on how to upgrade for Guard 2.0, please head
|
22
|
+
over to: https://github.com/guard/guard/wiki/Upgrading-to-Guard-2.0%s
|
23
|
+
EOS
|
24
|
+
|
25
|
+
# @deprecated Use `Guard.plugins(filter)` instead.
|
26
|
+
#
|
27
|
+
# @see https://github.com/guard/guard/wiki/Upgrading-to-Guard-2.0 How to
|
28
|
+
# upgrade for Guard 2.0
|
29
|
+
#
|
30
|
+
GUARDS = <<-EOS.gsub(/^\s*/, "")
|
31
|
+
Starting with Guard 2.0 'Guard.guards(filter)' is deprecated.
|
32
|
+
|
33
|
+
Please use 'Guard.plugins(filter)' instead.
|
34
|
+
|
35
|
+
#{MORE_INFO_ON_UPGRADING_TO_GUARD_2 % '#deprecated-methods'}
|
36
|
+
EOS
|
37
|
+
|
38
|
+
def guards(filter = nil)
|
39
|
+
::Guard::UI.deprecation(GUARDS)
|
40
|
+
::Guard.state.session.plugins.all(filter)
|
41
|
+
end
|
42
|
+
|
43
|
+
# @deprecated Use `Guard.add_plugin(name, options = {})` instead.
|
44
|
+
#
|
45
|
+
# @see https://github.com/guard/guard/wiki/Upgrading-to-Guard-2.0 How to
|
46
|
+
# upgrade for Guard 2.0
|
47
|
+
#
|
48
|
+
ADD_GUARD = <<-EOS.gsub(/^\s*/, "")
|
49
|
+
Starting with Guard 2.0 'Guard.add_guard(name, options = {})' is
|
50
|
+
deprecated.
|
51
|
+
|
52
|
+
Please use 'Guard.add_plugin(name, options = {})' instead.
|
53
|
+
|
54
|
+
#{MORE_INFO_ON_UPGRADING_TO_GUARD_2 % '#deprecated-methods'}
|
55
|
+
EOS
|
56
|
+
|
57
|
+
def add_guard(*args)
|
58
|
+
::Guard::UI.deprecation(ADD_GUARD)
|
59
|
+
add_plugin(*args)
|
60
|
+
end
|
61
|
+
|
62
|
+
# @deprecated Use
|
63
|
+
# `Guard::PluginUtil.new(name).plugin_class(fail_gracefully:
|
64
|
+
# fail_gracefully)` instead.
|
65
|
+
#
|
66
|
+
# @see https://github.com/guard/guard/wiki/Upgrading-to-Guard-2.0 How to
|
67
|
+
# upgrade for Guard 2.0
|
68
|
+
#
|
69
|
+
GET_GUARD_CLASS = <<-EOS.gsub(/^\s*/, "")
|
70
|
+
Starting with Guard 2.0 'Guard.get_guard_class(name, fail_gracefully
|
71
|
+
= false)' is deprecated and is now always on.
|
72
|
+
|
73
|
+
Please use 'Guard::PluginUtil.new(name).plugin_class(fail_gracefully:
|
74
|
+
fail_gracefully)' instead.
|
75
|
+
|
76
|
+
#{MORE_INFO_ON_UPGRADING_TO_GUARD_2 % '#deprecated-methods'}
|
77
|
+
EOS
|
78
|
+
|
79
|
+
def get_guard_class(name, fail_gracefully = false)
|
80
|
+
UI.deprecation(GET_GUARD_CLASS)
|
81
|
+
PluginUtil.new(name).plugin_class(fail_gracefully: fail_gracefully)
|
82
|
+
end
|
83
|
+
|
84
|
+
# @deprecated Use `Guard::PluginUtil.new(name).plugin_location` instead.
|
85
|
+
#
|
86
|
+
# @see https://github.com/guard/guard/wiki/Upgrading-to-Guard-2.0 How to
|
87
|
+
# upgrade for Guard 2.0
|
88
|
+
#
|
89
|
+
LOCATE_GUARD = <<-EOS.gsub(/^\s*/, "")
|
90
|
+
Starting with Guard 2.0 'Guard.locate_guard(name)' is deprecated.
|
91
|
+
|
92
|
+
Please use 'Guard::PluginUtil.new(name).plugin_location' instead.
|
93
|
+
|
94
|
+
#{MORE_INFO_ON_UPGRADING_TO_GUARD_2 % '#deprecated-methods'}
|
95
|
+
EOS
|
96
|
+
|
97
|
+
def locate_guard(name)
|
98
|
+
UI.deprecation(LOCATE_GUARD)
|
99
|
+
PluginUtil.new(name).plugin_location
|
100
|
+
end
|
101
|
+
|
102
|
+
# @deprecated Use `Guard::PluginUtil.plugin_names` instead.
|
103
|
+
#
|
104
|
+
# @see https://github.com/guard/guard/wiki/Upgrading-to-Guard-2.0 How to
|
105
|
+
# upgrade for Guard 2.0
|
106
|
+
#
|
107
|
+
# Deprecator message for the `Guard.guard_gem_names` method
|
108
|
+
GUARD_GEM_NAMES = <<-EOS.gsub(/^\s*/, "")
|
109
|
+
Starting with Guard 2.0 'Guard.guard_gem_names' is deprecated.
|
110
|
+
|
111
|
+
Please use 'Guard::PluginUtil.plugin_names' instead.
|
112
|
+
|
113
|
+
#{MORE_INFO_ON_UPGRADING_TO_GUARD_2 % '#deprecated-methods'}
|
114
|
+
EOS
|
115
|
+
|
116
|
+
def guard_gem_names
|
117
|
+
UI.deprecation(GUARD_GEM_NAMES)
|
118
|
+
PluginUtil.plugin_names
|
119
|
+
end
|
120
|
+
|
121
|
+
RUNNING = <<-EOS.gsub(/^\s*/, "")
|
122
|
+
Starting with Guard 2.7.1 it was discovered that Guard.running was
|
123
|
+
never initialized or used internally.
|
124
|
+
EOS
|
125
|
+
|
126
|
+
def running
|
127
|
+
UI.deprecation(RUNNING)
|
128
|
+
nil
|
129
|
+
end
|
130
|
+
|
131
|
+
LOCK = <<-EOS.gsub(/^\s*/, "")
|
132
|
+
Starting with Guard 2.7.1 it was discovered that this accessor was
|
133
|
+
never initialized or used internally.
|
134
|
+
EOS
|
135
|
+
def lock
|
136
|
+
UI.deprecation(LOCK)
|
137
|
+
end
|
138
|
+
|
139
|
+
LISTENER_ASSIGN = <<-EOS.gsub(/^\s*/, "")
|
140
|
+
listener= should not be used
|
141
|
+
EOS
|
142
|
+
|
143
|
+
def listener=(_)
|
144
|
+
UI.deprecation(LISTENER_ASSIGN)
|
145
|
+
::Guard.listener
|
146
|
+
end
|
147
|
+
|
148
|
+
EVALUATOR = <<-EOS.gsub(/^\s*/, "")
|
149
|
+
Starting with Guard 2.8.2 this method shouldn't be used
|
150
|
+
EOS
|
151
|
+
|
152
|
+
def evaluator
|
153
|
+
UI.deprecation(EVALUATOR)
|
154
|
+
options = ::Guard.state.session.evaluator_options
|
155
|
+
::Guard::Guardfile::Evaluator.new(options)
|
156
|
+
end
|
157
|
+
|
158
|
+
RESET_EVALUATOR = <<-EOS.gsub(/^\s*/, "")
|
159
|
+
Starting with Guard 2.8.2 this method shouldn't be used
|
160
|
+
EOS
|
161
|
+
|
162
|
+
def reset_evaluator(_options)
|
163
|
+
UI.deprecation(RESET_EVALUATOR)
|
164
|
+
end
|
165
|
+
|
166
|
+
RUNNER = <<-EOS.gsub(/^\s*/, "")
|
167
|
+
Starting with Guard 2.8.2 this method shouldn't be used
|
168
|
+
EOS
|
169
|
+
|
170
|
+
def runner
|
171
|
+
UI.deprecation(RUNNER)
|
172
|
+
::Guard::Runner.new
|
173
|
+
end
|
174
|
+
|
175
|
+
EVALUATE_GUARDFILE = <<-EOS.gsub(/^\s*/, "")
|
176
|
+
Starting with Guard 2.8.2 this method shouldn't be used
|
177
|
+
EOS
|
178
|
+
|
179
|
+
def evaluate_guardfile
|
180
|
+
UI.deprecation(EVALUATE_GUARDFILE)
|
181
|
+
options = ::Guard.state.session.evaluator_options
|
182
|
+
evaluator = ::Guard::Guardfile::Evaluator.new(options)
|
183
|
+
evaluator.evaluate
|
184
|
+
msg = "No plugins found in Guardfile, please add at least one."
|
185
|
+
::Guard::UI.error msg if _pluginless_guardfile?
|
186
|
+
end
|
187
|
+
|
188
|
+
OPTIONS = <<-EOS.gsub(/^\s*/, "")
|
189
|
+
Starting with Guard 2.9.0 Guard.options is deprecated and ideally you
|
190
|
+
should be able to set specific options through an API or a DSL
|
191
|
+
method. Feel free to add feature requests if there's something
|
192
|
+
missing.
|
193
|
+
EOS
|
194
|
+
|
195
|
+
def options
|
196
|
+
UI.deprecation(OPTIONS)
|
197
|
+
|
198
|
+
Class.new(Hash) do
|
199
|
+
def initialize
|
200
|
+
super(to_hash)
|
201
|
+
end
|
202
|
+
|
203
|
+
def to_hash
|
204
|
+
session = ::Guard.state.session
|
205
|
+
{
|
206
|
+
clear: session.clearing?,
|
207
|
+
debug: session.debug?,
|
208
|
+
watchdir: Array(session.watchdirs).map(&:to_s),
|
209
|
+
notify: session.notify_options[:notify],
|
210
|
+
no_interactions: (session.interactor_name == :sleep)
|
211
|
+
}
|
212
|
+
end
|
213
|
+
|
214
|
+
extend Forwardable
|
215
|
+
delegate [:to_a, :keys] => :to_hash
|
216
|
+
delegate [:include?] => :keys
|
217
|
+
|
218
|
+
def fetch(key, *args)
|
219
|
+
hash = to_hash
|
220
|
+
verify_key!(hash, key)
|
221
|
+
hash.fetch(key, *args)
|
222
|
+
end
|
223
|
+
|
224
|
+
def []=(key, value)
|
225
|
+
case key
|
226
|
+
when :clear
|
227
|
+
::Guard.state.session.clearing(value)
|
228
|
+
else
|
229
|
+
msg = "Oops! Guard.option[%s]= is unhandled or unsupported." \
|
230
|
+
"Please file an issue if you rely on this option working."
|
231
|
+
fail NotImplementedError, format(msg, key)
|
232
|
+
end
|
233
|
+
end
|
234
|
+
|
235
|
+
private
|
236
|
+
|
237
|
+
def verify_key!(hash, key)
|
238
|
+
return if hash.key?(key)
|
239
|
+
msg = "Oops! Guard.option[%s] is unhandled or unsupported." \
|
240
|
+
"Please file an issue if you rely on this option working."
|
241
|
+
fail NotImplementedError, format(msg, key)
|
242
|
+
end
|
243
|
+
end.new
|
244
|
+
end
|
245
|
+
|
246
|
+
ADD_GROUP = <<-EOS.gsub(/^\s*/, "")
|
247
|
+
add_group is deprecated since 2.10.0 in favor of
|
248
|
+
Guard.state.session.groups.add
|
249
|
+
EOS
|
250
|
+
|
251
|
+
def add_group(name, options = {})
|
252
|
+
UI.deprecation(ADD_GROUP)
|
253
|
+
::Guard.state.session.groups.add(name, options)
|
254
|
+
end
|
255
|
+
|
256
|
+
ADD_PLUGIN = <<-EOS.gsub(/^\s*/, "")
|
257
|
+
add_plugin is deprecated since 2.10.0 in favor of
|
258
|
+
Guard.state.session.plugins.add
|
259
|
+
EOS
|
260
|
+
|
261
|
+
def add_plugin(name, options = {})
|
262
|
+
UI.deprecation(ADD_PLUGIN)
|
263
|
+
::Guard.state.session.plugins.add(name, options)
|
264
|
+
end
|
265
|
+
|
266
|
+
GROUP = <<-EOS.gsub(/^\s*/, "")
|
267
|
+
group is deprecated since 2.10.0 in favor of
|
268
|
+
Guard.state.session.group.add(filter).first
|
269
|
+
EOS
|
270
|
+
|
271
|
+
def group(filter)
|
272
|
+
UI.deprecation(GROUP)
|
273
|
+
::Guard.state.session.groups.all(filter).first
|
274
|
+
end
|
275
|
+
|
276
|
+
PLUGIN = <<-EOS.gsub(/^\s*/, "")
|
277
|
+
plugin is deprecated since 2.10.0 in favor of
|
278
|
+
Guard.state.session.group.add(filter).first
|
279
|
+
EOS
|
280
|
+
|
281
|
+
def plugin(filter)
|
282
|
+
UI.deprecation(PLUGIN)
|
283
|
+
::Guard.state.session.plugins.all(filter).first
|
284
|
+
end
|
285
|
+
|
286
|
+
GROUPS = <<-EOS.gsub(/^\s*/, "")
|
287
|
+
group is deprecated since 2.10.0 in favor of
|
288
|
+
Guard.state.session.groups.all(filter)
|
289
|
+
EOS
|
290
|
+
|
291
|
+
def groups(filter)
|
292
|
+
UI.deprecation(GROUPS)
|
293
|
+
::Guard.state.session.groups.all(filter)
|
294
|
+
end
|
295
|
+
|
296
|
+
PLUGINS = <<-EOS.gsub(/^\s*/, "")
|
297
|
+
plugins is deprecated since 2.10.0 in favor of
|
298
|
+
Guard.state.session.plugins.all(filter)
|
299
|
+
EOS
|
300
|
+
|
301
|
+
def plugins(filter)
|
302
|
+
UI.deprecation(PLUGINS)
|
303
|
+
::Guard.state.session.plugins.all(filter)
|
304
|
+
end
|
305
|
+
|
306
|
+
SCOPE = <<-EOS.gsub(/^\s*/, "")
|
307
|
+
scope is deprecated since 2.10.0 in favor of
|
308
|
+
Guard.state.scope.to_hash
|
309
|
+
EOS
|
310
|
+
|
311
|
+
def scope
|
312
|
+
UI.deprecation(SCOPE)
|
313
|
+
::Guard.state.scope.to_hash
|
314
|
+
end
|
315
|
+
|
316
|
+
SCOPE_ASSIGN = <<-EOS.gsub(/^\s*/, "")
|
317
|
+
scope= is deprecated since 2.10.0 in favor of
|
318
|
+
Guard.state.scope.to_hash
|
319
|
+
EOS
|
320
|
+
|
321
|
+
def scope=(scope)
|
322
|
+
UI.deprecation(SCOPE_ASSIGN)
|
323
|
+
::Guard.state.scope.from_interactor(scope)
|
324
|
+
end
|
325
|
+
end
|
326
|
+
end
|
327
|
+
end
|
328
|
+
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
require "guard/config"
|
2
|
+
fail "Deprecations disabled (strict mode)" if Guard::Config.new.strict?
|
3
|
+
|
4
|
+
require "guard/guardfile/generator"
|
5
|
+
|
6
|
+
module Guard
|
7
|
+
module Deprecated
|
8
|
+
module Guardfile
|
9
|
+
def self.add_deprecated(dsl_klass)
|
10
|
+
dsl_klass.send(:extend, ClassMethods)
|
11
|
+
end
|
12
|
+
|
13
|
+
module ClassMethods
|
14
|
+
MORE_INFO_ON_UPGRADING_TO_GUARD_2 = <<-EOS.gsub(/^\s*/, "")
|
15
|
+
For more information on how to upgrade for Guard 2.0, please head
|
16
|
+
over to: https://github.com/guard/guard/wiki/Upgrading-to-Guard-2.0%s
|
17
|
+
EOS
|
18
|
+
# @deprecated Use {Guardfile::Generator#create_guardfile} instead.
|
19
|
+
#
|
20
|
+
# @see https://github.com/guard/guard/wiki/Upgrading-to-Guard-2.0 How to
|
21
|
+
# upgrade for Guard 2.0
|
22
|
+
#
|
23
|
+
CREATE_GUARDFILE = <<-EOS.gsub(/^\s*/, "")
|
24
|
+
Starting with Guard 2.0 'Guard::Guardfile.create_guardfile(options)'
|
25
|
+
is deprecated.
|
26
|
+
|
27
|
+
Please use 'Guard::Guardfile::Generator.new(options).create_guardfile'
|
28
|
+
instead.
|
29
|
+
|
30
|
+
#{MORE_INFO_ON_UPGRADING_TO_GUARD_2 % '#deprecated-methods-2'}
|
31
|
+
EOS
|
32
|
+
|
33
|
+
def create_guardfile(options = {})
|
34
|
+
UI.deprecation(CREATE_GUARDFILE)
|
35
|
+
::Guard::Guardfile::Generator.new(options).create_guardfile
|
36
|
+
end
|
37
|
+
|
38
|
+
# @deprecated Use {Guardfile::Generator#initialize_template} instead.
|
39
|
+
#
|
40
|
+
# @see https://github.com/guard/guard/wiki/Upgrading-to-Guard-2.0 How to
|
41
|
+
# upgrade for Guard 2.0
|
42
|
+
#
|
43
|
+
# Deprecator message for the `Guardfile.initialize_template` method
|
44
|
+
INITIALIZE_TEMPLATE = <<-EOS.gsub(/^\s*/, "")
|
45
|
+
Starting with Guard 2.0
|
46
|
+
'Guard::Guardfile.initialize_template(plugin_name)' is deprecated.
|
47
|
+
|
48
|
+
Please use
|
49
|
+
'Guard::Guardfile::Generator.new.initialize_template(plugin_name)'
|
50
|
+
instead.
|
51
|
+
|
52
|
+
#{MORE_INFO_ON_UPGRADING_TO_GUARD_2 % '#deprecated-methods-2'}
|
53
|
+
EOS
|
54
|
+
|
55
|
+
def initialize_template(plugin_name)
|
56
|
+
UI.deprecation(INITIALIZE_TEMPLATE)
|
57
|
+
::Guard::Guardfile::Generator.new.initialize_template(plugin_name)
|
58
|
+
end
|
59
|
+
|
60
|
+
# @deprecated Use {Guardfile::Generator#initialize_all_templates}
|
61
|
+
# instead.
|
62
|
+
#
|
63
|
+
# @see https://github.com/guard/guard/wiki/Upgrading-to-Guard-2.0 How to
|
64
|
+
# upgrade for Guard 2.0
|
65
|
+
#
|
66
|
+
# Deprecator message for the `Guardfile.initialize_all_templates` method
|
67
|
+
INITIALIZE_ALL_TEMPLATES = <<-EOS.gsub(/^\s*/, "")
|
68
|
+
Starting with Guard 2.0 'Guard::Guardfile.initialize_all_templates'
|
69
|
+
is deprecated.
|
70
|
+
|
71
|
+
Please use 'Guard::Guardfile::Generator.new.initialize_all_templates'
|
72
|
+
instead.
|
73
|
+
|
74
|
+
#{MORE_INFO_ON_UPGRADING_TO_GUARD_2 % '#deprecated-methods-2'}
|
75
|
+
EOS
|
76
|
+
|
77
|
+
def initialize_all_templates
|
78
|
+
UI.deprecation(INITIALIZE_ALL_TEMPLATES)
|
79
|
+
::Guard::Guardfile::Generator.new.initialize_all_templates
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require "guard/config"
|
2
|
+
fail "Deprecations disabled (strict mode)" if Guard::Config.new.strict?
|
3
|
+
|
4
|
+
module Guard
|
5
|
+
module Deprecated
|
6
|
+
module Watcher
|
7
|
+
def self.add_deprecated(klass)
|
8
|
+
klass.send(:extend, ClassMethods)
|
9
|
+
end
|
10
|
+
|
11
|
+
module ClassMethods
|
12
|
+
MATCH_GUARDFILE = <<-EOS.gsub(/^\s*/, "")
|
13
|
+
Starting with Guard 2.8.3 this method is deprecated.
|
14
|
+
EOS
|
15
|
+
|
16
|
+
def match_guardfile?(files)
|
17
|
+
require "guard/guardfile/evaluator"
|
18
|
+
UI.deprecation(MATCH_GUARDFILE)
|
19
|
+
options = ::Guard.state.session.evaluator_options
|
20
|
+
evaluator = ::Guard::Guardfile::Evaluator.new(options)
|
21
|
+
path = evaluator.guardfile_path
|
22
|
+
files.any? { |file| File.expand_path(file) == path }
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|