guard 2.16.1 → 2.16.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c51ad2df488dd4e7fd675358a3277ab105ec798dccffb6e62c9c713ef32fb4aa
4
- data.tar.gz: 2d14c133e937b466588d3d6c78892aa8557db8aa8d0649438a90a0156e035ce3
3
+ metadata.gz: 787baab35992b3608d89a5d4a064d300a9a636ef9432510126347989fc1568b9
4
+ data.tar.gz: 7fda9a3ecd35de97a472292a7021b53644e473333588985cd40435e9a048662f
5
5
  SHA512:
6
- metadata.gz: 95881ca9d802a118f575360826d647629d840d902f83599f4225fd683a0d744c00f394ab5a6d60fd39e05723395946897d7921dc4f6e8b81f4a6a1ffa5f1214d
7
- data.tar.gz: 55fe2797a631e8d521094bf2bdf5d65a04b897ff75768e2e250438ccccabc3890df269ad585dcd369dde091067eaff7603e4f483a886b12857e55ad4c6b4fe3f
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
- 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
@@ -1,3 +1,3 @@
1
1
  module Guard
2
- VERSION = "2.16.1"
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.16.1
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: 2019-11-01 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