pry 0.9.12pre2 → 0.9.12pre3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/pry/commands/show_info.rb +6 -0
- data/lib/pry/completion.rb +8 -2
- data/lib/pry/module_candidate.rb +3 -2
- data/lib/pry/pager.rb +1 -2
- data/lib/pry/plugins.rb +2 -0
- data/lib/pry/terminal.rb +7 -2
- data/lib/pry/version.rb +1 -1
- data/spec/Procfile +3 -0
- data/spec/commands/show_doc_spec.rb +230 -205
- data/spec/commands/show_source_spec.rb +111 -87
- data/spec/completion_spec.rb +6 -0
- metadata +4 -3
- data/.gemtest +0 -0
@@ -126,6 +126,12 @@ class Pry
|
|
126
126
|
h << "@ line #{line_num}:\n"
|
127
127
|
h << text.bold(code_object.module? ? "Module" : "Class")
|
128
128
|
h << " #{text.bold('name:')} #{code_object.nonblank_name}"
|
129
|
+
|
130
|
+
if code_object.number_of_candidates > 1
|
131
|
+
h << (text.bold("\nNumber of monkeypatches: ") + code_object.number_of_candidates.to_s)
|
132
|
+
h << ". Use the `-a` option to display all available monkeypatches"
|
133
|
+
end
|
134
|
+
h
|
129
135
|
end
|
130
136
|
|
131
137
|
def method_sections(code_object)
|
data/lib/pry/completion.rb
CHANGED
@@ -71,10 +71,16 @@ class Pry
|
|
71
71
|
# get new target for 1/2 and find candidates for 3
|
72
72
|
path, input = build_path(input)
|
73
73
|
|
74
|
-
#
|
74
|
+
# We silence warnings here or Ruby 1.8 cries about "multiple values for
|
75
|
+
# block 0 for 1".
|
75
76
|
Helpers::BaseHelpers.silence_warnings do
|
76
77
|
unless path.call.empty?
|
77
|
-
target
|
78
|
+
target = begin
|
79
|
+
ctx = Helpers::BaseHelpers.context_from_object_path(path.call, pry)
|
80
|
+
ctx.first
|
81
|
+
rescue Pry::CommandError
|
82
|
+
[]
|
83
|
+
end
|
78
84
|
target = target.last
|
79
85
|
end
|
80
86
|
end
|
data/lib/pry/module_candidate.rb
CHANGED
@@ -23,9 +23,10 @@ class Pry
|
|
23
23
|
# Methods to delegate to associated `Pry::WrappedModule
|
24
24
|
# instance`.
|
25
25
|
private_delegates = [:lines_for_file, :method_candidates,
|
26
|
-
:yard_docs
|
26
|
+
:yard_docs?]
|
27
27
|
|
28
|
-
public_delegates = [:wrapped, :module?, :class?, :name, :nonblank_name
|
28
|
+
public_delegates = [:wrapped, :module?, :class?, :name, :nonblank_name,
|
29
|
+
:number_of_candidates]
|
29
30
|
|
30
31
|
def_delegators :@wrapper, *(private_delegates + public_delegates)
|
31
32
|
private *private_delegates
|
data/lib/pry/pager.rb
CHANGED
data/lib/pry/plugins.rb
CHANGED
data/lib/pry/terminal.rb
CHANGED
@@ -13,15 +13,20 @@ class Pry::Terminal
|
|
13
13
|
end
|
14
14
|
|
15
15
|
# Return a screen size or a default if that fails.
|
16
|
-
def size! default = [
|
16
|
+
def size! default = [27, 80]
|
17
17
|
screen_size || default
|
18
18
|
end
|
19
19
|
|
20
20
|
# Return a screen width or the default if that fails.
|
21
|
-
def width!
|
21
|
+
def width!
|
22
22
|
size![1]
|
23
23
|
end
|
24
24
|
|
25
|
+
# Return a screen height or the default if that fails.
|
26
|
+
def height!
|
27
|
+
size![0]
|
28
|
+
end
|
29
|
+
|
25
30
|
def actual_screen_size
|
26
31
|
# The best way, if possible (requires non-jruby ≥1.9 or io-console gem)
|
27
32
|
screen_size_according_to_io_console or
|
data/lib/pry/version.rb
CHANGED
data/spec/Procfile
ADDED
@@ -200,286 +200,311 @@ if !PryTestHelpers.mri18_and_no_real_source_location?
|
|
200
200
|
def woof
|
201
201
|
end
|
202
202
|
end
|
203
|
-
|
204
|
-
|
205
|
-
|
203
|
+
RUBY
|
204
|
+
t.eval('show-doc TobinaMyDog').should =~ /hello tobina/
|
205
|
+
Object.remove_const :TobinaMyDog
|
206
|
+
end
|
206
207
|
end
|
207
208
|
end
|
208
|
-
end
|
209
209
|
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
210
|
+
it 'should lookup module name with respect to current context' do
|
211
|
+
constant_scope(:AlphaClass, :BetaClass) do
|
212
|
+
# top-level beta
|
213
|
+
class BetaClass
|
214
|
+
def alpha
|
215
|
+
end
|
215
216
|
end
|
216
|
-
end
|
217
217
|
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
218
|
+
class AlphaClass
|
219
|
+
# nested beta
|
220
|
+
class BetaClass
|
221
|
+
def beta
|
222
|
+
end
|
222
223
|
end
|
223
224
|
end
|
224
|
-
end
|
225
225
|
|
226
|
-
|
226
|
+
pry_eval(AlphaClass, "show-doc BetaClass").should =~ /nested beta/
|
227
|
+
end
|
227
228
|
end
|
228
|
-
end
|
229
229
|
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
230
|
+
it 'should look up nested modules' do
|
231
|
+
constant_scope(:AlphaClass) do
|
232
|
+
class AlphaClass
|
233
|
+
# nested beta
|
234
|
+
class BetaClass
|
235
|
+
def beta
|
236
|
+
end
|
236
237
|
end
|
237
238
|
end
|
238
|
-
end
|
239
239
|
|
240
|
-
|
241
|
-
|
240
|
+
pry_eval("show-doc AlphaClass::BetaClass").should =~
|
241
|
+
/nested beta/
|
242
|
+
end
|
242
243
|
end
|
243
|
-
end
|
244
244
|
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
245
|
+
describe "show-doc -a" do
|
246
|
+
it 'should show the docs for all monkeypatches defined in different files' do
|
247
|
+
# local monkeypatch
|
248
|
+
class TestClassForShowSource
|
249
|
+
def beta
|
250
|
+
end
|
250
251
|
end
|
251
|
-
end
|
252
252
|
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
end
|
253
|
+
result = pry_eval("show-doc TestClassForShowSource -a")
|
254
|
+
result.should =~ /used by/
|
255
|
+
result.should =~ /local monkeypatch/
|
256
|
+
end
|
258
257
|
|
259
|
-
|
260
|
-
|
261
|
-
|
258
|
+
describe "messages relating to -a" do
|
259
|
+
it 'indicates all available monkeypatches can be shown with -a when (when -a not used and more than one candidate exists for class)' do
|
260
|
+
class TestClassForShowSource
|
261
|
+
def beta
|
262
|
+
end
|
263
|
+
end
|
262
264
|
|
263
|
-
|
264
|
-
|
265
|
-
def d; end
|
266
|
-
def e; end
|
265
|
+
result = pry_eval('show-doc TestClassForShowSource')
|
266
|
+
result.should =~ /available monkeypatches/
|
267
267
|
end
|
268
|
-
end
|
269
|
-
end
|
270
268
|
|
271
|
-
|
272
|
-
|
273
|
-
|
269
|
+
it 'shouldnt say anything about monkeypatches when only one candidate exists for selected class' do
|
270
|
+
class Aarrrrrghh
|
271
|
+
def o;end
|
272
|
+
end
|
274
273
|
|
275
|
-
|
276
|
-
|
274
|
+
result = pry_eval('show-doc Aarrrrrghh')
|
275
|
+
result.should.not =~ /available monkeypatches/
|
276
|
+
Object.remove_const(:Aarrrrrghh)
|
277
|
+
end
|
278
|
+
end
|
277
279
|
end
|
278
|
-
end
|
279
280
|
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
before do
|
284
|
-
module TestHost
|
285
|
-
# hello
|
286
|
-
module M
|
287
|
-
binding.eval("def a; end", "dummy.rb", 1)
|
288
|
-
binding.eval("def b; end", "dummy.rb", 2)
|
289
|
-
binding.eval("def c; end", "dummy.rb", 3)
|
290
|
-
end
|
281
|
+
describe "when no class/module arg is given" do
|
282
|
+
before do
|
283
|
+
module TestHost
|
291
284
|
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
285
|
+
# hello there froggy
|
286
|
+
module M
|
287
|
+
def d; end
|
288
|
+
def e; end
|
289
|
+
end
|
296
290
|
end
|
297
291
|
end
|
298
|
-
end
|
299
292
|
|
300
|
-
|
301
|
-
|
302
|
-
|
293
|
+
after do
|
294
|
+
Object.remove_const(:TestHost)
|
295
|
+
end
|
303
296
|
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
result.should.not =~ /hello/
|
297
|
+
it 'should return doc for current module' do
|
298
|
+
pry_eval(TestHost::M, "show-doc").should =~ /hello there froggy/
|
299
|
+
end
|
308
300
|
end
|
309
|
-
end
|
310
|
-
end
|
311
301
|
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
end
|
302
|
+
# FIXME: THis is nto a good spec anyway, because i dont think it
|
303
|
+
# SHOULD skip!
|
304
|
+
describe "should skip over broken modules" do
|
305
|
+
before do
|
306
|
+
module TestHost
|
307
|
+
# hello
|
308
|
+
module M
|
309
|
+
binding.eval("def a; end", "dummy.rb", 1)
|
310
|
+
binding.eval("def b; end", "dummy.rb", 2)
|
311
|
+
binding.eval("def c; end", "dummy.rb", 3)
|
312
|
+
end
|
324
313
|
|
325
|
-
|
326
|
-
|
327
|
-
|
314
|
+
# goodbye
|
315
|
+
module M
|
316
|
+
def d; end
|
317
|
+
def e; end
|
318
|
+
end
|
319
|
+
end
|
320
|
+
end
|
328
321
|
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
end
|
322
|
+
after do
|
323
|
+
Object.remove_const(:TestHost)
|
324
|
+
end
|
333
325
|
|
334
|
-
|
335
|
-
|
336
|
-
|
326
|
+
it 'should return doc for first valid module' do
|
327
|
+
result = pry_eval("show-doc TestHost::M")
|
328
|
+
result.should =~ /goodbye/
|
329
|
+
result.should.not =~ /hello/
|
330
|
+
end
|
331
|
+
end
|
337
332
|
end
|
338
333
|
|
339
|
-
describe "
|
334
|
+
describe "on commands" do
|
335
|
+
# mostly copied & modified from test_help.rb
|
340
336
|
before do
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
description "nada."
|
345
|
-
def process
|
346
|
-
"lobster"
|
347
|
-
end
|
337
|
+
@oldset = Pry.config.commands
|
338
|
+
@set = Pry.config.commands = Pry::CommandSet.new do
|
339
|
+
import Pry::Commands
|
348
340
|
end
|
349
|
-
|
350
|
-
Pry.commands.add_command(LobsterLady)
|
351
341
|
end
|
352
342
|
|
353
343
|
after do
|
354
|
-
|
344
|
+
Pry.config.commands = @oldset
|
355
345
|
end
|
356
346
|
|
357
|
-
it 'should display
|
358
|
-
pry_eval('show-doc
|
359
|
-
Pry.commands.delete("lobster-lady")
|
347
|
+
it 'should display help for a specific command' do
|
348
|
+
pry_eval('show-doc ls').should =~ /Usage: ls/
|
360
349
|
end
|
361
350
|
|
362
|
-
it 'should display
|
363
|
-
|
364
|
-
|
351
|
+
it 'should display help for a regex command with a "listing"' do
|
352
|
+
@set.command /bar(.*)/, "Test listing", :listing => "foo" do; end
|
353
|
+
pry_eval('show-doc foo').should =~ /Test listing/
|
365
354
|
end
|
366
|
-
end
|
367
|
-
end
|
368
|
-
|
369
|
-
describe "should set _file_ and _dir_" do
|
370
|
-
it 'should set _file_ and _dir_ to file containing method source' do
|
371
|
-
t = pry_tester
|
372
|
-
t.process_command "show-doc TestClassForShowSource#alpha"
|
373
|
-
t.pry.last_file.should =~ /show_source_doc_examples/
|
374
|
-
t.pry.last_dir.should =~ /fixtures/
|
375
|
-
end
|
376
|
-
end
|
377
355
|
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
class Brian; end
|
356
|
+
it 'should display help for a command with a spaces in its name' do
|
357
|
+
@set.command "command with spaces", "description of a command with spaces" do; end
|
358
|
+
pry_eval('show-doc command with spaces').should =~ /description of a command with spaces/
|
359
|
+
end
|
383
360
|
|
384
|
-
|
385
|
-
|
386
|
-
|
361
|
+
describe "class commands" do
|
362
|
+
before do
|
363
|
+
# pretty pink pincers
|
364
|
+
class LobsterLady < Pry::ClassCommand
|
365
|
+
match "lobster-lady"
|
366
|
+
description "nada."
|
367
|
+
def process
|
368
|
+
"lobster"
|
369
|
+
end
|
387
370
|
end
|
388
371
|
|
389
|
-
|
390
|
-
class Bangle < Jangle; end
|
372
|
+
Pry.commands.add_command(LobsterLady)
|
391
373
|
end
|
392
|
-
end
|
393
374
|
|
394
|
-
|
395
|
-
|
396
|
-
|
375
|
+
after do
|
376
|
+
Object.remove_const(:LobsterLady)
|
377
|
+
end
|
397
378
|
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
end
|
379
|
+
it 'should display "help" when looking up by command name' do
|
380
|
+
pry_eval('show-doc lobster-lady').should =~ /nada/
|
381
|
+
Pry.commands.delete("lobster-lady")
|
382
|
+
end
|
403
383
|
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
384
|
+
it 'should display actual preceding comment for a class command, when class is used (rather than command name) when looking up' do
|
385
|
+
pry_eval('show-doc LobsterLady').should =~ /pretty pink pincers/
|
386
|
+
Pry.commands.delete("lobster-lady")
|
387
|
+
end
|
408
388
|
end
|
389
|
+
end
|
409
390
|
|
410
|
-
|
391
|
+
describe "should set _file_ and _dir_" do
|
392
|
+
it 'should set _file_ and _dir_ to file containing method source' do
|
411
393
|
t = pry_tester
|
412
|
-
t.process_command "show-doc
|
413
|
-
t.
|
394
|
+
t.process_command "show-doc TestClassForShowSource#alpha"
|
395
|
+
t.pry.last_file.should =~ /show_source_doc_examples/
|
396
|
+
t.pry.last_dir.should =~ /fixtures/
|
414
397
|
end
|
398
|
+
end
|
415
399
|
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
400
|
+
unless Pry::Helpers::BaseHelpers.rbx?
|
401
|
+
describe "can't find class docs" do
|
402
|
+
describe "for classes" do
|
403
|
+
before do
|
404
|
+
module Jesus
|
405
|
+
class Brian; end
|
421
406
|
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
407
|
+
# doink-doc
|
408
|
+
class Jingle
|
409
|
+
def a; :doink; end
|
410
|
+
end
|
411
|
+
|
412
|
+
class Jangle < Jingle; end
|
413
|
+
class Bangle < Jangle; end
|
414
|
+
end
|
415
|
+
end
|
416
|
+
|
417
|
+
after do
|
418
|
+
Object.remove_const(:Jesus)
|
419
|
+
end
|
420
|
+
|
421
|
+
it 'shows superclass doc' do
|
422
|
+
t = pry_tester
|
423
|
+
t.process_command "show-doc Jesus::Jangle"
|
424
|
+
t.last_output.should =~ /doink-doc/
|
425
|
+
end
|
431
426
|
|
432
|
-
|
433
|
-
|
434
|
-
|
427
|
+
it 'errors when class has no superclass to show' do
|
428
|
+
t = pry_tester
|
429
|
+
lambda { t.process_command "show-doc Jesus::Brian" }.should.raise(Pry::CommandError).message.
|
430
|
+
should =~ /Couldn't locate/
|
435
431
|
end
|
436
432
|
|
437
|
-
|
433
|
+
it 'shows warning when reverting to superclass docs' do
|
434
|
+
t = pry_tester
|
435
|
+
t.process_command "show-doc Jesus::Jangle"
|
436
|
+
t.last_output.should =~ /Warning.*?Cannot find.*?Jesus::Jangle.*Showing.*Jesus::Jingle instead/
|
437
|
+
end
|
438
438
|
|
439
|
-
|
440
|
-
|
439
|
+
it 'shows nth level superclass docs (when no intermediary superclasses have code either)' do
|
440
|
+
t = pry_tester
|
441
|
+
t.process_command "show-doc Jesus::Bangle"
|
442
|
+
t.last_output.should =~ /doink-doc/
|
441
443
|
end
|
442
444
|
|
443
|
-
|
444
|
-
|
445
|
+
it 'shows correct warning when reverting to nth level superclass' do
|
446
|
+
t = pry_tester
|
447
|
+
t.process_command "show-doc Jesus::Bangle"
|
448
|
+
t.last_output.should =~ /Warning.*?Cannot find.*?Jesus::Bangle.*Showing.*Jesus::Jingle instead/
|
445
449
|
end
|
446
450
|
end
|
447
|
-
end
|
448
451
|
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
+
describe "for modules" do
|
453
|
+
before do
|
454
|
+
module Jesus
|
452
455
|
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
end
|
456
|
+
# alpha-doc
|
457
|
+
module Alpha
|
458
|
+
def alpha; :alpha; end
|
459
|
+
end
|
458
460
|
|
459
|
-
|
460
|
-
t = pry_tester
|
461
|
-
t.process_command "show-doc Jesus::Beta"
|
462
|
-
t.last_output.should =~ /Warning.*?Cannot find.*?Jesus::Beta.*Showing.*Jesus::Alpha instead/
|
463
|
-
end
|
461
|
+
module Zeta; end
|
464
462
|
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
should =~ /Couldn't locate/
|
469
|
-
end
|
463
|
+
module Beta
|
464
|
+
include Alpha
|
465
|
+
end
|
470
466
|
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
467
|
+
module Gamma
|
468
|
+
include Beta
|
469
|
+
end
|
470
|
+
end
|
471
|
+
end
|
476
472
|
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
473
|
+
after do
|
474
|
+
Object.remove_const(:Jesus)
|
475
|
+
end
|
476
|
+
|
477
|
+
it 'shows included module doc' do
|
478
|
+
t = pry_tester
|
479
|
+
t.process_command "show-doc Jesus::Beta"
|
480
|
+
t.last_output.should =~ /alpha-doc/
|
481
|
+
end
|
482
|
+
|
483
|
+
it 'shows warning when reverting to included module doc' do
|
484
|
+
t = pry_tester
|
485
|
+
t.process_command "show-doc Jesus::Beta"
|
486
|
+
t.last_output.should =~ /Warning.*?Cannot find.*?Jesus::Beta.*Showing.*Jesus::Alpha instead/
|
487
|
+
end
|
488
|
+
|
489
|
+
it 'errors when module has no included module to show' do
|
490
|
+
t = pry_tester
|
491
|
+
lambda { t.process_command "show-source Jesus::Zeta" }.should.raise(Pry::CommandError).message.
|
492
|
+
should =~ /Couldn't locate/
|
493
|
+
end
|
494
|
+
|
495
|
+
it 'shows nth level included module doc (when no intermediary modules have code either)' do
|
496
|
+
t = pry_tester
|
497
|
+
t.process_command "show-doc Jesus::Gamma"
|
498
|
+
t.last_output.should =~ /alpha-doc/
|
499
|
+
end
|
500
|
+
|
501
|
+
it 'shows correct warning when reverting to nth level included module' do
|
502
|
+
t = pry_tester
|
503
|
+
t.process_command "show-source Jesus::Gamma"
|
504
|
+
t.last_output.should =~ /Warning.*?Cannot find.*?Jesus::Gamma.*Showing.*Jesus::Alpha instead/
|
505
|
+
end
|
506
|
+
end
|
481
507
|
end
|
482
508
|
end
|
483
509
|
end
|
484
510
|
end
|
485
|
-
end
|
@@ -453,6 +453,28 @@ if !PryTestHelpers.mri18_and_no_real_source_location?
|
|
453
453
|
result = pry_eval('show-source TestClassForShowSourceInstanceEval -a')
|
454
454
|
result.should =~ /def instance_eval_method/
|
455
455
|
end
|
456
|
+
|
457
|
+
describe "messages relating to -a" do
|
458
|
+
it 'indicates all available monkeypatches can be shown with -a when (when -a not used and more than one candidate exists for class)' do
|
459
|
+
class TestClassForShowSource
|
460
|
+
def beta
|
461
|
+
end
|
462
|
+
end
|
463
|
+
|
464
|
+
result = pry_eval('show-source TestClassForShowSource')
|
465
|
+
result.should =~ /available monkeypatches/
|
466
|
+
end
|
467
|
+
|
468
|
+
it 'shouldnt say anything about monkeypatches when only one candidate exists for selected class' do
|
469
|
+
class Aarrrrrghh
|
470
|
+
def o;end
|
471
|
+
end
|
472
|
+
|
473
|
+
result = pry_eval('show-source Aarrrrrghh')
|
474
|
+
result.should.not =~ /available monkeypatches/
|
475
|
+
Object.remove_const(:Aarrrrrghh)
|
476
|
+
end
|
477
|
+
end
|
456
478
|
end
|
457
479
|
|
458
480
|
describe "when show-source is invoked without a method or class argument" do
|
@@ -641,116 +663,118 @@ if !PryTestHelpers.mri18_and_no_real_source_location?
|
|
641
663
|
end
|
642
664
|
end
|
643
665
|
|
644
|
-
|
645
|
-
describe "
|
646
|
-
|
647
|
-
|
648
|
-
module
|
649
|
-
|
650
|
-
|
666
|
+
unless Pry::Helpers::BaseHelpers.rbx?
|
667
|
+
describe "can't find class/module code" do
|
668
|
+
describe "for classes" do
|
669
|
+
before do
|
670
|
+
module Jesus
|
671
|
+
module Pig
|
672
|
+
def lillybing; :lillybing; end
|
673
|
+
end
|
651
674
|
|
652
|
-
|
653
|
-
|
654
|
-
|
655
|
-
|
675
|
+
class Brian; end
|
676
|
+
class Jingle
|
677
|
+
def a; :doink; end
|
678
|
+
end
|
656
679
|
|
657
|
-
|
658
|
-
|
680
|
+
class Jangle < Jingle; include Pig; end
|
681
|
+
class Bangle < Jangle; end
|
682
|
+
end
|
659
683
|
end
|
660
|
-
end
|
661
684
|
|
662
|
-
|
663
|
-
|
664
|
-
|
685
|
+
after do
|
686
|
+
Object.remove_const(:Jesus)
|
687
|
+
end
|
665
688
|
|
666
|
-
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
|
689
|
+
it 'shows superclass code' do
|
690
|
+
t = pry_tester
|
691
|
+
t.process_command "show-source Jesus::Jangle"
|
692
|
+
t.last_output.should =~ /doink/
|
693
|
+
end
|
671
694
|
|
672
|
-
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
|
695
|
+
it 'ignores included modules' do
|
696
|
+
t = pry_tester
|
697
|
+
t.process_command "show-source Jesus::Jangle"
|
698
|
+
t.last_output.should.not =~ /lillybing/
|
699
|
+
end
|
677
700
|
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
|
701
|
+
it 'errors when class has no superclass to show' do
|
702
|
+
t = pry_tester
|
703
|
+
lambda { t.process_command "show-source Jesus::Brian" }.should.raise(Pry::CommandError).message.
|
704
|
+
should =~ /Couldn't locate/
|
705
|
+
end
|
683
706
|
|
684
|
-
|
685
|
-
|
686
|
-
|
687
|
-
|
688
|
-
|
707
|
+
it 'shows warning when reverting to superclass code' do
|
708
|
+
t = pry_tester
|
709
|
+
t.process_command "show-source Jesus::Jangle"
|
710
|
+
t.last_output.should =~ /Warning.*?Cannot find.*?Jesus::Jangle.*Showing.*Jesus::Jingle instead/
|
711
|
+
end
|
689
712
|
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
|
713
|
+
it 'shows nth level superclass code (when no intermediary superclasses have code either)' do
|
714
|
+
t = pry_tester
|
715
|
+
t.process_command "show-source Jesus::Bangle"
|
716
|
+
t.last_output.should =~ /doink/
|
717
|
+
end
|
695
718
|
|
696
|
-
|
697
|
-
|
698
|
-
|
699
|
-
|
719
|
+
it 'shows correct warning when reverting to nth level superclass' do
|
720
|
+
t = pry_tester
|
721
|
+
t.process_command "show-source Jesus::Bangle"
|
722
|
+
t.last_output.should =~ /Warning.*?Cannot find.*?Jesus::Bangle.*Showing.*Jesus::Jingle instead/
|
723
|
+
end
|
700
724
|
end
|
701
|
-
end
|
702
725
|
|
703
|
-
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
|
726
|
+
describe "for modules" do
|
727
|
+
before do
|
728
|
+
module Jesus
|
729
|
+
module Alpha
|
730
|
+
def alpha; :alpha; end
|
731
|
+
end
|
709
732
|
|
710
|
-
|
733
|
+
module Zeta; end
|
711
734
|
|
712
|
-
|
713
|
-
|
714
|
-
|
735
|
+
module Beta
|
736
|
+
include Alpha
|
737
|
+
end
|
715
738
|
|
716
|
-
|
717
|
-
|
739
|
+
module Gamma
|
740
|
+
include Beta
|
741
|
+
end
|
718
742
|
end
|
719
743
|
end
|
720
|
-
end
|
721
744
|
|
722
|
-
|
723
|
-
|
724
|
-
|
745
|
+
after do
|
746
|
+
Object.remove_const(:Jesus)
|
747
|
+
end
|
725
748
|
|
726
|
-
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
|
749
|
+
it 'shows included module code' do
|
750
|
+
t = pry_tester
|
751
|
+
t.process_command "show-source Jesus::Beta"
|
752
|
+
t.last_output.should =~ /alpha/
|
753
|
+
end
|
731
754
|
|
732
|
-
|
733
|
-
|
734
|
-
|
735
|
-
|
736
|
-
|
755
|
+
it 'shows warning when reverting to included module code' do
|
756
|
+
t = pry_tester
|
757
|
+
t.process_command "show-source Jesus::Beta"
|
758
|
+
t.last_output.should =~ /Warning.*?Cannot find.*?Jesus::Beta.*Showing.*Jesus::Alpha instead/
|
759
|
+
end
|
737
760
|
|
738
|
-
|
739
|
-
|
740
|
-
|
741
|
-
|
742
|
-
|
761
|
+
it 'errors when module has no included module to show' do
|
762
|
+
t = pry_tester
|
763
|
+
lambda { t.process_command "show-source Jesus::Zeta" }.should.raise(Pry::CommandError).message.
|
764
|
+
should =~ /Couldn't locate/
|
765
|
+
end
|
743
766
|
|
744
|
-
|
745
|
-
|
746
|
-
|
747
|
-
|
748
|
-
|
767
|
+
it 'shows nth level included module code (when no intermediary modules have code either)' do
|
768
|
+
t = pry_tester
|
769
|
+
t.process_command "show-source Jesus::Gamma"
|
770
|
+
t.last_output.should =~ /alpha/
|
771
|
+
end
|
749
772
|
|
750
|
-
|
751
|
-
|
752
|
-
|
753
|
-
|
773
|
+
it 'shows correct warning when reverting to nth level included module' do
|
774
|
+
t = pry_tester
|
775
|
+
t.process_command "show-source Jesus::Gamma"
|
776
|
+
t.last_output.should =~ /Warning.*?Cannot find.*?Jesus::Gamma.*Showing.*Jesus::Alpha instead/
|
777
|
+
end
|
754
778
|
end
|
755
779
|
end
|
756
780
|
end
|
data/spec/completion_spec.rb
CHANGED
@@ -230,4 +230,10 @@ describe Pry::InputCompleter do
|
|
230
230
|
pry = Pry.new
|
231
231
|
new_completer(binding, pry).call("pry.").should.not.include nil
|
232
232
|
end
|
233
|
+
|
234
|
+
it "does not raise when complete file paths" do
|
235
|
+
should.not.raise(Pry::CommandError) {
|
236
|
+
new_completer(binding, Pry.new).call("cat lib/p")
|
237
|
+
}
|
238
|
+
end
|
233
239
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pry
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.12pre3
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2013-02-
|
14
|
+
date: 2013-02-10 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: coderay
|
@@ -168,7 +168,6 @@ extensions: []
|
|
168
168
|
extra_rdoc_files: []
|
169
169
|
files:
|
170
170
|
- .document
|
171
|
-
- .gemtest
|
172
171
|
- .gitignore
|
173
172
|
- .travis.yml
|
174
173
|
- .yardopts
|
@@ -280,6 +279,7 @@ files:
|
|
280
279
|
- man/pry.1.html
|
281
280
|
- man/pry.1.ronn
|
282
281
|
- pry.gemspec
|
282
|
+
- spec/Procfile
|
283
283
|
- spec/cli_spec.rb
|
284
284
|
- spec/code_object_spec.rb
|
285
285
|
- spec/code_spec.rb
|
@@ -368,6 +368,7 @@ signing_key:
|
|
368
368
|
specification_version: 3
|
369
369
|
summary: An IRB alternative and runtime developer console
|
370
370
|
test_files:
|
371
|
+
- spec/Procfile
|
371
372
|
- spec/cli_spec.rb
|
372
373
|
- spec/code_object_spec.rb
|
373
374
|
- spec/code_spec.rb
|
data/.gemtest
DELETED
File without changes
|