guard 2.7.1 → 2.7.2
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 +4 -4
- data/lib/guard/dsl_describer.rb +3 -1
- data/lib/guard/dsl_describer.rb.orig +180 -0
- data/lib/guard/plugin_util.rb +5 -1
- data/lib/guard/reevaluator.rb +8 -0
- data/lib/guard/runner.rb +1 -0
- data/lib/guard/setuper.rb +2 -1
- data/lib/guard/ui.rb +5 -2
- data/lib/guard/version.rb +1 -1
- data/lib/guard/version.rb.orig +1 -1
- metadata +3 -13
- data/bin/fsevent_watch_guard +0 -0
- data/lib/guard.rb.orig +0 -210
- data/lib/guard/interactor.rb.orig +0 -90
- data/lib/guard/jobs/stdin.rb.orig +0 -46
- data/lib/guard/notifiers/emacs.rb.orig +0 -103
- data/lib/guard/setuper.rb.orig +0 -384
- data/lib/guard/sheller.rb.orig +0 -107
- data/lib/guard/tags +0 -442
- data/lib/guard/terminal.rb.orig +0 -0
- data/lib/guard/ui.rb.orig +0 -264
- data/lib/guard/watcher.rb.orig +0 -119
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8a56573a032fe19caaec716bce14a5e8c31c861b
|
4
|
+
data.tar.gz: bd96b08fbe6d1df7dc92147104de03a8fdf9fc66
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 14b5197e11d01da9c1313fb06801df0533144f08cdfebd292d7f9c69db7b64ddc7deabfb638735f651d0f64a4c062de436e2c7bc2b301085e16d650fec570e6c
|
7
|
+
data.tar.gz: 58cfe1bd2aa5e666cf42c0ee118f02d9d288706d5713ef122fb0ebc43a1f03f81434d9df3e23f2050175fe719f59db7aa63e992305425fcfcbe39b836fb14393
|
data/lib/guard/dsl_describer.rb
CHANGED
@@ -35,11 +35,13 @@ module Guard
|
|
35
35
|
# @see CLI#list
|
36
36
|
#
|
37
37
|
def list
|
38
|
+
_evaluate_guardfile
|
38
39
|
names = ::Guard::PluginUtil.plugin_names.sort.uniq
|
39
40
|
final_rows = names.inject([]) do |rows, name|
|
41
|
+
used = ::Guard.plugins(name).any?
|
40
42
|
rows << {
|
41
43
|
Plugin: name.capitalize,
|
42
|
-
Guardfile:
|
44
|
+
Guardfile: used ? "✔" : "✘"
|
43
45
|
}
|
44
46
|
end
|
45
47
|
|
@@ -0,0 +1,180 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require "formatador"
|
3
|
+
|
4
|
+
require "guard/guardfile/evaluator"
|
5
|
+
require "guard/ui"
|
6
|
+
|
7
|
+
module Guard
|
8
|
+
# The DslDescriber evaluates the Guardfile and creates an internal structure
|
9
|
+
# of it that is used in some inspection utility methods like the CLI commands
|
10
|
+
# `show` and `list`.
|
11
|
+
#
|
12
|
+
# @see Guard::Dsl
|
13
|
+
# @see Guard::CLI
|
14
|
+
#
|
15
|
+
class DslDescriber
|
16
|
+
# Initializes a new DslDescriber object.
|
17
|
+
#
|
18
|
+
# @option options [String] guardfile the path to a valid Guardfile
|
19
|
+
#
|
20
|
+
# @option options [String] guardfile_contents a string representing the
|
21
|
+
# content of a valid Guardfile
|
22
|
+
#
|
23
|
+
# @see Guard::Guardfile::Evaluator#initialize
|
24
|
+
#
|
25
|
+
def initialize(options = {})
|
26
|
+
::Guard.reset_groups
|
27
|
+
::Guard.reset_plugins
|
28
|
+
::Guard.reset_scope
|
29
|
+
::Guard.reset_options(options)
|
30
|
+
end
|
31
|
+
|
32
|
+
# List the Guard plugins that are available for use in your system and marks
|
33
|
+
# those that are currently used in your `Guardfile`.
|
34
|
+
#
|
35
|
+
# @see CLI#list
|
36
|
+
#
|
37
|
+
def list
|
38
|
+
names = ::Guard::PluginUtil.plugin_names.sort.uniq
|
39
|
+
final_rows = names.inject([]) do |rows, name|
|
40
|
+
rows << {
|
41
|
+
Plugin: name.capitalize,
|
42
|
+
Guardfile: ::Guard.plugins(name) ? "✔" : "✘"
|
43
|
+
}
|
44
|
+
end
|
45
|
+
|
46
|
+
Formatador.display_compact_table(final_rows, [:Plugin, :Guardfile])
|
47
|
+
end
|
48
|
+
|
49
|
+
# Shows all Guard plugins and their options that are defined in
|
50
|
+
# the `Guardfile`.
|
51
|
+
#
|
52
|
+
# @see CLI#show
|
53
|
+
#
|
54
|
+
def show
|
55
|
+
_evaluate_guardfile
|
56
|
+
groups = ::Guard.groups
|
57
|
+
|
58
|
+
final_rows = groups.each_with_object([]) do |group, rows|
|
59
|
+
|
60
|
+
plugins = Array(::Guard.plugins(group: group.name))
|
61
|
+
|
62
|
+
plugins.each do |plugin|
|
63
|
+
options = plugin.options.inject({}) do |o, (k, v)|
|
64
|
+
o.tap { |option| option[k.to_s] = v }
|
65
|
+
end.sort
|
66
|
+
|
67
|
+
if options.empty?
|
68
|
+
rows << :split
|
69
|
+
rows << {
|
70
|
+
Group: group.title,
|
71
|
+
Plugin: plugin.title,
|
72
|
+
Option: "",
|
73
|
+
Value: ""
|
74
|
+
}
|
75
|
+
else
|
76
|
+
options.each_with_index do |(option, value), index|
|
77
|
+
if index == 0
|
78
|
+
rows << :split
|
79
|
+
rows << {
|
80
|
+
Group: group.title,
|
81
|
+
Plugin: plugin.title,
|
82
|
+
Option: option.to_s,
|
83
|
+
Value: value.inspect
|
84
|
+
}
|
85
|
+
else
|
86
|
+
rows << {
|
87
|
+
Group: "",
|
88
|
+
Plugin: "",
|
89
|
+
Option: option.to_s,
|
90
|
+
Value: value.inspect
|
91
|
+
}
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
rows
|
98
|
+
end
|
99
|
+
|
100
|
+
Formatador.display_compact_table(
|
101
|
+
final_rows.drop(1),
|
102
|
+
[:Group, :Plugin, :Option, :Value]
|
103
|
+
)
|
104
|
+
end
|
105
|
+
|
106
|
+
# Shows all notifiers and their options that are defined in
|
107
|
+
# the `Guardfile`.
|
108
|
+
#
|
109
|
+
# @see CLI#show
|
110
|
+
#
|
111
|
+
def notifiers
|
112
|
+
_evaluate_guardfile
|
113
|
+
|
114
|
+
merged_notifiers = ::Guard::Notifier::NOTIFIERS.inject(:merge)
|
115
|
+
final_rows = merged_notifiers.each_with_object([]) do |definition, rows|
|
116
|
+
|
117
|
+
name = definition[0]
|
118
|
+
clazz = definition[1]
|
119
|
+
available = clazz.available?(silent: true) ? "✔" : "✘"
|
120
|
+
notifier = ::Guard::Notifier.notifiers.detect { |n| n[:name] == name }
|
121
|
+
used = notifier ? "✔" : "✘"
|
122
|
+
|
123
|
+
options = _merge_options(clazz, notifier)
|
124
|
+
options.delete(:silent)
|
125
|
+
|
126
|
+
if options.empty?
|
127
|
+
rows << :split
|
128
|
+
_add_row(rows, name, available, used, "", "")
|
129
|
+
else
|
130
|
+
options.each_with_index do |(option, value), index|
|
131
|
+
if index == 0
|
132
|
+
rows << :split
|
133
|
+
_add_row(rows, name, available, used, option.to_s, value.inspect)
|
134
|
+
else
|
135
|
+
_add_row(rows, "", "", "", option.to_s, value.inspect)
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
rows
|
141
|
+
end
|
142
|
+
|
143
|
+
Formatador.display_compact_table(
|
144
|
+
final_rows.drop(1),
|
145
|
+
[:Name, :Available, :Used, :Option, :Value]
|
146
|
+
)
|
147
|
+
end
|
148
|
+
|
149
|
+
private
|
150
|
+
|
151
|
+
# Evaluates the `Guardfile` by delegating to
|
152
|
+
# {Guard::Guardfile::Evaluator#evaluate_guardfile}.
|
153
|
+
#
|
154
|
+
def _evaluate_guardfile
|
155
|
+
::Guard.save_scope
|
156
|
+
::Guard::Guardfile::Evaluator.new(::Guard.options).evaluate_guardfile
|
157
|
+
::Guard.restore_scope
|
158
|
+
end
|
159
|
+
|
160
|
+
def _merge_options(klass, notifier)
|
161
|
+
notify_options = notifier ? notifier[:options] : {}
|
162
|
+
|
163
|
+
if klass.const_defined?(:DEFAULTS)
|
164
|
+
klass.const_get(:DEFAULTS).merge(notify_options)
|
165
|
+
else
|
166
|
+
notify_options
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
def _add_row(rows, name, available, used, option, value)
|
171
|
+
rows << {
|
172
|
+
Name: name,
|
173
|
+
Available: available,
|
174
|
+
Used: used,
|
175
|
+
Option: option,
|
176
|
+
Value: value
|
177
|
+
}
|
178
|
+
end
|
179
|
+
end
|
180
|
+
end
|
data/lib/guard/plugin_util.rb
CHANGED
@@ -74,7 +74,11 @@ module Guard
|
|
74
74
|
if klass.superclass.to_s == "Guard::Guard"
|
75
75
|
klass.new(options.delete(:watchers), options)
|
76
76
|
else
|
77
|
-
|
77
|
+
begin
|
78
|
+
klass.new(options)
|
79
|
+
rescue ArgumentError => e
|
80
|
+
fail "Failed to call #{klass}.new(options): #{e}"
|
81
|
+
end
|
78
82
|
end
|
79
83
|
end
|
80
84
|
|
data/lib/guard/reevaluator.rb
CHANGED
@@ -7,6 +7,14 @@ module Guard
|
|
7
7
|
return unless ::Guard::Watcher.match_guardfile?(files)
|
8
8
|
::Guard.save_scope
|
9
9
|
::Guard.evaluator.reevaluate_guardfile
|
10
|
+
rescue ScriptError, StandardError => e
|
11
|
+
::Guard::UI.warning("Failed to reevaluate file: #{e}")
|
12
|
+
|
13
|
+
options = { watchers: [::Guard::Watcher.new("Guardfile")] }
|
14
|
+
::Guard.add_plugin(:reevaluator, options)
|
15
|
+
|
16
|
+
throw :task_has_failed
|
17
|
+
ensure
|
10
18
|
::Guard.restore_scope
|
11
19
|
end
|
12
20
|
end
|
data/lib/guard/runner.rb
CHANGED
data/lib/guard/setuper.rb
CHANGED
@@ -21,7 +21,7 @@ module Guard
|
|
21
21
|
wait_for_delay: nil,
|
22
22
|
listen_on: nil
|
23
23
|
}
|
24
|
-
DEFAULT_GROUPS = [:
|
24
|
+
DEFAULT_GROUPS = [:common, :default]
|
25
25
|
|
26
26
|
# Initializes the Guard singleton:
|
27
27
|
#
|
@@ -217,6 +217,7 @@ module Guard
|
|
217
217
|
end
|
218
218
|
|
219
219
|
_run_actions(actions)
|
220
|
+
return if changes.values.all?(&:empty?)
|
220
221
|
runner.run_on_changes(*changes.values)
|
221
222
|
end
|
222
223
|
|
data/lib/guard/ui.rb
CHANGED
@@ -118,9 +118,12 @@ module Guard
|
|
118
118
|
|
119
119
|
# Clear the output if clearable.
|
120
120
|
#
|
121
|
-
def clear(
|
121
|
+
def clear(opts = {})
|
122
|
+
return unless ::Guard.options[:clear]
|
123
|
+
|
122
124
|
fail "UI not set up!" if @clearable.nil?
|
123
|
-
return unless
|
125
|
+
return unless @clearable || opts[:force]
|
126
|
+
|
124
127
|
@clearable = false
|
125
128
|
::Guard::Terminal.clear
|
126
129
|
rescue Errno::ENOENT => e
|
data/lib/guard/version.rb
CHANGED
data/lib/guard/version.rb.orig
CHANGED
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.7.
|
4
|
+
version: 2.7.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: 2014-11-
|
11
|
+
date: 2014-11-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -91,14 +91,12 @@ files:
|
|
91
91
|
- CHANGELOG.md
|
92
92
|
- LICENSE
|
93
93
|
- README.md
|
94
|
-
- bin/fsevent_watch_guard
|
95
94
|
- bin/guard
|
96
95
|
- images/failed.png
|
97
96
|
- images/guard.png
|
98
97
|
- images/pending.png
|
99
98
|
- images/success.png
|
100
99
|
- lib/guard.rb
|
101
|
-
- lib/guard.rb.orig
|
102
100
|
- lib/guard/aruba_adapter.rb
|
103
101
|
- lib/guard/cli.rb
|
104
102
|
- lib/guard/commander.rb
|
@@ -113,21 +111,19 @@ files:
|
|
113
111
|
- lib/guard/deprecator.rb
|
114
112
|
- lib/guard/dsl.rb
|
115
113
|
- lib/guard/dsl_describer.rb
|
114
|
+
- lib/guard/dsl_describer.rb.orig
|
116
115
|
- lib/guard/group.rb
|
117
116
|
- lib/guard/guard.rb
|
118
117
|
- lib/guard/guardfile.rb
|
119
118
|
- lib/guard/guardfile/evaluator.rb
|
120
119
|
- lib/guard/guardfile/generator.rb
|
121
120
|
- lib/guard/interactor.rb
|
122
|
-
- lib/guard/interactor.rb.orig
|
123
121
|
- lib/guard/jobs/base.rb
|
124
122
|
- lib/guard/jobs/pry_wrapper.rb
|
125
123
|
- lib/guard/jobs/sleep.rb
|
126
|
-
- lib/guard/jobs/stdin.rb.orig
|
127
124
|
- lib/guard/notifier.rb
|
128
125
|
- lib/guard/notifiers/base.rb
|
129
126
|
- lib/guard/notifiers/emacs.rb
|
130
|
-
- lib/guard/notifiers/emacs.rb.orig
|
131
127
|
- lib/guard/notifiers/file_notifier.rb
|
132
128
|
- lib/guard/notifiers/gntp.rb
|
133
129
|
- lib/guard/notifiers/growl.rb
|
@@ -146,20 +142,14 @@ files:
|
|
146
142
|
- lib/guard/reevaluator.rb
|
147
143
|
- lib/guard/runner.rb
|
148
144
|
- lib/guard/setuper.rb
|
149
|
-
- lib/guard/setuper.rb.orig
|
150
145
|
- lib/guard/sheller.rb
|
151
|
-
- lib/guard/sheller.rb.orig
|
152
|
-
- lib/guard/tags
|
153
146
|
- lib/guard/templates/Guardfile
|
154
147
|
- lib/guard/terminal.rb
|
155
|
-
- lib/guard/terminal.rb.orig
|
156
148
|
- lib/guard/ui.rb
|
157
|
-
- lib/guard/ui.rb.orig
|
158
149
|
- lib/guard/ui/colors.rb
|
159
150
|
- lib/guard/version.rb
|
160
151
|
- lib/guard/version.rb.orig
|
161
152
|
- lib/guard/watcher.rb
|
162
|
-
- lib/guard/watcher.rb.orig
|
163
153
|
- man/guard.1
|
164
154
|
- man/guard.1.html
|
165
155
|
homepage: http://guardgem.org
|
data/bin/fsevent_watch_guard
DELETED
Binary file
|
data/lib/guard.rb.orig
DELETED
@@ -1,210 +0,0 @@
|
|
1
|
-
require "rbconfig"
|
2
|
-
|
3
|
-
require "guard/commander"
|
4
|
-
require "guard/deprecated_methods"
|
5
|
-
require "guard/deprecator"
|
6
|
-
require "guard/dsl"
|
7
|
-
require "guard/group"
|
8
|
-
require "guard/guardfile"
|
9
|
-
require "guard/interactor"
|
10
|
-
require "guard/notifier"
|
11
|
-
require "guard/plugin_util"
|
12
|
-
require "guard/runner"
|
13
|
-
require "guard/setuper"
|
14
|
-
require "guard/sheller"
|
15
|
-
require "guard/ui"
|
16
|
-
require "guard/watcher"
|
17
|
-
require "guard/reevaluator"
|
18
|
-
|
19
|
-
# Guard is the main module for all Guard related modules and classes.
|
20
|
-
# Also Guard plugins should use this namespace.
|
21
|
-
#
|
22
|
-
module Guard
|
23
|
-
DEV_NULL = Gem.win_platform? ? "NUL" : "/dev/null"
|
24
|
-
|
25
|
-
extend Commander
|
26
|
-
extend DeprecatedMethods
|
27
|
-
extend Setuper
|
28
|
-
|
29
|
-
class << self
|
30
|
-
# Called by Pry scope command
|
31
|
-
|
32
|
-
def scope=(new_scope)
|
33
|
-
@scope = new_scope
|
34
|
-
@scope.dup.freeze
|
35
|
-
end
|
36
|
-
|
37
|
-
def scope
|
38
|
-
fail "::Guard.setup() not called" if @scope.nil?
|
39
|
-
@scope.dup.freeze
|
40
|
-
end
|
41
|
-
attr_reader :runner, :listener
|
42
|
-
|
43
|
-
# Smart accessor for retrieving specific plugins at once.
|
44
|
-
#
|
45
|
-
# @see Guard.plugin
|
46
|
-
# @see Guard.group
|
47
|
-
# @see Guard.groups
|
48
|
-
#
|
49
|
-
# @example Filter plugins by String or Symbol
|
50
|
-
# Guard.plugins('rspec')
|
51
|
-
# Guard.plugins(:rspec)
|
52
|
-
#
|
53
|
-
# @example Filter plugins by Regexp
|
54
|
-
# Guard.plugins(/rsp.+/)
|
55
|
-
#
|
56
|
-
# @example Filter plugins by Hash
|
57
|
-
# Guard.plugins(name: 'rspec', group: 'backend')
|
58
|
-
#
|
59
|
-
# @param [String, Symbol, Regexp, Hash] filter the filter to apply to the
|
60
|
-
# plugins
|
61
|
-
# @return [Plugin, Array<Plugin>] the filtered plugin(s)
|
62
|
-
#
|
63
|
-
def plugins(filter = nil)
|
64
|
-
@plugins ||= []
|
65
|
-
|
66
|
-
return @plugins if filter.nil?
|
67
|
-
|
68
|
-
filtered_plugins = case filter
|
69
|
-
when String, Symbol
|
70
|
-
@plugins.select do |plugin|
|
71
|
-
plugin.name == filter.to_s.downcase.gsub("-", "")
|
72
|
-
end
|
73
|
-
when Regexp
|
74
|
-
@plugins.select do |plugin|
|
75
|
-
plugin.name =~ filter
|
76
|
-
end
|
77
|
-
when Hash
|
78
|
-
@plugins.select do |plugin|
|
79
|
-
filter.all? do |k, v|
|
80
|
-
case k
|
81
|
-
when :name
|
82
|
-
plugin.name == v.to_s.downcase.gsub("-", "")
|
83
|
-
when :group
|
84
|
-
plugin.group.name == v.to_sym
|
85
|
-
end
|
86
|
-
end
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
filtered_plugins
|
91
|
-
end
|
92
|
-
|
93
|
-
# Smart accessor for retrieving a specific plugin.
|
94
|
-
#
|
95
|
-
# @see Guard.plugins
|
96
|
-
# @see Guard.group
|
97
|
-
# @see Guard.groups
|
98
|
-
#
|
99
|
-
# @example Find a plugin by String or Symbol
|
100
|
-
# Guard.plugin('rspec')
|
101
|
-
# Guard.plugin(:rspec)
|
102
|
-
#
|
103
|
-
# @example Find a plugin by Regexp
|
104
|
-
# Guard.plugin(/rsp.+/)
|
105
|
-
#
|
106
|
-
# @example Find a plugin by Hash
|
107
|
-
# Guard.plugin(name: 'rspec', group: 'backend')
|
108
|
-
#
|
109
|
-
# @param [String, Symbol, Regexp, Hash] filter the filter for finding the
|
110
|
-
# plugin the Guard plugin
|
111
|
-
# @return [Plugin, nil] the plugin found, nil otherwise
|
112
|
-
#
|
113
|
-
def plugin(filter)
|
114
|
-
plugins(filter).first
|
115
|
-
end
|
116
|
-
|
117
|
-
# Smart accessor for retrieving specific groups at once.
|
118
|
-
#
|
119
|
-
# @see Guard.plugin
|
120
|
-
# @see Guard.plugins
|
121
|
-
# @see Guard.group
|
122
|
-
#
|
123
|
-
# @example Filter groups by String or Symbol
|
124
|
-
# Guard.groups('backend')
|
125
|
-
# Guard.groups(:backend)
|
126
|
-
#
|
127
|
-
# @example Filter groups by Regexp
|
128
|
-
# Guard.groups(/(back|front)end/)
|
129
|
-
#
|
130
|
-
# @param [String, Symbol, Regexp] filter the filter to apply to the Groups
|
131
|
-
# @return [Array<Group>] the filtered group(s)
|
132
|
-
#
|
133
|
-
def groups(filter = nil)
|
134
|
-
@groups ||= []
|
135
|
-
|
136
|
-
return @groups if filter.nil?
|
137
|
-
|
138
|
-
case filter
|
139
|
-
when String, Symbol
|
140
|
-
@groups.select { |group| group.name == filter.to_sym }
|
141
|
-
when Regexp
|
142
|
-
@groups.select { |group| group.name.to_s =~ filter }
|
143
|
-
else
|
144
|
-
fail "Invalid filter: #{filter.inspect}"
|
145
|
-
end
|
146
|
-
end
|
147
|
-
|
148
|
-
# Smart accessor for retrieving a specific group.
|
149
|
-
#
|
150
|
-
# @see Guard.plugin
|
151
|
-
# @see Guard.plugins
|
152
|
-
# @see Guard.groups
|
153
|
-
#
|
154
|
-
# @example Find a group by String or Symbol
|
155
|
-
# Guard.group('backend')
|
156
|
-
# Guard.group(:backend)
|
157
|
-
#
|
158
|
-
# @example Find a group by Regexp
|
159
|
-
# Guard.group(/(back|front)end/)
|
160
|
-
#
|
161
|
-
# @param [String, Symbol, Regexp] filter the filter for finding the group
|
162
|
-
# @return [Group] the group found, nil otherwise
|
163
|
-
#
|
164
|
-
def group(filter)
|
165
|
-
groups(filter).first
|
166
|
-
end
|
167
|
-
|
168
|
-
# Add a Guard plugin to use.
|
169
|
-
#
|
170
|
-
# @param [String] name the Guard name
|
171
|
-
# @param [Hash] options the plugin options (see Plugin documentation)
|
172
|
-
# @option options [String] group the group to which the plugin belongs
|
173
|
-
# @option options [Array<Watcher>] watchers the list of declared watchers
|
174
|
-
# @option options [Array<Hash>] callbacks the list of callbacks
|
175
|
-
# @return [Plugin] the added Guard plugin
|
176
|
-
# @see Plugin
|
177
|
-
#
|
178
|
-
def add_plugin(name, options = {})
|
179
|
-
instance = ::Guard::PluginUtil.new(name).initialize_plugin(options)
|
180
|
-
@plugins << instance
|
181
|
-
instance
|
182
|
-
end
|
183
|
-
|
184
|
-
# Used by runner to remove a failed plugin
|
185
|
-
def remove_plugin(plugin)
|
186
|
-
# TODO: coverage/aruba
|
187
|
-
@plugins.delete(plugin)
|
188
|
-
end
|
189
|
-
|
190
|
-
# Add a Guard plugin group.
|
191
|
-
#
|
192
|
-
# @param [String] name the group name
|
193
|
-
# @option options [Boolean] halt_on_fail if a task execution
|
194
|
-
# should be halted for all Guard plugins in this group if
|
195
|
-
# one Guard throws `:task_has_failed`
|
196
|
-
# @return [Group] the group added (or retrieved from the `@groups`
|
197
|
-
# variable if already present)
|
198
|
-
#
|
199
|
-
# @see Group
|
200
|
-
#
|
201
|
-
def add_group(name, options = {})
|
202
|
-
unless (group = group(name))
|
203
|
-
group = ::Guard::Group.new(name, options)
|
204
|
-
@groups << group
|
205
|
-
end
|
206
|
-
|
207
|
-
group
|
208
|
-
end
|
209
|
-
end
|
210
|
-
end
|