guard 2.10.0 → 2.10.1
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.rb +11 -2
- data/lib/guard.rb.orig +57 -154
- data/lib/guard/dsl.rb +13 -8
- data/lib/guard/dsl.rb.orig +77 -23
- data/lib/guard/internals/session.rb +5 -0
- data/lib/guard/internals/session.rb.orig +15 -2
- data/lib/guard/notifier.rb +5 -6
- data/lib/guard/notifiers/tmux.rb +24 -24
- data/lib/guard/plugin.rb +2 -2
- data/lib/guard/ui.rb +1 -7
- data/lib/guard/version.rb +1 -1
- data/lib/guard/version.rb.orig +1 -1
- metadata +2 -12
- data/lib/guard/cli.rb.orig +0 -220
- data/lib/guard/deprecated/guard.rb.orig +0 -178
- data/lib/guard/dsl_describer.rb.orig +0 -188
- data/lib/guard/notifier.rb.orig +0 -247
- data/lib/guard/notifier/detected.rb.orig +0 -83
- data/lib/guard/plugin.rb.orig +0 -300
- data/lib/guard/reevaluator.rb.orig +0 -22
- data/lib/guard/templates/Guardfile.orig +0 -2
- data/lib/guard/ui.rb.orig +0 -274
- data/lib/guard/watcher.rb.orig +0 -122
@@ -69,6 +69,8 @@ module Guard
|
|
69
69
|
|
70
70
|
@guardfile_plugin_scope = []
|
71
71
|
@guardfile_group_scope = []
|
72
|
+
@guardfile_ignore = []
|
73
|
+
@guardfile_ignore_bang = []
|
72
74
|
end
|
73
75
|
|
74
76
|
def guardfile_scope(scope)
|
@@ -78,8 +80,11 @@ module Guard
|
|
78
80
|
fail "Unknown options: #{opts.inspect}" unless opts.empty?
|
79
81
|
end
|
80
82
|
|
83
|
+
# TODO: create a EvaluatorResult class?
|
81
84
|
attr_reader :guardfile_group_scope
|
82
85
|
attr_reader :guardfile_plugin_scope
|
86
|
+
attr_accessor :guardfile_ignore
|
87
|
+
attr_accessor :guardfile_ignore_bang
|
83
88
|
|
84
89
|
def clearing(on)
|
85
90
|
@clear = on
|
@@ -81,11 +81,24 @@ module Guard
|
|
81
81
|
attr_reader :guardfile_group_scope
|
82
82
|
attr_reader :guardfile_plugin_scope
|
83
83
|
|
84
|
-
|
85
|
-
|
84
|
+
def guardfile_ignore
|
85
|
+
fail NotImplementedError
|
86
|
+
end
|
87
|
+
|
88
|
+
def guardfile_ignore_bang
|
89
|
+
fail NotImplementedError
|
90
|
+
end
|
91
|
+
|
92
|
+
def clearing(on)
|
93
|
+
@clear = on
|
94
|
+
end
|
95
|
+
|
96
|
+
def clearing?
|
86
97
|
@clear
|
87
98
|
end
|
88
99
|
|
100
|
+
alias :clear? :clearing?
|
101
|
+
|
89
102
|
def debug?
|
90
103
|
@debug
|
91
104
|
end
|
data/lib/guard/notifier.rb
CHANGED
@@ -9,8 +9,7 @@ require_relative "ui"
|
|
9
9
|
|
10
10
|
module Guard
|
11
11
|
# The notifier handles sending messages to different notifiers. Currently the
|
12
|
-
# following
|
13
|
-
# libraries are supported:
|
12
|
+
# following libraries are supported:
|
14
13
|
#
|
15
14
|
# * Ruby GNTP
|
16
15
|
# * Growl
|
@@ -109,13 +108,13 @@ module Guard
|
|
109
108
|
# @param [Hash] options the turn_on options
|
110
109
|
# @option options [Boolean] silent disable any logging
|
111
110
|
#
|
112
|
-
def turn_on(
|
111
|
+
def turn_on(options = {})
|
113
112
|
_check_server!
|
114
113
|
return unless enabled?
|
115
114
|
|
116
115
|
fail "Already active!" if active?
|
117
116
|
|
118
|
-
silent =
|
117
|
+
silent = options[:silent]
|
119
118
|
|
120
119
|
@detected.available.each do |klass, _|
|
121
120
|
::Guard::UI.info(format(USING_NOTIFIER, klass.title)) unless silent
|
@@ -171,7 +170,7 @@ module Guard
|
|
171
170
|
# @option options [String] silent disable any error message
|
172
171
|
# @return [Boolean] if the notification could be added
|
173
172
|
#
|
174
|
-
def add(name,
|
173
|
+
def add(name, options = {})
|
175
174
|
_check_server!
|
176
175
|
|
177
176
|
return false unless enabled?
|
@@ -182,7 +181,7 @@ module Guard
|
|
182
181
|
end
|
183
182
|
|
184
183
|
# ok to pass new instance when called without connect (e.g. evaluator)
|
185
|
-
(@detected || Detected.new(SUPPORTED)).add(name,
|
184
|
+
(@detected || Detected.new(SUPPORTED)).add(name, options)
|
186
185
|
end
|
187
186
|
|
188
187
|
# TODO: deprecate/remove
|
data/lib/guard/notifiers/tmux.rb
CHANGED
@@ -173,41 +173,41 @@ module Guard
|
|
173
173
|
# to true, and may further disable the colorization by setting
|
174
174
|
# `change_color` to false.
|
175
175
|
#
|
176
|
-
# @param [String]
|
177
|
-
# @param [Hash]
|
178
|
-
# @option
|
176
|
+
# @param [String] message the notification message
|
177
|
+
# @param [Hash] options additional notification library options
|
178
|
+
# @option options [String] type the notification type. Either 'success',
|
179
179
|
# 'pending', 'failed' or 'notify'
|
180
|
-
# @option
|
181
|
-
# @option
|
182
|
-
# @option
|
180
|
+
# @option options [String] message the notification message body
|
181
|
+
# @option options [String] image the path to the notification image
|
182
|
+
# @option options [Boolean] change_color whether to show a color
|
183
183
|
# notification
|
184
|
-
# @option
|
184
|
+
# @option options [String,Array] color_location the location where to draw
|
185
185
|
# the color notification
|
186
|
-
# @option
|
186
|
+
# @option options [Boolean] display_message whether to display a message
|
187
187
|
# or not
|
188
|
-
# @option
|
188
|
+
# @option options [Boolean] display_on_all_clients whether to display a
|
189
189
|
# message on all tmux clients or not
|
190
190
|
#
|
191
|
-
def notify(message,
|
191
|
+
def notify(message, options = {})
|
192
192
|
super
|
193
|
-
|
193
|
+
options.delete(:image)
|
194
194
|
|
195
|
-
change_color = Defaults.option(
|
196
|
-
|
197
|
-
display_the_title = Defaults.option(
|
198
|
-
display_message = Defaults.option(
|
199
|
-
type =
|
200
|
-
title =
|
195
|
+
change_color = Defaults.option(options, :change_color)
|
196
|
+
locations = Array(Defaults.option(options, :color_location))
|
197
|
+
display_the_title = Defaults.option(options, :display_title)
|
198
|
+
display_message = Defaults.option(options, :display_message)
|
199
|
+
type = options.delete(:type).to_s
|
200
|
+
title = options.delete(:title)
|
201
201
|
|
202
202
|
if change_color
|
203
|
-
color = tmux_color(type,
|
204
|
-
|
203
|
+
color = tmux_color(type, options)
|
204
|
+
locations.each { |location| Client.set(_all?, location, color) }
|
205
205
|
end
|
206
206
|
|
207
|
-
display_title(type, title, message,
|
207
|
+
display_title(type, title, message, options) if display_the_title
|
208
208
|
|
209
209
|
return unless display_message
|
210
|
-
display_message(type, title, message,
|
210
|
+
display_message(type, title, message, options)
|
211
211
|
end
|
212
212
|
|
213
213
|
# Displays a message in the title bar of the terminal.
|
@@ -224,10 +224,10 @@ module Guard
|
|
224
224
|
# @option options [String] default_message_format a string to use as
|
225
225
|
# formatter when no format per type is defined.
|
226
226
|
#
|
227
|
-
def display_title(type, title, message,
|
227
|
+
def display_title(type, title, message, options = {})
|
228
228
|
format = "#{type}_title_format".to_sym
|
229
|
-
|
230
|
-
title_format =
|
229
|
+
default_title_format = Defaults.option(options, :default_title_format)
|
230
|
+
title_format = options.fetch(format, default_title_format)
|
231
231
|
teaser_message = message.split("\n").first
|
232
232
|
display_title = title_format % [title, teaser_message]
|
233
233
|
|
data/lib/guard/plugin.rb
CHANGED
@@ -91,7 +91,7 @@ module Guard
|
|
91
91
|
# hook :foo
|
92
92
|
# end
|
93
93
|
#
|
94
|
-
# Here, when {Guard::Plugin
|
94
|
+
# Here, when {Guard::Plugin#run_all} is called, {#hook} will notify
|
95
95
|
# callbacks registered for the "run_all_foo" event.
|
96
96
|
#
|
97
97
|
# When event is a String, {#hook} will directly turn the String
|
@@ -103,7 +103,7 @@ module Guard
|
|
103
103
|
# hook "foo_bar"
|
104
104
|
# end
|
105
105
|
#
|
106
|
-
# When {Guard::Plugin::
|
106
|
+
# When {Guard::Plugin::run_all} is called, {#hook} will notify
|
107
107
|
# callbacks registered for the "foo_bar" event.
|
108
108
|
#
|
109
109
|
# @param [Symbol, String] event the name of the Guard event
|
data/lib/guard/ui.rb
CHANGED
@@ -185,13 +185,7 @@ module Guard
|
|
185
185
|
yield plugin
|
186
186
|
end
|
187
187
|
|
188
|
-
#
|
189
|
-
# (no color by default) conditionnaly given a `plugin_name`.
|
190
|
-
#
|
191
|
-
# @param [String] plugin_name the calling plugin name
|
192
|
-
# @option options [Boolean] reset whether to clean the output before
|
193
|
-
# @option options [String] plugin manually define the calling plugin
|
194
|
-
#
|
188
|
+
# @private
|
195
189
|
def _filtered_logger_message(message, method, color_name, options = {})
|
196
190
|
message = color(message, color_name) if color_name
|
197
191
|
|
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.10.
|
4
|
+
version: 2.10.1
|
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
|
+
date: 2014-12-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -100,7 +100,6 @@ files:
|
|
100
100
|
- lib/guard.rb.orig
|
101
101
|
- lib/guard/aruba_adapter.rb
|
102
102
|
- lib/guard/cli.rb
|
103
|
-
- lib/guard/cli.rb.orig
|
104
103
|
- lib/guard/commander.rb
|
105
104
|
- lib/guard/commands/all.rb
|
106
105
|
- lib/guard/commands/change.rb
|
@@ -113,13 +112,11 @@ files:
|
|
113
112
|
- lib/guard/deprecated/dsl.rb
|
114
113
|
- lib/guard/deprecated/evaluator.rb
|
115
114
|
- lib/guard/deprecated/guard.rb
|
116
|
-
- lib/guard/deprecated/guard.rb.orig
|
117
115
|
- lib/guard/deprecated/guardfile.rb
|
118
116
|
- lib/guard/deprecated/watcher.rb
|
119
117
|
- lib/guard/dsl.rb
|
120
118
|
- lib/guard/dsl.rb.orig
|
121
119
|
- lib/guard/dsl_describer.rb
|
122
|
-
- lib/guard/dsl_describer.rb.orig
|
123
120
|
- lib/guard/group.rb
|
124
121
|
- lib/guard/guardfile.rb
|
125
122
|
- lib/guard/guardfile/evaluator.rb
|
@@ -141,9 +138,7 @@ files:
|
|
141
138
|
- lib/guard/jobs/pry_wrapper.rb
|
142
139
|
- lib/guard/jobs/sleep.rb
|
143
140
|
- lib/guard/notifier.rb
|
144
|
-
- lib/guard/notifier.rb.orig
|
145
141
|
- lib/guard/notifier/detected.rb
|
146
|
-
- lib/guard/notifier/detected.rb.orig
|
147
142
|
- lib/guard/notifiers/base.rb
|
148
143
|
- lib/guard/notifiers/emacs.rb
|
149
144
|
- lib/guard/notifiers/file_notifier.rb
|
@@ -157,23 +152,18 @@ files:
|
|
157
152
|
- lib/guard/notifiers/tmux.rb
|
158
153
|
- lib/guard/options.rb
|
159
154
|
- lib/guard/plugin.rb
|
160
|
-
- lib/guard/plugin.rb.orig
|
161
155
|
- lib/guard/plugin_util.rb
|
162
156
|
- lib/guard/rake_task.rb
|
163
157
|
- lib/guard/reevaluator.rb
|
164
|
-
- lib/guard/reevaluator.rb.orig
|
165
158
|
- lib/guard/runner.rb
|
166
159
|
- lib/guard/sheller.rb
|
167
160
|
- lib/guard/templates/Guardfile
|
168
|
-
- lib/guard/templates/Guardfile.orig
|
169
161
|
- lib/guard/terminal.rb
|
170
162
|
- lib/guard/ui.rb
|
171
|
-
- lib/guard/ui.rb.orig
|
172
163
|
- lib/guard/ui/colors.rb
|
173
164
|
- lib/guard/version.rb
|
174
165
|
- lib/guard/version.rb.orig
|
175
166
|
- lib/guard/watcher.rb
|
176
|
-
- lib/guard/watcher.rb.orig
|
177
167
|
- man/guard.1
|
178
168
|
- man/guard.1.html
|
179
169
|
homepage: http://guardgem.org
|
data/lib/guard/cli.rb.orig
DELETED
@@ -1,220 +0,0 @@
|
|
1
|
-
require "thor"
|
2
|
-
|
3
|
-
require "guard"
|
4
|
-
require "guard/version"
|
5
|
-
require "guard/dsl_describer"
|
6
|
-
require "guard/guardfile/evaluator"
|
7
|
-
require "guard/guardfile/generator"
|
8
|
-
|
9
|
-
module Guard
|
10
|
-
# Facade for the Guard command line interface managed by
|
11
|
-
# [Thor](https://github.com/wycats/thor).
|
12
|
-
#
|
13
|
-
# This is the main interface to Guard that is called by the Guard binary
|
14
|
-
# `bin/guard`. Do not put any logic in here, create a class and delegate
|
15
|
-
# instead.
|
16
|
-
#
|
17
|
-
class CLI < Thor
|
18
|
-
default_task :start
|
19
|
-
|
20
|
-
desc "start", "Starts Guard"
|
21
|
-
|
22
|
-
method_option :clear,
|
23
|
-
type: :boolean,
|
24
|
-
default: false,
|
25
|
-
aliases: "-c",
|
26
|
-
banner: "Auto clear shell before each action"
|
27
|
-
|
28
|
-
method_option :notify,
|
29
|
-
type: :boolean,
|
30
|
-
default: true,
|
31
|
-
aliases: "-n",
|
32
|
-
banner: "Notifications feature"
|
33
|
-
|
34
|
-
method_option :debug,
|
35
|
-
type: :boolean,
|
36
|
-
default: false,
|
37
|
-
aliases: "-d",
|
38
|
-
banner: "Show debug information"
|
39
|
-
|
40
|
-
method_option :group,
|
41
|
-
type: :array,
|
42
|
-
default: [],
|
43
|
-
aliases: "-g",
|
44
|
-
banner: "Run only the passed groups"
|
45
|
-
|
46
|
-
method_option :plugin,
|
47
|
-
type: :array,
|
48
|
-
default: [],
|
49
|
-
aliases: "-P",
|
50
|
-
banner: "Run only the passed plugins"
|
51
|
-
|
52
|
-
method_option :watchdir,
|
53
|
-
type: :array,
|
54
|
-
aliases: "-w",
|
55
|
-
banner: "Specify the directories to watch"
|
56
|
-
|
57
|
-
method_option :guardfile,
|
58
|
-
type: :string,
|
59
|
-
aliases: "-G",
|
60
|
-
banner: "Specify a Guardfile"
|
61
|
-
|
62
|
-
method_option :no_interactions,
|
63
|
-
type: :boolean,
|
64
|
-
default: false,
|
65
|
-
aliases: "-i",
|
66
|
-
banner: "Turn off completely any Guard terminal interactions"
|
67
|
-
|
68
|
-
method_option :no_bundler_warning,
|
69
|
-
type: :boolean,
|
70
|
-
default: false,
|
71
|
-
aliases: "-B",
|
72
|
-
banner: "Turn off warning when Bundler is not present"
|
73
|
-
|
74
|
-
# Listen options
|
75
|
-
method_option :latency,
|
76
|
-
type: :numeric,
|
77
|
-
aliases: "-l",
|
78
|
-
banner: 'Overwrite Listen\'s default latency'
|
79
|
-
|
80
|
-
method_option :force_polling,
|
81
|
-
type: :boolean,
|
82
|
-
default: false,
|
83
|
-
aliases: "-p",
|
84
|
-
banner: "Force usage of the Listen polling listener"
|
85
|
-
|
86
|
-
method_option :wait_for_delay,
|
87
|
-
type: :numeric,
|
88
|
-
aliases: "-y",
|
89
|
-
banner: 'Overwrite Listen\'s default wait_for_delay'
|
90
|
-
|
91
|
-
method_option :listen_on,
|
92
|
-
type: :string,
|
93
|
-
aliases: "-o",
|
94
|
-
default: false,
|
95
|
-
banner: "Specify a network address to Listen on for "\
|
96
|
-
"file change events (e.g. for use in VMs)"
|
97
|
-
|
98
|
-
# Start Guard by initializing the defined Guard plugins and watch the file
|
99
|
-
# system.
|
100
|
-
#
|
101
|
-
# This is the default task, so calling `guard` is the same as calling
|
102
|
-
# `guard start`.
|
103
|
-
#
|
104
|
-
# @see Guard.start
|
105
|
-
#
|
106
|
-
def start
|
107
|
-
_verify_bundler_presence unless options[:no_bundler_warning]
|
108
|
-
::Guard.start(options)
|
109
|
-
end
|
110
|
-
|
111
|
-
desc "list", "Lists Guard plugins that can be used with init"
|
112
|
-
|
113
|
-
# List the Guard plugins that are available for use in your system and
|
114
|
-
# marks those that are currently used in your `Guardfile`.
|
115
|
-
#
|
116
|
-
# @see Guard::DslDescriber.list
|
117
|
-
#
|
118
|
-
def list
|
119
|
-
::Guard::DslDescriber.new(options).list
|
120
|
-
end
|
121
|
-
|
122
|
-
desc "notifiers", "Lists notifiers and its options"
|
123
|
-
|
124
|
-
# List the Notifiers for use in your system.
|
125
|
-
#
|
126
|
-
# @see Guard::DslDescriber.notifiers
|
127
|
-
#
|
128
|
-
def notifiers
|
129
|
-
::Guard::DslDescriber.new(options).notifiers
|
130
|
-
end
|
131
|
-
|
132
|
-
desc "version", "Show the Guard version"
|
133
|
-
map %w(-v --version) => :version
|
134
|
-
|
135
|
-
# Shows the current version of Guard.
|
136
|
-
#
|
137
|
-
# @see Guard::VERSION
|
138
|
-
#
|
139
|
-
def version
|
140
|
-
$stdout.puts "Guard version #{ ::Guard::VERSION }"
|
141
|
-
end
|
142
|
-
|
143
|
-
desc "init [GUARDS]", "Generates a Guardfile at the current directory"\
|
144
|
-
" (if it is not already there) and adds all installed Guard plugins"\
|
145
|
-
" or the given GUARDS into it"
|
146
|
-
|
147
|
-
method_option :bare,
|
148
|
-
type: :boolean,
|
149
|
-
default: false,
|
150
|
-
aliases: "-b",
|
151
|
-
banner: "Generate a bare Guardfile without adding any"\
|
152
|
-
" installed plugin into it"
|
153
|
-
|
154
|
-
# Initializes the templates of all installed Guard plugins and adds them
|
155
|
-
# to the `Guardfile` when no Guard name is passed. When passing
|
156
|
-
# Guard plugin names it does the same but only for those Guard plugins.
|
157
|
-
#
|
158
|
-
# @see Guard::Guardfile.initialize_template
|
159
|
-
# @see Guard::Guardfile.initialize_all_templates
|
160
|
-
#
|
161
|
-
# @param [Array<String>] plugin_names the name of the Guard plugins to
|
162
|
-
# initialize
|
163
|
-
#
|
164
|
-
def init(*plugin_names)
|
165
|
-
_verify_bundler_presence unless options[:no_bundler_warning]
|
166
|
-
|
167
|
-
::Guard.reset_options(options) # Since UI.deprecated uses config
|
168
|
-
|
169
|
-
generator = Guardfile::Generator.new(abort_on_existence: options[:bare])
|
170
|
-
generator.create_guardfile
|
171
|
-
|
172
|
-
# Note: this reset "hack" will be fixed after refactoring
|
173
|
-
::Guard.reset_plugins
|
174
|
-
|
175
|
-
# Evaluate because it might have existed and creating was skipped
|
176
|
-
::Guard::Guardfile::Evaluator.new(Guard.options).evaluate_guardfile
|
177
|
-
|
178
|
-
return if options[:bare]
|
179
|
-
|
180
|
-
if plugin_names.empty?
|
181
|
-
generator.initialize_all_templates
|
182
|
-
else
|
183
|
-
plugin_names.each do |plugin_name|
|
184
|
-
generator.initialize_template(plugin_name)
|
185
|
-
end
|
186
|
-
end
|
187
|
-
end
|
188
|
-
|
189
|
-
desc "show", "Show all defined Guard plugins and their options"
|
190
|
-
map %w(-T) => :show
|
191
|
-
|
192
|
-
# Shows all Guard plugins and their options that are defined in
|
193
|
-
# the `Guardfile`
|
194
|
-
#
|
195
|
-
# @see Guard::DslDescriber.show
|
196
|
-
#
|
197
|
-
def show
|
198
|
-
::Guard::DslDescriber.new(options).show
|
199
|
-
end
|
200
|
-
|
201
|
-
private
|
202
|
-
|
203
|
-
# Verifies if Guard is run with `bundle exec` and
|
204
|
-
# shows a hint to do so if not.
|
205
|
-
#
|
206
|
-
def _verify_bundler_presence
|
207
|
-
return unless File.exist?("Gemfile")
|
208
|
-
return if ENV["BUNDLE_GEMFILE"] || ENV["RUBYGEMS_GEMDEPS"]
|
209
|
-
|
210
|
-
::Guard::UI.info <<EOF
|
211
|
-
|
212
|
-
Guard here! It looks like your project has a Gemfile, yet you are running
|
213
|
-
`guard` outside of Bundler. If this is your intent, feel free to ignore this
|
214
|
-
message. Otherwise, consider using `bundle exec guard` to ensure your
|
215
|
-
dependencies are loaded correctly.
|
216
|
-
(You can run `guard` with --no-bundler-warning to get rid of this message.)
|
217
|
-
EOF
|
218
|
-
end
|
219
|
-
end
|
220
|
-
end
|