guard 2.14.1 → 2.16.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +45 -34
- data/bin/guard +2 -6
- data/lib/guard/commander.rb +4 -3
- data/lib/guard/dsl.rb +5 -4
- data/lib/guard/guardfile/evaluator.rb +19 -11
- data/lib/guard/guardfile/generator.rb +4 -4
- data/lib/guard/jobs/pry_wrapper.rb +10 -2
- data/lib/guard/notifier.rb +1 -1
- data/lib/guard/plugin_util.rb +1 -1
- data/lib/guard/runner.rb +2 -2
- data/lib/guard/templates/Guardfile +1 -1
- data/lib/guard/version.rb +1 -1
- data/lib/guard/watcher.rb +7 -0
- data/lib/guard/watcher/pattern/matcher.rb +10 -0
- metadata +13 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: c51ad2df488dd4e7fd675358a3277ab105ec798dccffb6e62c9c713ef32fb4aa
|
4
|
+
data.tar.gz: 2d14c133e937b466588d3d6c78892aa8557db8aa8d0649438a90a0156e035ce3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 95881ca9d802a118f575360826d647629d840d902f83599f4225fd683a0d744c00f394ab5a6d60fd39e05723395946897d7921dc4f6e8b81f4a6a1ffa5f1214d
|
7
|
+
data.tar.gz: 55fe2797a631e8d521094bf2bdf5d65a04b897ff75768e2e250438ccccabc3890df269ad585dcd369dde091067eaff7603e4f483a886b12857e55ad4c6b4fe3f
|
data/README.md
CHANGED
@@ -1,13 +1,10 @@
|
|
1
|
-
|
1
|
+
# Guard
|
2
2
|
|
3
|
-
|
3
|
+
**IMPORTANT: [Ruby 2.1 is officially outdated and unsupported!](https://www.ruby-lang.org/en/news/2016/03/30/ruby-2-1-9-released/) Please upgrade to Ruby >=2.3 or >=2.2.9 before installing Guard! To install for older versions, update Bundler at least 1.12: `gem update bundler` and Bundler should correctly resolve to earlier gems for your given Ruby version.**
|
4
4
|
|
5
5
|
:exclamation: Guard is currently accepting more maintainers. Please [read this](https://github.com/guard/guard/wiki/Maintainers) if you're interested in joining the team.
|
6
6
|
|
7
|
-
|
8
|
-
=====
|
9
|
-
|
10
|
-
[![Gem Version](https://img.shields.io/gem/v/guard.svg?style=flat)](https://rubygems.org/gems/guard) [![Build Status](https://travis-ci.org/guard/guard.svg)](https://travis-ci.org/guard/guard) [![Dependency Status](https://gemnasium.com/guard/guard.svg)](https://gemnasium.com/guard/guard) [![Code Climate](https://codeclimate.com/github/guard/guard/badges/gpa.svg)](https://codeclimate.com/github/guard/guard) [![Test Coverage](https://codeclimate.com/github/guard/guard/badges/coverage.svg)](https://codeclimate.com/github/guard/guard) [![Inline docs](http://inch-ci.org/github/guard/guard.svg)](http://inch-ci.org/github/guard/guard)
|
7
|
+
[![Gem Version](https://img.shields.io/gem/v/guard.svg?style=flat)](https://rubygems.org/gems/guard) [![Build Status](https://travis-ci.org/guard/guard.svg?branch=master)](https://travis-ci.org/guard/guard) [![Code Climate](https://codeclimate.com/github/guard/guard/badges/gpa.svg)](https://codeclimate.com/github/guard/guard) [![Test Coverage](https://codeclimate.com/github/guard/guard/badges/coverage.svg)](https://codeclimate.com/github/guard/guard) [![Inline docs](http://inch-ci.org/github/guard/guard.svg)](http://inch-ci.org/github/guard/guard) [![Reviewed by Hound](https://img.shields.io/badge/Reviewed_by-Hound-8E64B0.svg)](https://houndci.com)
|
11
8
|
|
12
9
|
<img src="http://f.cl.ly/items/0A0M3W2x3I1P450z341U/guard-Icon.png" alt="Guard Icon" align="right" />
|
13
10
|
Guard automates various tasks by running custom rules whenever file or directories are modified.
|
@@ -30,22 +27,21 @@ the following places:
|
|
30
27
|
|
31
28
|
Before you file an issue, make sure you have read the _[known issues](#issues)_ and _[file an issue](#file-an-issue)_ sections that contains some important information.
|
32
29
|
|
33
|
-
|
30
|
+
## Features
|
34
31
|
|
35
32
|
* File system changes handled by our awesome [Listen](https://github.com/guard/listen) gem.
|
36
33
|
* Support for visual system notifications.
|
37
|
-
* Huge eco-system with [more than
|
38
|
-
* Tested against Ruby 2.2.
|
34
|
+
* Huge eco-system with [more than 300](https://rubygems.org/search?query=guard-) Guard plugins.
|
35
|
+
* Tested against the latest Ruby 2.3.x, 2.4.x, 2.5.x, 2.6.x, JRuby & Rubinius. See [`.travis-ci.yml`](https://github.com/guard/guard/blob/master/.travis.yml) for the exact versions.
|
39
36
|
|
40
|
-
|
37
|
+
## Screencast
|
41
38
|
|
42
39
|
Two nice screencasts are available to help you get started:
|
43
40
|
|
44
41
|
* [Guard](http://railscasts.com/episodes/264-guard) on RailsCast.
|
45
42
|
* [Guard is Your Best Friend](http://net.tutsplus.com/tutorials/tools-and-tips/guard-is-your-best-friend) on Net Tuts+.
|
46
43
|
|
47
|
-
Installation
|
48
|
-
------------
|
44
|
+
## Installation
|
49
45
|
|
50
46
|
The simplest way to install Guard is to use [Bundler](http://bundler.io).
|
51
47
|
|
@@ -77,11 +73,9 @@ $ bundle exec guard
|
|
77
73
|
|
78
74
|
If you are on Mac OS X and have problems with either Guard not reacting to file
|
79
75
|
changes or Pry behaving strange, then you should [add proper Readline support
|
80
|
-
to Ruby on Mac
|
81
|
-
X](https://github.com/guard/guard/wiki/Add-Readline-support-to-Ruby-on-Mac-OS-X).
|
82
|
-
|
76
|
+
to Ruby on macOS](https://github.com/guard/guard/wiki/Add-Readline-support-to-Ruby-on-Mac-OS-X).
|
83
77
|
|
84
|
-
|
78
|
+
## Avoiding gem/dependency problems
|
85
79
|
|
86
80
|
**It's important that you always run Guard through Bundler to avoid errors.**
|
87
81
|
|
@@ -91,6 +85,10 @@ If you're getting sick of typing `bundle exec` all the time, try one of the foll
|
|
91
85
|
project, which means running `bin/guard` (tab completion will save you a key
|
92
86
|
stroke or two) will have the exact same result as `bundle exec guard`.
|
93
87
|
|
88
|
+
* Or, you can `alias be="bundle exec"` in your `.bashrc` or similar and the execute only `be guard`.
|
89
|
+
**Protip**: It will work for all comands executed in `bundle exec` context!
|
90
|
+
|
91
|
+
|
94
92
|
* Or, for RubyGems >= 2.2.0 (at least, though the more recent the better),
|
95
93
|
simply set the `RUBYGEMS_GEMDEPS` environment variable to `-` (for autodetecting
|
96
94
|
the Gemfile in the current or parent directories) or set it to the path of your Gemfile.
|
@@ -101,7 +99,7 @@ If you're getting sick of typing `bundle exec` all the time, try one of the foll
|
|
101
99
|
|
102
100
|
* Or, for RubyGems < 2.2.0 check out the [Rubygems Bundler](https://github.com/rvm/rubygems-bundler).
|
103
101
|
|
104
|
-
|
102
|
+
## Add Guard plugins
|
105
103
|
|
106
104
|
Guard is now ready to use and you should add some Guard plugins for your specific use. Start exploring the many Guard
|
107
105
|
plugins available by browsing the [Guard organization](https://github.com/guard) on GitHub or by searching for `guard-`
|
@@ -118,8 +116,7 @@ end
|
|
118
116
|
See the init section of the Guard usage below to see how to install the supplied plugin template that you can install and
|
119
117
|
to suit your needs.
|
120
118
|
|
121
|
-
Usage
|
122
|
-
-----
|
119
|
+
## Usage
|
123
120
|
|
124
121
|
Guard is run from the command line. Please open your terminal and go to your project work directory.
|
125
122
|
|
@@ -133,40 +130,54 @@ Just launch Guard inside your Ruby or Rails project with:
|
|
133
130
|
$ bundle exec guard
|
134
131
|
```
|
135
132
|
|
136
|
-
Guard will look for a `Guardfile` in your current directory. If it does not find one, it will look
|
137
|
-
directory for a `.Guardfile`.
|
133
|
+
Guard will look for a `Guardfile` or `guardfile.rb` in your current directory. If it does not find one, it will look
|
134
|
+
in your `$HOME` directory for a `.Guardfile`.
|
138
135
|
|
139
136
|
Please look here to see all the [command line options for Guard](https://github.com/guard/guard/wiki/Command-line-options-for-Guard)
|
140
137
|
|
141
|
-
Interactions
|
142
|
-
|
138
|
+
## Interactions
|
139
|
+
|
143
140
|
Please read how to [interact with Guard](https://github.com/guard/guard/wiki/Interacting-with-Guard) on the console and which [signals](https://github.com/guard/guard/wiki/Interacting-with-Guard#guard-signals) Guard accepts
|
144
141
|
|
145
142
|
|
146
|
-
Guardfile DSL
|
147
|
-
|
143
|
+
## Guardfile DSL
|
144
|
+
|
148
145
|
For details on extending your `Guardfile` look at [Guardfile examples](https://github.com/guard/guard/wiki/Guardfile-examples) or look at a list of commands [Guardfile-DSL / Configuring-Guard](https://github.com/guard/guard/wiki/Guardfile-DSL---Configuring-Guard)
|
149
146
|
|
150
|
-
Issues
|
151
|
-
------
|
147
|
+
## Issues
|
152
148
|
|
153
149
|
Before reporting a problem, please read how to [File an issue](https://github.com/guard/guard/blob/master/CONTRIBUTING.md#file-an-issue).
|
154
150
|
|
155
|
-
Development / Contributing
|
156
|
-
--------------------------
|
151
|
+
## Development / Contributing
|
157
152
|
|
158
153
|
See the [Contributing Guide](https://github.com/guard/guard/blob/master/CONTRIBUTING.md#development).
|
159
154
|
|
160
|
-
|
155
|
+
## Releasing
|
156
|
+
|
157
|
+
### Prerequisites
|
158
|
+
|
159
|
+
* You must have commit rights to the GitHub repository.
|
160
|
+
* You must have push rights for rubygems.org.
|
161
|
+
|
162
|
+
### How to release
|
163
|
+
|
164
|
+
1. Determine which would be the correct next version number according to [semver](http://semver.org/).
|
165
|
+
1. Update the version in `./lib/guard/version.rb`.
|
166
|
+
1. Commit the version in a single commit, the message should be "Bump VERSION to X.Y.Z".
|
167
|
+
1. Push and open a pull request.
|
168
|
+
1. Once CI is green, merge the pull request.
|
169
|
+
1. Pull the changes locally and run `bundle exec rake release:full`; this will tag, push to GitHub, publish to rubygems.org, and publish the [release notes](https://github.com/guard/guard/releases) .
|
170
|
+
|
171
|
+
### Author
|
161
172
|
|
162
173
|
[Thibaud Guillaume-Gentil](https://github.com/thibaudgg) ([@thibaudgg](https://twitter.com/thibaudgg))
|
163
174
|
|
164
|
-
|
175
|
+
### Core Team
|
165
176
|
|
166
|
-
* R.I.P. :broken_heart: [Michael Kessler](https://github.com/netzpirat)
|
177
|
+
* R.I.P. :broken_heart: [Michael Kessler](https://github.com/netzpirat).
|
167
178
|
* [Rémy Coutable](https://github.com/rymai).
|
168
|
-
* [Thibaud Guillaume-Gentil](https://github.com/thibaudgg) ([@thibaudgg](https://twitter.com/thibaudgg), [thibaud.gg](
|
179
|
+
* [Thibaud Guillaume-Gentil](https://github.com/thibaudgg) ([@thibaudgg](https://twitter.com/thibaudgg), [thibaud.gg](https://thibaud.gg/)).
|
169
180
|
|
170
|
-
|
181
|
+
### Contributors
|
171
182
|
|
172
183
|
[https://github.com/guard/guard/graphs/contributors](https://github.com/guard/guard/graphs/contributors)
|
data/bin/guard
CHANGED
@@ -41,10 +41,6 @@ class GuardReloader
|
|
41
41
|
Gem.win_platform?
|
42
42
|
end
|
43
43
|
|
44
|
-
def default_system_ruby
|
45
|
-
RbConfig.ruby
|
46
|
-
end
|
47
|
-
|
48
44
|
def exit_with(code)
|
49
45
|
exit(code)
|
50
46
|
end
|
@@ -98,8 +94,8 @@ class GuardReloader
|
|
98
94
|
end
|
99
95
|
|
100
96
|
def auto_restart
|
101
|
-
args = [config.guard_core_path] + config.program_arguments
|
102
|
-
|
97
|
+
args = [Gem.ruby, config.guard_core_path] + config.program_arguments
|
98
|
+
|
103
99
|
loop do
|
104
100
|
exitcode = config.wait_ignoring_interrupts(config.spawn_with(*args))
|
105
101
|
config.exit_with(exitcode) if exitcode != 2
|
data/lib/guard/commander.rb
CHANGED
@@ -47,13 +47,14 @@ module Guard
|
|
47
47
|
exitcode = e.status
|
48
48
|
end
|
49
49
|
|
50
|
-
stop
|
51
50
|
exitcode
|
51
|
+
ensure
|
52
|
+
stop
|
52
53
|
end
|
53
54
|
|
54
55
|
def stop
|
55
|
-
listener
|
56
|
-
interactor
|
56
|
+
listener&.stop
|
57
|
+
interactor&.background
|
57
58
|
UI.debug "Guard stops all plugins"
|
58
59
|
Runner.new.run(:stop)
|
59
60
|
Notifier.disconnect
|
data/lib/guard/dsl.rb
CHANGED
@@ -37,7 +37,8 @@ module Guard
|
|
37
37
|
#
|
38
38
|
# There are two possible locations for the `Guardfile`:
|
39
39
|
#
|
40
|
-
# * The `Guardfile` in the current directory where Guard
|
40
|
+
# * The `Guardfile` or `guardfile.rb` in the current directory where Guard
|
41
|
+
# has been started
|
41
42
|
# * The `.Guardfile` in your home directory.
|
42
43
|
#
|
43
44
|
# In addition, if a user configuration `.guard.rb` in your home directory is
|
@@ -68,7 +69,7 @@ module Guard
|
|
68
69
|
# notification :ruby_gntp, host: '192.168.1.5'
|
69
70
|
#
|
70
71
|
# @param [Symbol, String] notifier the name of the notifier to use
|
71
|
-
# @param [Hash]
|
72
|
+
# @param [Hash] opts the notification library options
|
72
73
|
#
|
73
74
|
# @see Guard::Notifier for available notifier and its options.
|
74
75
|
#
|
@@ -349,7 +350,7 @@ module Guard
|
|
349
350
|
options[name] = Regexp.new(list.join("|"), Regexp::IGNORECASE)
|
350
351
|
end
|
351
352
|
|
352
|
-
UI.options.merge
|
353
|
+
UI.options = UI.options.merge(options)
|
353
354
|
end
|
354
355
|
|
355
356
|
# Sets the default scope on startup
|
@@ -366,7 +367,7 @@ module Guard
|
|
366
367
|
# @example Scope Guard to multiple plugins
|
367
368
|
# scope plugins: [:jasmine, :rspec]
|
368
369
|
#
|
369
|
-
# @param [Hash]
|
370
|
+
# @param [Hash] scope the scope for the groups and plugins
|
370
371
|
#
|
371
372
|
def scope(scope = {})
|
372
373
|
# TODO: use a Guardfile::Results class
|
@@ -18,6 +18,12 @@ module Guard
|
|
18
18
|
class Evaluator
|
19
19
|
Deprecated::Evaluator.add_deprecated(self) unless Config.new.strict?
|
20
20
|
|
21
|
+
DEFAULT_GUARDFILES = %w(
|
22
|
+
guardfile.rb
|
23
|
+
Guardfile
|
24
|
+
~/.Guardfile
|
25
|
+
).freeze
|
26
|
+
|
21
27
|
ERROR_NO_GUARDFILE = "No Guardfile found,"\
|
22
28
|
" please create one with `guard init`."
|
23
29
|
|
@@ -60,7 +66,7 @@ module Guard
|
|
60
66
|
@contents = opts[:contents]
|
61
67
|
elsif opts[:guardfile]
|
62
68
|
@type = :custom
|
63
|
-
@path = Pathname(opts[:guardfile]) # may be updated by _read
|
69
|
+
@path = Pathname.new(opts[:guardfile]) # may be updated by _read
|
64
70
|
end
|
65
71
|
end
|
66
72
|
|
@@ -178,19 +184,21 @@ module Guard
|
|
178
184
|
end
|
179
185
|
|
180
186
|
def _use_default!
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
187
|
+
DEFAULT_GUARDFILES.each do |guardfile|
|
188
|
+
begin
|
189
|
+
@path, @contents = _read(guardfile)
|
190
|
+
@type = :default
|
191
|
+
break
|
192
|
+
rescue Errno::ENOENT
|
193
|
+
if guardfile == DEFAULT_GUARDFILES.last
|
194
|
+
fail NoGuardfileError, ERROR_NO_GUARDFILE
|
195
|
+
end
|
196
|
+
end
|
189
197
|
end
|
190
198
|
end
|
191
199
|
|
192
200
|
def _read(path)
|
193
|
-
full_path = Pathname(path).expand_path
|
201
|
+
full_path = Pathname.new(path.to_s).expand_path
|
194
202
|
[full_path, full_path.read]
|
195
203
|
rescue Errno::ENOENT
|
196
204
|
fail
|
@@ -202,7 +210,7 @@ module Guard
|
|
202
210
|
end
|
203
211
|
|
204
212
|
def _guardfile_contents
|
205
|
-
@user_config ||= Pathname("~/.guard.rb").expand_path.read
|
213
|
+
@user_config ||= Pathname.new("~/.guard.rb").expand_path.read
|
206
214
|
[@contents, @user_config].compact.join("\n")
|
207
215
|
rescue Errno::ENOENT
|
208
216
|
@contents || ""
|
@@ -32,11 +32,11 @@ module Guard
|
|
32
32
|
|
33
33
|
# The location of user defined templates
|
34
34
|
begin
|
35
|
-
HOME_TEMPLATES = Pathname("~/.guard/templates").expand_path
|
35
|
+
HOME_TEMPLATES = Pathname.new("~/.guard/templates").expand_path
|
36
36
|
rescue ArgumentError
|
37
37
|
# home isn't defined. Set to the root of the drive. Trust that there
|
38
38
|
# won't be user defined templates there
|
39
|
-
HOME_TEMPLATES = Pathname("/").expand_path
|
39
|
+
HOME_TEMPLATES = Pathname.new("/").expand_path
|
40
40
|
end
|
41
41
|
|
42
42
|
class Error < RuntimeError
|
@@ -63,7 +63,7 @@ module Guard
|
|
63
63
|
# @see Guard::CLI#init
|
64
64
|
#
|
65
65
|
def create_guardfile
|
66
|
-
path = Pathname("Guardfile").expand_path
|
66
|
+
path = Pathname.new("Guardfile").expand_path
|
67
67
|
if path.exist?
|
68
68
|
_ui(:error, "Guardfile already exists at #{path}")
|
69
69
|
abort
|
@@ -81,7 +81,7 @@ module Guard
|
|
81
81
|
# initialize
|
82
82
|
#
|
83
83
|
def initialize_template(plugin_name)
|
84
|
-
guardfile = Pathname("Guardfile")
|
84
|
+
guardfile = Pathname.new("Guardfile")
|
85
85
|
|
86
86
|
plugin_util = PluginUtil.new(plugin_name)
|
87
87
|
# TODO: change to "valid?" method
|
@@ -276,11 +276,10 @@ module Guard
|
|
276
276
|
#
|
277
277
|
def _prompt(ending_char)
|
278
278
|
proc do |target_self, nest_level, pry|
|
279
|
-
history = pry.input_array.size
|
280
279
|
process = Guard.listener.paused? ? "pause" : "guard"
|
281
280
|
level = ":#{ nest_level }" unless nest_level.zero?
|
282
281
|
|
283
|
-
"[#{
|
282
|
+
"[#{ _history(pry) }] #{ _scope_for_prompt }#{ process }"\
|
284
283
|
"(#{ _clip_name(target_self) })#{ level }#{ ending_char } "
|
285
284
|
end
|
286
285
|
end
|
@@ -288,6 +287,15 @@ module Guard
|
|
288
287
|
def _clip_name(target)
|
289
288
|
Pry.view_clip(target)
|
290
289
|
end
|
290
|
+
|
291
|
+
def _history(pry)
|
292
|
+
# https://github.com/pry/pry/blob/5bf2585d0a49a4a3666a9eae80ee31153e3ffcf4/CHANGELOG.md#v0120-november-5-2018
|
293
|
+
if Gem::Version.new(Pry::VERSION) < Gem::Version.new("0.12.0")
|
294
|
+
return pry.input_array.size
|
295
|
+
end
|
296
|
+
|
297
|
+
pry.input_ring.size
|
298
|
+
end
|
291
299
|
end
|
292
300
|
end
|
293
301
|
end
|
data/lib/guard/notifier.rb
CHANGED
data/lib/guard/plugin_util.rb
CHANGED
@@ -55,7 +55,7 @@ module Guard
|
|
55
55
|
def initialize_plugin(options)
|
56
56
|
klass = plugin_class
|
57
57
|
fail "Could not load class: #{_constant_name.inspect}" unless klass
|
58
|
-
if klass.
|
58
|
+
if klass.ancestors.include?(Guard)
|
59
59
|
klass.new(options.delete(:watchers), options)
|
60
60
|
else
|
61
61
|
begin
|
data/lib/guard/runner.rb
CHANGED
@@ -11,7 +11,7 @@ module Guard
|
|
11
11
|
#
|
12
12
|
# @param [Symbol] task the task to run
|
13
13
|
#
|
14
|
-
# @param [Hash]
|
14
|
+
# @param [Hash] scope_hash either the Guard plugin or the group to run the task
|
15
15
|
# on
|
16
16
|
#
|
17
17
|
def run(task, scope_hash = {})
|
@@ -70,7 +70,7 @@ module Guard
|
|
70
70
|
# When the Group has `:halt_on_fail` disabled, we've to catch
|
71
71
|
# `:task_has_failed` here in order to avoid an uncaught throw error.
|
72
72
|
#
|
73
|
-
# @param [Guard::Plugin] guard the Guard to execute
|
73
|
+
# @param [Guard::Plugin] plugin guard the Guard to execute
|
74
74
|
# @param [Symbol] task the task to run
|
75
75
|
# @param [Array] args the arguments for the task
|
76
76
|
# @raise [:task_has_failed] when task has failed
|
@@ -3,7 +3,7 @@
|
|
3
3
|
|
4
4
|
## Uncomment and set this to only include directories you want to watch
|
5
5
|
# directories %w(app lib config test spec features) \
|
6
|
-
# .select{|d| Dir.
|
6
|
+
# .select{|d| Dir.exist?(d) ? d : UI.warning("Directory #{d} does not exist")}
|
7
7
|
|
8
8
|
## Note: if you are using the `directories` clause above and you are not
|
9
9
|
## watching the project directory ('.'), then you will want to move
|
data/lib/guard/version.rb
CHANGED
data/lib/guard/watcher.rb
CHANGED
@@ -26,6 +26,13 @@ module Guard
|
|
26
26
|
@pattern = Pattern.create(pattern)
|
27
27
|
end
|
28
28
|
|
29
|
+
# Compare with other watcher
|
30
|
+
# @param other [Guard::Watcher] other watcher for comparing
|
31
|
+
# @return [true, false] equal or not
|
32
|
+
def ==(other)
|
33
|
+
action == other.action && pattern == other.pattern
|
34
|
+
end
|
35
|
+
|
29
36
|
# Finds the files that matches a Guard plugin.
|
30
37
|
#
|
31
38
|
# @param [Guard::Plugin] guard the Guard plugin which watchers are used
|
@@ -2,10 +2,20 @@ module Guard
|
|
2
2
|
class Watcher
|
3
3
|
class Pattern
|
4
4
|
class Matcher
|
5
|
+
attr_reader :matcher
|
6
|
+
|
5
7
|
def initialize(obj)
|
6
8
|
@matcher = obj
|
7
9
|
end
|
8
10
|
|
11
|
+
# Compare with other matcher
|
12
|
+
# @param other [Guard::Watcher::Pattern::Matcher]
|
13
|
+
# other matcher for comparing
|
14
|
+
# @return [true, false] equal or not
|
15
|
+
def ==(other)
|
16
|
+
matcher == other.matcher
|
17
|
+
end
|
18
|
+
|
9
19
|
def match(string_or_pathname)
|
10
20
|
@matcher.match(normalized(string_or_pathname))
|
11
21
|
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: 2.
|
4
|
+
version: 2.16.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:
|
11
|
+
date: 2019-11-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -62,16 +62,22 @@ dependencies:
|
|
62
62
|
name: lumberjack
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
64
64
|
requirements:
|
65
|
-
- - "
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: 1.0.12
|
68
|
+
- - "<"
|
66
69
|
- !ruby/object:Gem::Version
|
67
|
-
version: '
|
70
|
+
version: '2.0'
|
68
71
|
type: :runtime
|
69
72
|
prerelease: false
|
70
73
|
version_requirements: !ruby/object:Gem::Requirement
|
71
74
|
requirements:
|
72
|
-
- - "
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 1.0.12
|
78
|
+
- - "<"
|
73
79
|
- !ruby/object:Gem::Version
|
74
|
-
version: '
|
80
|
+
version: '2.0'
|
75
81
|
- !ruby/object:Gem::Dependency
|
76
82
|
name: formatador
|
77
83
|
requirement: !ruby/object:Gem::Requirement
|
@@ -228,8 +234,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
228
234
|
- !ruby/object:Gem::Version
|
229
235
|
version: '0'
|
230
236
|
requirements: []
|
231
|
-
|
232
|
-
rubygems_version: 2.6.10
|
237
|
+
rubygems_version: 3.0.3
|
233
238
|
signing_key:
|
234
239
|
specification_version: 4
|
235
240
|
summary: Guard keeps an eye on your file modifications
|