guard 2.15.0 → 2.16.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1d3499725d20725a5a0e1259e9e3f74694798f4a43e503f67f28bd218553bbe8
4
- data.tar.gz: a20150e135df2bef124397c8532d85b20a5ea6d7b78259763465175c512c637e
3
+ metadata.gz: 787baab35992b3608d89a5d4a064d300a9a636ef9432510126347989fc1568b9
4
+ data.tar.gz: 7fda9a3ecd35de97a472292a7021b53644e473333588985cd40435e9a048662f
5
5
  SHA512:
6
- metadata.gz: adcd66a415123303070578f425ea3aab1ccbbd1d0fad175054232d08da2dfa8365eb12e558cc6b1bf83874d29bb467a75cd636b3a8e5330f8e1dc6d408728988
7
- data.tar.gz: 9138af75c456be233f5df7b92acedb73ca8c257ade2020a2a1eedb0b2ac1b8e7b42922a94f7169cff4084f5b1d8fdf56942086a6978a3263af8840a85f678ea5
6
+ metadata.gz: f94c5f80ed6f67bb9ff71e058406101ac52aca3661b00e1b82981abef890e4d15dcae871d41e883299614d1eece60b322c1265c9f007573375771bc0049353f3
7
+ data.tar.gz: e3748fdf116614e2063091a86728d37ee85ee871a50cbd64628c8c5189756d91e4fd0018e1966d3ef72e6ffbcad99043e19e901459eb5bd3631b564d6c73d47c
data/README.md CHANGED
@@ -4,7 +4,7 @@
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
- [![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) [![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)
8
8
 
9
9
  <img src="http://f.cl.ly/items/0A0M3W2x3I1P450z341U/guard-Icon.png" alt="Guard Icon" align="right" />
10
10
  Guard automates various tasks by running custom rules whenever file or directories are modified.
@@ -31,8 +31,8 @@ Before you file an issue, make sure you have read the _[known issues](#issues)_
31
31
 
32
32
  * File system changes handled by our awesome [Listen](https://github.com/guard/listen) gem.
33
33
  * Support for visual system notifications.
34
- * Huge eco-system with [more than 220](https://rubygems.org/search?query=guard-) Guard plugins.
35
- * Tested against Ruby 2.2.9, 2.3.6, 2.4.3, 2.5.0, JRuby & Rubinius.
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.
36
36
 
37
37
  ## Screencast
38
38
 
@@ -73,9 +73,7 @@ $ bundle exec guard
73
73
 
74
74
  If you are on Mac OS X and have problems with either Guard not reacting to file
75
75
  changes or Pry behaving strange, then you should [add proper Readline support
76
- to Ruby on Mac OS
77
- X](https://github.com/guard/guard/wiki/Add-Readline-support-to-Ruby-on-Mac-OS-X).
78
-
76
+ to Ruby on macOS](https://github.com/guard/guard/wiki/Add-Readline-support-to-Ruby-on-Mac-OS-X).
79
77
 
80
78
  ## Avoiding gem/dependency problems
81
79
 
@@ -86,10 +84,10 @@ If you're getting sick of typing `bundle exec` all the time, try one of the foll
86
84
  * (Recommended) Running `bundle binstub guard` will create `bin/guard` in your
87
85
  project, which means running `bin/guard` (tab completion will save you a key
88
86
  stroke or two) will have the exact same result as `bundle exec guard`.
89
-
87
+
90
88
  * Or, you can `alias be="bundle exec"` in your `.bashrc` or similar and the execute only `be guard`.
91
- **Protip**: It will work for all comands executed in `bundle exec` context!
92
-
89
+ **Protip**: It will work for all comands executed in `bundle exec` context!
90
+
93
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
@@ -132,8 +130,8 @@ Just launch Guard inside your Ruby or Rails project with:
132
130
  $ bundle exec guard
133
131
  ```
134
132
 
135
- Guard will look for a `Guardfile` in your current directory. If it does not find one, it will look in your `$HOME`
136
- 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`.
137
135
 
138
136
  Please look here to see all the [command line options for Guard](https://github.com/guard/guard/wiki/Command-line-options-for-Guard)
139
137
 
@@ -153,15 +151,32 @@ Before reporting a problem, please read how to [File an issue](https://github.co
153
151
  ## Development / Contributing
154
152
 
155
153
  See the [Contributing Guide](https://github.com/guard/guard/blob/master/CONTRIBUTING.md#development).
154
+
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
+
156
171
  ### Author
157
172
 
158
173
  [Thibaud Guillaume-Gentil](https://github.com/thibaudgg) ([@thibaudgg](https://twitter.com/thibaudgg))
159
174
 
160
175
  ### Core Team
161
176
 
162
- * R.I.P. :broken_heart: [Michael Kessler](https://github.com/netzpirat) ([flinkfinger.com](http://www.flinkfinger.com)).
177
+ * R.I.P. :broken_heart: [Michael Kessler](https://github.com/netzpirat).
163
178
  * [Rémy Coutable](https://github.com/rymai).
164
- * [Thibaud Guillaume-Gentil](https://github.com/thibaudgg) ([@thibaudgg](https://twitter.com/thibaudgg), [thibaud.gg](http://thibaud.gg/)).
179
+ * [Thibaud Guillaume-Gentil](https://github.com/thibaudgg) ([@thibaudgg](https://twitter.com/thibaudgg), [thibaud.gg](https://thibaud.gg/)).
165
180
 
166
181
  ### Contributors
167
182
 
@@ -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.stop
56
- interactor.background
56
+ listener&.stop
57
+ interactor&.background
57
58
  UI.debug "Guard stops all plugins"
58
59
  Runner.new.run(:stop)
59
60
  Notifier.disconnect
@@ -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 has been started
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] options the notification library options
72
+ # @param [Hash] opts the notification library options
72
73
  #
73
74
  # @see Guard::Notifier for available notifier and its options.
74
75
  #
@@ -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] scopes the scope for the groups and plugins
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
- @path, @contents = _read("Guardfile")
182
- @type = :default
183
- rescue Errno::ENOENT
184
- begin
185
- @path, @contents = _read("~/.Guardfile")
186
- @type = :default
187
- rescue Errno::ENOENT
188
- fail NoGuardfileError, ERROR_NO_GUARDFILE
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
@@ -95,6 +95,14 @@ module Guard
95
95
 
96
96
  attr_reader :thread
97
97
 
98
+ def _pry_config
99
+ Pry.config
100
+ end
101
+
102
+ def _pry_commands
103
+ Pry.commands
104
+ end
105
+
98
106
  def _switch_to_pry
99
107
  th = nil
100
108
  @mutex.synchronize do
@@ -125,11 +133,10 @@ module Guard
125
133
  end
126
134
 
127
135
  def _setup(options)
128
- Pry.config.should_load_rc = false
129
- Pry.config.should_load_local_rc = false
130
- history_file_path = options[:history_file] || HISTORY_FILE
131
- Pry.config.history.file = File.expand_path(history_file_path)
136
+ _pry_config.should_load_rc = false
137
+ _pry_config.should_load_local_rc = false
132
138
 
139
+ _configure_history_file(options[:history_file] || HISTORY_FILE)
133
140
  _add_hooks(options)
134
141
 
135
142
  Commands::All.import
@@ -144,6 +151,17 @@ module Guard
144
151
  _configure_prompt
145
152
  end
146
153
 
154
+ def _configure_history_file(history_file)
155
+ history_file_path = File.expand_path(history_file)
156
+
157
+ # Pry >= 0.13
158
+ if _pry_config.respond_to?(:history_file=)
159
+ _pry_config.history_file = history_file_path
160
+ else
161
+ _pry_config.history.file = history_file_path
162
+ end
163
+ end
164
+
147
165
  # Add Pry hooks:
148
166
  #
149
167
  # * Load `~/.guardrc` within each new Pry session.
@@ -159,7 +177,7 @@ module Guard
159
177
  # Add a `when_started` hook that loads a global .guardrc if it exists.
160
178
  #
161
179
  def _add_load_guard_rc_hook(guard_rc)
162
- Pry.config.hooks.add_hook :when_started, :load_guard_rc do
180
+ _pry_config.hooks.add_hook :when_started, :load_guard_rc do
163
181
  guard_rc.expand_path.tap { |p| load p if p.exist? }
164
182
  end
165
183
  end
@@ -167,7 +185,7 @@ module Guard
167
185
  # Add a `when_started` hook that loads a project .guardrc if it exists.
168
186
  #
169
187
  def _add_load_project_guard_rc_hook(guard_rc)
170
- Pry.config.hooks.add_hook :when_started, :load_project_guard_rc do
188
+ _pry_config.hooks.add_hook :when_started, :load_project_guard_rc do
171
189
  load guard_rc if guard_rc.exist?
172
190
  end
173
191
  end
@@ -175,7 +193,7 @@ module Guard
175
193
  # Add a `after_eval` hook that restores visibility after a command is
176
194
  # eval.
177
195
  def _add_restore_visibility_hook
178
- Pry.config.hooks.add_hook :after_eval, :restore_visibility do
196
+ _pry_config.hooks.add_hook :after_eval, :restore_visibility do
179
197
  @terminal_settings.echo
180
198
  end
181
199
  end
@@ -192,7 +210,7 @@ module Guard
192
210
  # instead restarts guard.
193
211
  #
194
212
  def _replace_reset_command
195
- Pry.commands.command "reset", "Reset the Guard to a clean state." do
213
+ _pry_commands.command "reset", "Reset the Guard to a clean state." do
196
214
  output.puts "Guard reset."
197
215
  exec "guard"
198
216
  end
@@ -203,7 +221,7 @@ module Guard
203
221
  # beginning of a line).
204
222
  #
205
223
  def _create_run_all_command
206
- Pry.commands.block_command(/^$/, "Hit enter to run all") do
224
+ _pry_commands.block_command(/^$/, "Hit enter to run all") do
207
225
  Pry.run_command "all"
208
226
  end
209
227
  end
@@ -214,7 +232,7 @@ module Guard
214
232
  #
215
233
  def _create_command_aliases
216
234
  SHORTCUTS.each do |command, shortcut|
217
- Pry.commands.alias_command shortcut, command.to_s
235
+ _pry_commands.alias_command shortcut, command.to_s
218
236
  end
219
237
  end
220
238
 
@@ -225,8 +243,8 @@ module Guard
225
243
  #
226
244
  def _create_guard_commands
227
245
  Guard.state.session.plugins.all.each do |guard_plugin|
228
- cmd = "Run all #{ guard_plugin.title }"
229
- Pry.commands.create_command guard_plugin.name, cmd do
246
+ cmd = "Run all #{guard_plugin.title}"
247
+ _pry_commands.create_command guard_plugin.name, cmd do
230
248
  group "Guard"
231
249
 
232
250
  def process
@@ -245,8 +263,8 @@ module Guard
245
263
  Guard.state.session.groups.all.each do |group|
246
264
  next if group.name == :default
247
265
 
248
- cmd = "Run all #{ group.title }"
249
- Pry.commands.create_command group.name.to_s, cmd do
266
+ cmd = "Run all #{group.title}"
267
+ _pry_commands.create_command group.name.to_s, cmd do
250
268
  group "Guard"
251
269
 
252
270
  def process
@@ -260,7 +278,15 @@ module Guard
260
278
  # `pry`.
261
279
  #
262
280
  def _configure_prompt
263
- Pry.config.prompt = [_prompt(">"), _prompt("*")]
281
+ prompt_procs = [_prompt(">"), _prompt("*")]
282
+ prompt =
283
+ if Pry::Prompt.is_a?(Class)
284
+ Pry::Prompt.new("Guard", "Guard Pry prompt", prompt_procs)
285
+ else
286
+ prompt_procs
287
+ end
288
+
289
+ _pry_config.prompt = prompt
264
290
  end
265
291
 
266
292
  # Returns the plugins scope, or the groups scope ready for display in the
@@ -289,12 +315,11 @@ module Guard
289
315
  end
290
316
 
291
317
  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
318
+ if pry.respond_to?(:input_ring)
319
+ pry.input_ring.size
320
+ else
321
+ pry.input_array.size
295
322
  end
296
-
297
- pry.input_ring.size
298
323
  end
299
324
  end
300
325
  end
@@ -16,7 +16,7 @@ module Guard
16
16
  end
17
17
 
18
18
  def self.disconnect
19
- @notifier.disconnect
19
+ @notifier && @notifier.disconnect
20
20
  @notifier = nil
21
21
  end
22
22
 
@@ -11,7 +11,7 @@ module Guard
11
11
  #
12
12
  # @param [Symbol] task the task to run
13
13
  #
14
- # @param [Hash] scopes either the Guard plugin or the group to run the task
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
@@ -1,3 +1,3 @@
1
1
  module Guard
2
- VERSION = "2.15.0"
2
+ VERSION = "2.16.2"
3
3
  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.15.0
4
+ version: 2.16.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: 2018-11-14 00:00:00.000000000 Z
11
+ date: 2020-03-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -234,8 +234,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
234
234
  - !ruby/object:Gem::Version
235
235
  version: '0'
236
236
  requirements: []
237
- rubyforge_project:
238
- rubygems_version: 2.7.6
237
+ rubygems_version: 3.0.3
239
238
  signing_key:
240
239
  specification_version: 4
241
240
  summary: Guard keeps an eye on your file modifications