pry 0.9.11.4-java → 0.9.12-java
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +2 -0
- data/CHANGELOG +19 -0
- data/Rakefile +4 -0
- data/lib/pry.rb +1 -1
- data/lib/pry/cli.rb +14 -8
- data/lib/pry/code.rb +3 -3
- data/lib/pry/command.rb +20 -5
- data/lib/pry/command_set.rb +3 -3
- data/lib/pry/commands.rb +1 -1
- data/lib/pry/commands/disabled_commands.rb +2 -0
- data/lib/pry/commands/ls.rb +1 -2
- data/lib/pry/commands/reload_code.rb +8 -1
- data/lib/pry/commands/show_info.rb +66 -5
- data/lib/pry/commands/show_source.rb +2 -1
- data/lib/pry/commands/whereami.rb +87 -19
- data/lib/pry/completion.rb +13 -4
- data/lib/pry/helpers/base_helpers.rb +5 -2
- data/lib/pry/helpers/command_helpers.rb +3 -1
- data/lib/pry/helpers/documentation_helpers.rb +18 -7
- data/lib/pry/helpers/table.rb +4 -4
- data/lib/pry/indent.rb +2 -7
- data/lib/pry/method.rb +89 -129
- data/lib/pry/method/disowned.rb +53 -0
- data/lib/pry/method/weird_method_locator.rb +186 -0
- data/lib/pry/module_candidate.rb +13 -8
- data/lib/pry/pager.rb +12 -11
- data/lib/pry/plugins.rb +2 -0
- data/lib/pry/pry_class.rb +19 -3
- data/lib/pry/pry_instance.rb +3 -0
- data/lib/pry/terminal.rb +78 -0
- data/lib/pry/version.rb +1 -1
- data/lib/pry/wrapped_module.rb +63 -1
- data/spec/Procfile +3 -0
- data/spec/command_helpers_spec.rb +21 -1
- data/spec/commands/ls_spec.rb +4 -0
- data/spec/commands/show_doc_spec.rb +255 -123
- data/spec/commands/show_source_spec.rb +421 -236
- data/spec/commands/whereami_spec.rb +60 -11
- data/spec/completion_spec.rb +6 -0
- data/spec/documentation_helper_spec.rb +73 -0
- data/spec/fixtures/whereami_helper.rb +6 -0
- data/spec/helpers/table_spec.rb +19 -0
- data/spec/method_spec.rb +24 -7
- metadata +12 -5
- data/.gemtest +0 -0
- data/lib/pry/commands/deprecated_commands.rb +0 -2
- data/lib/pry/terminal_info.rb +0 -48
@@ -63,7 +63,6 @@ describe "whereami" do
|
|
63
63
|
end
|
64
64
|
|
65
65
|
Cor.instance_method(:blimey!).source.should =~ /pry_eval/
|
66
|
-
|
67
66
|
Cor.new.blimey!.should =~ /Cor#blimey!.*Look at me/m
|
68
67
|
Object.remove_const(:Cor)
|
69
68
|
end
|
@@ -85,26 +84,76 @@ describe "whereami" do
|
|
85
84
|
Object.remove_const(:Cor)
|
86
85
|
end
|
87
86
|
|
88
|
-
|
87
|
+
# Now that we use stagger_output (paging output) we no longer get
|
88
|
+
# the "From: " line, as we output everything in one go (not separate output.puts)
|
89
|
+
# and so the user just gets a single `Error: Cannot open
|
90
|
+
# "not.found.file.erb" for reading.`
|
91
|
+
# which is good enough IMO. Unfortunately we can't test for it
|
92
|
+
# though, as we don't hook stdout.
|
93
|
+
#
|
94
|
+
# it 'should display a description and error if reading the file goes wrong' do
|
95
|
+
# class Cor
|
96
|
+
# def blimey!
|
97
|
+
# eval <<-END, binding, "not.found.file.erb", 7
|
98
|
+
# Pad.tester = pry_tester(binding)
|
99
|
+
# Pad.tester.eval('whereami')
|
100
|
+
# END
|
101
|
+
# end
|
102
|
+
# end
|
103
|
+
|
104
|
+
# proc { Cor.new.blimey! }.should.raise(MethodSource::SourceNotFoundError)
|
105
|
+
|
106
|
+
# Pad.tester.last_output.should =~
|
107
|
+
# /From: not.found.file.erb @ line 7 Cor#blimey!:/
|
108
|
+
# Object.remove_const(:Cor)
|
109
|
+
# end
|
110
|
+
|
111
|
+
it 'should show code window (not just method source) if parameter passed to whereami' do
|
89
112
|
class Cor
|
90
113
|
def blimey!
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
114
|
+
pry_eval(binding, 'whereami 3').should =~ /class Cor/
|
115
|
+
end
|
116
|
+
end
|
117
|
+
Cor.new.blimey!
|
118
|
+
Object.remove_const(:Cor)
|
119
|
+
end
|
120
|
+
|
121
|
+
it 'should show entire method when -m option used' do
|
122
|
+
old_size, Pry.config.default_window_size = Pry.config.default_window_size, 1
|
123
|
+
old_cutoff, Pry::Command::Whereami.method_size_cutoff = Pry::Command::Whereami.method_size_cutoff, 1
|
124
|
+
class Cor
|
125
|
+
def blimey!
|
126
|
+
1
|
127
|
+
2
|
128
|
+
pry_eval(binding, 'whereami -m').should =~ /def blimey/
|
95
129
|
end
|
96
130
|
end
|
131
|
+
Pry::Command::Whereami.method_size_cutoff, Pry.config.default_window_size = old_cutoff, old_size
|
132
|
+
Cor.new.blimey!
|
133
|
+
Object.remove_const(:Cor)
|
134
|
+
end
|
97
135
|
|
98
|
-
|
99
|
-
|
100
|
-
|
136
|
+
it 'should show entire file when -f option used' do
|
137
|
+
class Cor
|
138
|
+
def blimey!
|
139
|
+
1
|
140
|
+
2
|
141
|
+
pry_eval(binding, 'whereami -f').should =~ /show entire file when -f option used/
|
142
|
+
end
|
143
|
+
end
|
144
|
+
Cor.new.blimey!
|
101
145
|
Object.remove_const(:Cor)
|
102
146
|
end
|
103
147
|
|
104
|
-
it 'should show
|
148
|
+
it 'should show class when -c option used, and locate correct candidate' do
|
149
|
+
require 'fixtures/whereami_helper'
|
105
150
|
class Cor
|
106
151
|
def blimey!
|
107
|
-
|
152
|
+
1
|
153
|
+
2
|
154
|
+
out = pry_eval(binding, 'whereami -c')
|
155
|
+
out.should =~ /class Cor/
|
156
|
+
out.should =~ /blimey/
|
108
157
|
end
|
109
158
|
end
|
110
159
|
Cor.new.blimey!
|
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
|
@@ -0,0 +1,73 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
describe Pry::Helpers::DocumentationHelpers do
|
4
|
+
before do
|
5
|
+
@helper = Pry::Helpers::DocumentationHelpers
|
6
|
+
end
|
7
|
+
|
8
|
+
describe "get_comment_content" do
|
9
|
+
it "should strip off the hash and unindent" do
|
10
|
+
@helper.get_comment_content(" # hello\n # world\n").should == "hello\nworld\n"
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should strip out leading lines of hashes" do
|
14
|
+
@helper.get_comment_content("###############\n#hello\n#world\n").should == "hello\nworld\n"
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should remove shebangs" do
|
18
|
+
@helper.get_comment_content("#!/usr/bin/env ruby\n# This is a program\n").should == "This is a program\n"
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should unindent past separators" do
|
22
|
+
@helper.get_comment_content(" # Copyright Me <me@cirw.in>\n #--\n # So there.\n").should == "Copyright Me <me@cirw.in>\n--\nSo there.\n"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
describe "process_rdoc" do
|
27
|
+
before do
|
28
|
+
Pry.color = true
|
29
|
+
end
|
30
|
+
|
31
|
+
after do
|
32
|
+
Pry.color = false
|
33
|
+
end
|
34
|
+
|
35
|
+
it "should syntax highlight indented code" do
|
36
|
+
@helper.process_rdoc(" 4 + 4\n").should.not == " 4 + 4\n"
|
37
|
+
end
|
38
|
+
|
39
|
+
it "should highlight words surrounded by +s" do
|
40
|
+
@helper.process_rdoc("the +parameter+").should =~ /the \e.*parameter\e.*/
|
41
|
+
end
|
42
|
+
|
43
|
+
it "should syntax highlight things in backticks" do
|
44
|
+
@helper.process_rdoc("for `Example`").should =~ /for `\e.*Example\e.*`/
|
45
|
+
end
|
46
|
+
|
47
|
+
it "should emphasise em tags" do
|
48
|
+
@helper.process_rdoc("for <em>science</em>").should == "for \e[1mscience\e[0m"
|
49
|
+
end
|
50
|
+
|
51
|
+
it "should emphasise italic tags" do
|
52
|
+
@helper.process_rdoc("for <i>science</i>").should == "for \e[1mscience\e[0m"
|
53
|
+
end
|
54
|
+
|
55
|
+
it "should syntax highlight code in <code>" do
|
56
|
+
@helper.process_rdoc("for <code>Example</code>").should =~ /for \e.*Example\e.*/
|
57
|
+
end
|
58
|
+
|
59
|
+
it "should not double-highlight backticks inside indented code" do
|
60
|
+
@helper.process_rdoc(" `echo 5`").should =~ /echo 5/
|
61
|
+
end
|
62
|
+
|
63
|
+
it "should not remove ++" do
|
64
|
+
@helper.process_rdoc("--\n comment in a bubble\n++").should =~ /\+\+/
|
65
|
+
end
|
66
|
+
|
67
|
+
it "should do nothing if Pry.color is false" do
|
68
|
+
Pry.color = false
|
69
|
+
@helper.process_rdoc(" 4 + 4\n").should == " 4 + 4\n"
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
end
|
data/spec/helpers/table_spec.rb
CHANGED
@@ -80,6 +80,25 @@ asfadsssaaad fasfaafdssd s
|
|
80
80
|
end
|
81
81
|
end
|
82
82
|
|
83
|
+
describe 'line length is smaller than the length of the longest word' do
|
84
|
+
before do
|
85
|
+
element = 'swizzle'
|
86
|
+
@elem_len = element.length
|
87
|
+
@out = [element, 'crime', 'fun']
|
88
|
+
end
|
89
|
+
|
90
|
+
it 'should not raise error' do
|
91
|
+
should.not.raise(FloatDomainError) {
|
92
|
+
Pry::Helpers.tablify(@out, @elem_len - 1)
|
93
|
+
}
|
94
|
+
end
|
95
|
+
|
96
|
+
it 'should format output as one column' do
|
97
|
+
table = Pry::Helpers.tablify(@out, @elem_len - 1).to_s
|
98
|
+
table.should == "swizzle\ncrime \nfun "
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
83
102
|
describe 'decide between one-line or indented output' do
|
84
103
|
Pry::Helpers.tablify_or_one_line('head', %w(ing)).should == 'head: ing'
|
85
104
|
end
|
data/spec/method_spec.rb
CHANGED
@@ -95,27 +95,29 @@ describe Pry::Method do
|
|
95
95
|
end
|
96
96
|
|
97
97
|
it "should find methods that have been undef'd" do
|
98
|
-
|
98
|
+
c = Class.new do
|
99
99
|
def self.bar
|
100
100
|
class << self; undef bar; end
|
101
101
|
binding
|
102
102
|
end
|
103
|
-
end
|
103
|
+
end
|
104
|
+
|
105
|
+
m = Pry::Method.from_binding(c.bar)
|
104
106
|
m.name.should == "bar"
|
105
107
|
end
|
106
108
|
|
107
109
|
# Our source_location trick doesn't work, due to https://github.com/rubinius/rubinius/issues/953
|
108
110
|
unless Pry::Helpers::BaseHelpers.rbx?
|
109
|
-
|
110
|
-
a = Class.new{ def
|
111
|
-
b = Class.new(a){ def
|
111
|
+
it 'should find the super method correctly' do
|
112
|
+
a = Class.new{ def gag33; binding; end; def self.line; __LINE__; end }
|
113
|
+
b = Class.new(a){ def gag33; super; end }
|
112
114
|
|
113
|
-
g = b.new.
|
115
|
+
g = b.new.gag33
|
114
116
|
m = Pry::Method.from_binding(g)
|
115
117
|
|
116
118
|
m.owner.should == a
|
117
119
|
m.source_line.should == a.line
|
118
|
-
m.name.should == "
|
120
|
+
m.name.should == "gag33"
|
119
121
|
end
|
120
122
|
end
|
121
123
|
|
@@ -140,6 +142,21 @@ describe Pry::Method do
|
|
140
142
|
m.source_line.should == a.line
|
141
143
|
end
|
142
144
|
end
|
145
|
+
|
146
|
+
it 'should find the right method even if it was renamed and replaced' do
|
147
|
+
o = Object.new
|
148
|
+
class << o
|
149
|
+
def borscht
|
150
|
+
"nips"
|
151
|
+
binding
|
152
|
+
end
|
153
|
+
alias paella borscht
|
154
|
+
def borscht() paella end
|
155
|
+
end
|
156
|
+
|
157
|
+
m = Pry::Method.from_binding(o.borscht)
|
158
|
+
m.source.should == Pry::Method(o.method(:paella)).source
|
159
|
+
end
|
143
160
|
end
|
144
161
|
|
145
162
|
describe 'super' do
|
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.12
|
5
5
|
prerelease:
|
6
6
|
platform: java
|
7
7
|
authors:
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2013-
|
14
|
+
date: 2013-02-12 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: coderay
|
@@ -184,7 +184,6 @@ extensions: []
|
|
184
184
|
extra_rdoc_files: []
|
185
185
|
files:
|
186
186
|
- .document
|
187
|
-
- .gemtest
|
188
187
|
- .gitignore
|
189
188
|
- .travis.yml
|
190
189
|
- .yardopts
|
@@ -216,8 +215,8 @@ files:
|
|
216
215
|
- lib/pry/commands/cat/input_expression_formatter.rb
|
217
216
|
- lib/pry/commands/cd.rb
|
218
217
|
- lib/pry/commands/code_collector.rb
|
219
|
-
- lib/pry/commands/deprecated_commands.rb
|
220
218
|
- lib/pry/commands/disable_pry.rb
|
219
|
+
- lib/pry/commands/disabled_commands.rb
|
221
220
|
- lib/pry/commands/easter_eggs.rb
|
222
221
|
- lib/pry/commands/edit.rb
|
223
222
|
- lib/pry/commands/edit/exception_patcher.rb
|
@@ -277,6 +276,8 @@ files:
|
|
277
276
|
- lib/pry/hooks.rb
|
278
277
|
- lib/pry/indent.rb
|
279
278
|
- lib/pry/method.rb
|
279
|
+
- lib/pry/method/disowned.rb
|
280
|
+
- lib/pry/method/weird_method_locator.rb
|
280
281
|
- lib/pry/module_candidate.rb
|
281
282
|
- lib/pry/pager.rb
|
282
283
|
- lib/pry/plugins.rb
|
@@ -286,7 +287,7 @@ files:
|
|
286
287
|
- lib/pry/rbx_path.rb
|
287
288
|
- lib/pry/repl_file_loader.rb
|
288
289
|
- lib/pry/rubygem.rb
|
289
|
-
- lib/pry/
|
290
|
+
- lib/pry/terminal.rb
|
290
291
|
- lib/pry/test/helper.rb
|
291
292
|
- lib/pry/version.rb
|
292
293
|
- lib/pry/wrapped_module.rb
|
@@ -294,6 +295,7 @@ files:
|
|
294
295
|
- man/pry.1.html
|
295
296
|
- man/pry.1.ronn
|
296
297
|
- pry.gemspec
|
298
|
+
- spec/Procfile
|
297
299
|
- spec/cli_spec.rb
|
298
300
|
- spec/code_object_spec.rb
|
299
301
|
- spec/code_spec.rb
|
@@ -326,6 +328,7 @@ files:
|
|
326
328
|
- spec/commands/whereami_spec.rb
|
327
329
|
- spec/completion_spec.rb
|
328
330
|
- spec/control_d_handler_spec.rb
|
331
|
+
- spec/documentation_helper_spec.rb
|
329
332
|
- spec/editor_spec.rb
|
330
333
|
- spec/exception_whitelist_spec.rb
|
331
334
|
- spec/fixtures/candidate_helper1.rb
|
@@ -335,6 +338,7 @@ files:
|
|
335
338
|
- spec/fixtures/show_source_doc_examples.rb
|
336
339
|
- spec/fixtures/testrc
|
337
340
|
- spec/fixtures/testrcbad
|
341
|
+
- spec/fixtures/whereami_helper.rb
|
338
342
|
- spec/helper.rb
|
339
343
|
- spec/helpers/bacon.rb
|
340
344
|
- spec/helpers/mock_pry.rb
|
@@ -380,6 +384,7 @@ signing_key:
|
|
380
384
|
specification_version: 3
|
381
385
|
summary: An IRB alternative and runtime developer console
|
382
386
|
test_files:
|
387
|
+
- spec/Procfile
|
383
388
|
- spec/cli_spec.rb
|
384
389
|
- spec/code_object_spec.rb
|
385
390
|
- spec/code_spec.rb
|
@@ -412,6 +417,7 @@ test_files:
|
|
412
417
|
- spec/commands/whereami_spec.rb
|
413
418
|
- spec/completion_spec.rb
|
414
419
|
- spec/control_d_handler_spec.rb
|
420
|
+
- spec/documentation_helper_spec.rb
|
415
421
|
- spec/editor_spec.rb
|
416
422
|
- spec/exception_whitelist_spec.rb
|
417
423
|
- spec/fixtures/candidate_helper1.rb
|
@@ -421,6 +427,7 @@ test_files:
|
|
421
427
|
- spec/fixtures/show_source_doc_examples.rb
|
422
428
|
- spec/fixtures/testrc
|
423
429
|
- spec/fixtures/testrcbad
|
430
|
+
- spec/fixtures/whereami_helper.rb
|
424
431
|
- spec/helper.rb
|
425
432
|
- spec/helpers/bacon.rb
|
426
433
|
- spec/helpers/mock_pry.rb
|
data/.gemtest
DELETED
File without changes
|
data/lib/pry/terminal_info.rb
DELETED
@@ -1,48 +0,0 @@
|
|
1
|
-
class Pry::TerminalInfo
|
2
|
-
# Return a pair of [rows, columns] which gives the size of the window.
|
3
|
-
#
|
4
|
-
# If the window size cannot be determined, return nil.
|
5
|
-
def self.screen_size
|
6
|
-
rows, cols = actual_screen_size
|
7
|
-
if rows && cols
|
8
|
-
[rows.to_i, cols.to_i]
|
9
|
-
else
|
10
|
-
nil
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
# Return a screen width or a default if it fails.
|
15
|
-
def self.width! default = 80
|
16
|
-
(screen_size || [nil, default])[1]
|
17
|
-
end
|
18
|
-
|
19
|
-
def self.actual_screen_size
|
20
|
-
[
|
21
|
-
# Some readlines also provides get_screen_size.
|
22
|
-
# Readline comes before IO#winsize because jruby sometimes defaults winsize to [25, 80]
|
23
|
-
readline_screen_size,
|
24
|
-
|
25
|
-
# io/console adds a winsize method to IO streams.
|
26
|
-
# rescue nil for jruby 1.7.0 [jruby/jruby#354]
|
27
|
-
$stdout.tty? && $stdout.respond_to?(:winsize) && ($stdout.winsize rescue nil),
|
28
|
-
|
29
|
-
# Otherwise try to use the environment (this may be out of date due
|
30
|
-
# to window resizing, but it's better than nothing).
|
31
|
-
[ENV["LINES"] || ENV["ROWS"], ENV["COLUMNS"]],
|
32
|
-
|
33
|
-
# If the user is running within ansicon, then use the screen size
|
34
|
-
# that it reports (same caveats apply as with ROWS and COLUMNS)
|
35
|
-
ENV['ANSICON'] =~ /\((.*)x(.*)\)/ && [$2, $1],
|
36
|
-
].detect do |(_, cols)|
|
37
|
-
cols.to_i > 0
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
def self.readline_screen_size
|
42
|
-
Readline.get_screen_size if Readline.respond_to?(:get_screen_size)
|
43
|
-
rescue Java::JavaLang::NullPointerException
|
44
|
-
# This rescue won't happen on jrubies later than:
|
45
|
-
# https://github.com/jruby/jruby/pull/436
|
46
|
-
nil
|
47
|
-
end
|
48
|
-
end
|