guard 2.16.0 → 2.18.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +23 -2
- data/lib/guard/commander.rb +2 -2
- data/lib/guard/jobs/pry_wrapper.rb +57 -22
- data/lib/guard/plugin_util.rb +1 -1
- data/lib/guard/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9bc4f16fcb5313bd7482ee1968c9292198956a24f44d0a20622313ef50ea840f
|
4
|
+
data.tar.gz: 86448d1f2f36026d02dab3da8d0ba6ed1a9fcc0219708ed2f61e1e9a857e60bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ad2f478c89e07aca1e113acffc7efcf556818962186b0b853353eb1e32470e821d43b3d5aab7c3313c5028ce717b05a78c5e394db67a60d0f7251c3e56ca19a
|
7
|
+
data.tar.gz: 7f2565eded7d35d4b143c164600c3e8f606f15cf307890455cdadd5dd980820faa3967f4fb30e620fbce85f92ce7c1dbe4163460eb77074f5a5137c21325ec01
|
data/README.md
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
# Guard
|
2
2
|
|
3
|
-
**IMPORTANT:
|
3
|
+
**IMPORTANT: Please upgrade to Ruby >= 2.4 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
|
+
|
5
|
+
- [Ruby 2.1 is officially outdated and unsupported!](https://www.ruby-lang.org/en/news/2016/03/30/ruby-2-1-9-released/)
|
6
|
+
- [Ruby 2.2 is officially outdated and unsupported!](https://www.ruby-lang.org/en/news/2018/06/20/support-of-ruby-2-2-has-ended/)
|
7
|
+
- [Ruby 2.3 is officially outdated and unsupported!](https://www.ruby-lang.org/en/news/2019/03/31/support-of-ruby-2-3-has-ended/)
|
4
8
|
|
5
9
|
: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
10
|
|
@@ -32,7 +36,7 @@ Before you file an issue, make sure you have read the _[known issues](#issues)_
|
|
32
36
|
* File system changes handled by our awesome [Listen](https://github.com/guard/listen) gem.
|
33
37
|
* Support for visual system notifications.
|
34
38
|
* Huge eco-system with [more than 300](https://rubygems.org/search?query=guard-) Guard plugins.
|
35
|
-
* Tested against the latest Ruby 2.
|
39
|
+
* Tested against the latest Ruby 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
40
|
|
37
41
|
## Screencast
|
38
42
|
|
@@ -151,6 +155,23 @@ Before reporting a problem, please read how to [File an issue](https://github.co
|
|
151
155
|
## Development / Contributing
|
152
156
|
|
153
157
|
See the [Contributing Guide](https://github.com/guard/guard/blob/master/CONTRIBUTING.md#development).
|
158
|
+
|
159
|
+
## Releasing
|
160
|
+
|
161
|
+
### Prerequisites
|
162
|
+
|
163
|
+
* You must have commit rights to the GitHub repository.
|
164
|
+
* You must have push rights for rubygems.org.
|
165
|
+
|
166
|
+
### How to release
|
167
|
+
|
168
|
+
1. Determine which would be the correct next version number according to [semver](http://semver.org/).
|
169
|
+
1. Update the version in `./lib/guard/version.rb`.
|
170
|
+
1. Commit the version in a single commit, the message should be "Bump VERSION to X.Y.Z".
|
171
|
+
1. Push and open a pull request.
|
172
|
+
1. Once CI is green, merge the pull request.
|
173
|
+
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) .
|
174
|
+
|
154
175
|
### Author
|
155
176
|
|
156
177
|
[Thibaud Guillaume-Gentil](https://github.com/thibaudgg) ([@thibaudgg](https://twitter.com/thibaudgg))
|
data/lib/guard/commander.rb
CHANGED
@@ -40,11 +40,21 @@ module Guard
|
|
40
40
|
class PryWrapper < Base
|
41
41
|
# The default Ruby script to configure Guard Pry if the option `:guard_rc`
|
42
42
|
# is not defined.
|
43
|
-
|
43
|
+
|
44
|
+
GUARD_RC = if ENV["XDG_CONFIG_HOME"] && File.exist?(ENV["XDG_CONFIG_HOME"] + "/guard/guardrc")
|
45
|
+
ENV["XDG_CONFIG_HOME"] + "/guard/guardrc"
|
46
|
+
else
|
47
|
+
"~/.guardrc"
|
48
|
+
end
|
44
49
|
|
45
50
|
# The default Guard Pry history file if the option `:history_file` is not
|
46
51
|
# defined.
|
47
|
-
|
52
|
+
|
53
|
+
HISTORY_FILE = if ENV["XDG_DATA_HOME"] && File.exist?(ENV["XDG_DATA_HOME"] + "/guard/history")
|
54
|
+
ENV["XDG_DATA_HOME"] + "/guard/history"
|
55
|
+
else
|
56
|
+
"~/.guard_history"
|
57
|
+
end
|
48
58
|
|
49
59
|
# List of shortcuts for each interactor command
|
50
60
|
SHORTCUTS = {
|
@@ -95,6 +105,14 @@ module Guard
|
|
95
105
|
|
96
106
|
attr_reader :thread
|
97
107
|
|
108
|
+
def _pry_config
|
109
|
+
Pry.config
|
110
|
+
end
|
111
|
+
|
112
|
+
def _pry_commands
|
113
|
+
Pry.commands
|
114
|
+
end
|
115
|
+
|
98
116
|
def _switch_to_pry
|
99
117
|
th = nil
|
100
118
|
@mutex.synchronize do
|
@@ -125,11 +143,10 @@ module Guard
|
|
125
143
|
end
|
126
144
|
|
127
145
|
def _setup(options)
|
128
|
-
|
129
|
-
|
130
|
-
history_file_path = options[:history_file] || HISTORY_FILE
|
131
|
-
Pry.config.history.file = File.expand_path(history_file_path)
|
146
|
+
_pry_config.should_load_rc = false
|
147
|
+
_pry_config.should_load_local_rc = false
|
132
148
|
|
149
|
+
_configure_history_file(options[:history_file] || HISTORY_FILE)
|
133
150
|
_add_hooks(options)
|
134
151
|
|
135
152
|
Commands::All.import
|
@@ -144,6 +161,17 @@ module Guard
|
|
144
161
|
_configure_prompt
|
145
162
|
end
|
146
163
|
|
164
|
+
def _configure_history_file(history_file)
|
165
|
+
history_file_path = File.expand_path(history_file)
|
166
|
+
|
167
|
+
# Pry >= 0.13
|
168
|
+
if _pry_config.respond_to?(:history_file=)
|
169
|
+
_pry_config.history_file = history_file_path
|
170
|
+
else
|
171
|
+
_pry_config.history.file = history_file_path
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
147
175
|
# Add Pry hooks:
|
148
176
|
#
|
149
177
|
# * Load `~/.guardrc` within each new Pry session.
|
@@ -159,7 +187,7 @@ module Guard
|
|
159
187
|
# Add a `when_started` hook that loads a global .guardrc if it exists.
|
160
188
|
#
|
161
189
|
def _add_load_guard_rc_hook(guard_rc)
|
162
|
-
|
190
|
+
_pry_config.hooks.add_hook :when_started, :load_guard_rc do
|
163
191
|
guard_rc.expand_path.tap { |p| load p if p.exist? }
|
164
192
|
end
|
165
193
|
end
|
@@ -167,7 +195,7 @@ module Guard
|
|
167
195
|
# Add a `when_started` hook that loads a project .guardrc if it exists.
|
168
196
|
#
|
169
197
|
def _add_load_project_guard_rc_hook(guard_rc)
|
170
|
-
|
198
|
+
_pry_config.hooks.add_hook :when_started, :load_project_guard_rc do
|
171
199
|
load guard_rc if guard_rc.exist?
|
172
200
|
end
|
173
201
|
end
|
@@ -175,7 +203,7 @@ module Guard
|
|
175
203
|
# Add a `after_eval` hook that restores visibility after a command is
|
176
204
|
# eval.
|
177
205
|
def _add_restore_visibility_hook
|
178
|
-
|
206
|
+
_pry_config.hooks.add_hook :after_eval, :restore_visibility do
|
179
207
|
@terminal_settings.echo
|
180
208
|
end
|
181
209
|
end
|
@@ -192,7 +220,7 @@ module Guard
|
|
192
220
|
# instead restarts guard.
|
193
221
|
#
|
194
222
|
def _replace_reset_command
|
195
|
-
|
223
|
+
_pry_commands.command "reset", "Reset the Guard to a clean state." do
|
196
224
|
output.puts "Guard reset."
|
197
225
|
exec "guard"
|
198
226
|
end
|
@@ -203,7 +231,7 @@ module Guard
|
|
203
231
|
# beginning of a line).
|
204
232
|
#
|
205
233
|
def _create_run_all_command
|
206
|
-
|
234
|
+
_pry_commands.block_command(/^$/, "Hit enter to run all") do
|
207
235
|
Pry.run_command "all"
|
208
236
|
end
|
209
237
|
end
|
@@ -214,7 +242,7 @@ module Guard
|
|
214
242
|
#
|
215
243
|
def _create_command_aliases
|
216
244
|
SHORTCUTS.each do |command, shortcut|
|
217
|
-
|
245
|
+
_pry_commands.alias_command shortcut, command.to_s
|
218
246
|
end
|
219
247
|
end
|
220
248
|
|
@@ -225,8 +253,8 @@ module Guard
|
|
225
253
|
#
|
226
254
|
def _create_guard_commands
|
227
255
|
Guard.state.session.plugins.all.each do |guard_plugin|
|
228
|
-
cmd = "Run all #{
|
229
|
-
|
256
|
+
cmd = "Run all #{guard_plugin.title}"
|
257
|
+
_pry_commands.create_command guard_plugin.name, cmd do
|
230
258
|
group "Guard"
|
231
259
|
|
232
260
|
def process
|
@@ -245,8 +273,8 @@ module Guard
|
|
245
273
|
Guard.state.session.groups.all.each do |group|
|
246
274
|
next if group.name == :default
|
247
275
|
|
248
|
-
cmd = "Run all #{
|
249
|
-
|
276
|
+
cmd = "Run all #{group.title}"
|
277
|
+
_pry_commands.create_command group.name.to_s, cmd do
|
250
278
|
group "Guard"
|
251
279
|
|
252
280
|
def process
|
@@ -260,7 +288,15 @@ module Guard
|
|
260
288
|
# `pry`.
|
261
289
|
#
|
262
290
|
def _configure_prompt
|
263
|
-
|
291
|
+
prompt_procs = [_prompt(">"), _prompt("*")]
|
292
|
+
prompt =
|
293
|
+
if Pry::Prompt.is_a?(Class)
|
294
|
+
Pry::Prompt.new("Guard", "Guard Pry prompt", prompt_procs)
|
295
|
+
else
|
296
|
+
prompt_procs
|
297
|
+
end
|
298
|
+
|
299
|
+
_pry_config.prompt = prompt
|
264
300
|
end
|
265
301
|
|
266
302
|
# Returns the plugins scope, or the groups scope ready for display in the
|
@@ -289,12 +325,11 @@ module Guard
|
|
289
325
|
end
|
290
326
|
|
291
327
|
def _history(pry)
|
292
|
-
|
293
|
-
|
294
|
-
|
328
|
+
if pry.respond_to?(:input_ring)
|
329
|
+
pry.input_ring.size
|
330
|
+
else
|
331
|
+
pry.input_array.size
|
295
332
|
end
|
296
|
-
|
297
|
-
pry.input_ring.size
|
298
333
|
end
|
299
334
|
end
|
300
335
|
end
|
data/lib/guard/plugin_util.rb
CHANGED
data/lib/guard/version.rb
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.
|
4
|
+
version: 2.18.0
|
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: 2021-07-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -50,14 +50,14 @@ dependencies:
|
|
50
50
|
requirements:
|
51
51
|
- - ">="
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: 0.
|
53
|
+
version: 0.13.0
|
54
54
|
type: :runtime
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
58
|
- - ">="
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version: 0.
|
60
|
+
version: 0.13.0
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
62
|
name: lumberjack
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
@@ -234,7 +234,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
234
234
|
- !ruby/object:Gem::Version
|
235
235
|
version: '0'
|
236
236
|
requirements: []
|
237
|
-
rubygems_version: 3.
|
237
|
+
rubygems_version: 3.1.4
|
238
238
|
signing_key:
|
239
239
|
specification_version: 4
|
240
240
|
summary: Guard keeps an eye on your file modifications
|