guard 2.16.1 → 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 +4 -4
- data/lib/guard/jobs/pry_wrapper.rb +45 -20
- data/lib/guard/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 787baab35992b3608d89a5d4a064d300a9a636ef9432510126347989fc1568b9
|
4
|
+
data.tar.gz: 7fda9a3ecd35de97a472292a7021b53644e473333588985cd40435e9a048662f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f94c5f80ed6f67bb9ff71e058406101ac52aca3661b00e1b82981abef890e4d15dcae871d41e883299614d1eece60b322c1265c9f007573375771bc0049353f3
|
7
|
+
data.tar.gz: e3748fdf116614e2063091a86728d37ee85ee871a50cbd64628c8c5189756d91e4fd0018e1966d3ef72e6ffbcad99043e19e901459eb5bd3631b564d6c73d47c
|
@@ -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
|
-
|
129
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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 #{
|
229
|
-
|
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 #{
|
249
|
-
|
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
|
-
|
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
|
-
|
293
|
-
|
294
|
-
|
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
|
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.16.
|
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:
|
11
|
+
date: 2020-03-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|