pry 0.9.5-i386-mingw32 → 0.9.6-i386-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +21 -0
- data/Gemfile +2 -0
- data/README.markdown +15 -17
- data/Rakefile +1 -1
- data/bin/pry +8 -6
- data/examples/example_command_override.rb +1 -1
- data/lib/pry.rb +19 -4
- data/lib/pry/command_context.rb +1 -0
- data/lib/pry/command_processor.rb +1 -0
- data/lib/pry/command_set.rb +2 -2
- data/lib/pry/config.rb +15 -0
- data/lib/pry/default_commands/context.rb +8 -4
- data/lib/pry/default_commands/documentation.rb +18 -12
- data/lib/pry/default_commands/input.rb +120 -67
- data/lib/pry/default_commands/introspection.rb +112 -67
- data/lib/pry/default_commands/shell.rb +28 -17
- data/lib/pry/helpers/command_helpers.rb +73 -40
- data/lib/pry/history_array.rb +4 -0
- data/lib/pry/pry_class.rb +10 -6
- data/lib/pry/pry_instance.rb +57 -25
- data/lib/pry/version.rb +1 -1
- data/pry.gemspec +8 -8
- data/test/helper.rb +35 -1
- data/test/test_command_set.rb +1 -1
- data/test/test_default_commands/test_input.rb +30 -17
- data/test/test_default_commands/test_introspection.rb +334 -1
- data/test/test_default_commands/test_shell.rb +100 -5
- data/test/test_exception_whitelist.rb +17 -0
- data/test/test_input_stack.rb +70 -0
- data/test/test_pry.rb +26 -22
- data/test/test_pry_output.rb +2 -6
- metadata +73 -74
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
describe "Pry.config.exception_whitelist" do
|
4
|
+
it 'should rescue all exceptions NOT specified on whitelist' do
|
5
|
+
Pry.config.exception_whitelist.include?(NameError).should == false
|
6
|
+
lambda { Pry.start(self, :input => StringIO.new("raise NameError\nexit"), :output => StringIO.new) }.should.not.raise NameError
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'should NOT rescue exceptions specified on whitelist' do
|
10
|
+
old_whitelist = Pry.config.exception_whitelist
|
11
|
+
Pry.config.exception_whitelist = [NameError]
|
12
|
+
lambda { Pry.start(self, :input => StringIO.new("raise NameError"), :output => StringIO.new) }.should.raise NameError
|
13
|
+
Pry.config.exception_whitelist = old_whitelist
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
|
@@ -0,0 +1,70 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
describe "Pry#input_stack" do
|
4
|
+
it 'should accept :input_stack as a config option' do
|
5
|
+
stack = [StringIO.new("test")]
|
6
|
+
Pry.new(:input_stack => stack).input_stack.should == stack
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'should use defaults from Pry.config' do
|
10
|
+
Pry.config.input_stack = [StringIO.new("exit")]
|
11
|
+
Pry.new.input_stack.should == Pry.config.input_stack
|
12
|
+
Pry.config.input_stack = []
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'should read from all input objects on stack and exit session (usingn repl)' do
|
16
|
+
stack = [b = StringIO.new(":cloister\nexit\n"), c = StringIO.new(":baron\n")]
|
17
|
+
instance = Pry.new(:input => StringIO.new(":alex\n"),
|
18
|
+
:output => str_output = StringIO.new,
|
19
|
+
:input_stack => stack)
|
20
|
+
|
21
|
+
instance.repl
|
22
|
+
str_output.string.should =~ /:alex/
|
23
|
+
str_output.string.should =~ /:baron/
|
24
|
+
str_output.string.should =~ /:cloister/
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'input objects should be popped off stack as they are used up' do
|
28
|
+
stack = [StringIO.new(":cloister\n"), StringIO.new(":baron\n")]
|
29
|
+
instance = Pry.new(:input => StringIO.new(":alex\n"),
|
30
|
+
:output => str_output = StringIO.new,
|
31
|
+
:input_stack => stack)
|
32
|
+
|
33
|
+
stack.size.should == 2
|
34
|
+
|
35
|
+
instance.rep
|
36
|
+
str_output.string.should =~ /:alex/
|
37
|
+
instance.rep
|
38
|
+
str_output.string.should =~ /:baron/
|
39
|
+
stack.size.should == 1
|
40
|
+
instance.rep
|
41
|
+
str_output.string.should =~ /:cloister/
|
42
|
+
stack.size.should == 0
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'should revert to Pry.config.input when it runs out of input objects in input_stack' do
|
46
|
+
redirect_pry_io(StringIO.new(":rimbaud\nexit\n"), StringIO.new) do
|
47
|
+
stack = [StringIO.new(":cloister\n"), StringIO.new(":baron\n")]
|
48
|
+
instance = Pry.new(:input => StringIO.new(":alex\n"),
|
49
|
+
:output => str_output = StringIO.new,
|
50
|
+
:input_stack => stack)
|
51
|
+
|
52
|
+
instance.repl
|
53
|
+
str_output.string.should =~ /:alex/
|
54
|
+
str_output.string.should =~ /:baron/
|
55
|
+
str_output.string.should =~ /:cloister/
|
56
|
+
str_output.string.should =~ /:rimbaud/
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
it 'should display error and throw(:breakout) if at end of input after using up input_stack objects' do
|
61
|
+
str_output = StringIO.new
|
62
|
+
catch(:breakout) do
|
63
|
+
redirect_pry_io(StringIO.new(":rimbaud\n"), str_output) do
|
64
|
+
Pry.new(:input_stack => [StringIO.new(":a\n"), StringIO.new(":b\n")]).repl
|
65
|
+
end
|
66
|
+
end
|
67
|
+
str_output.string.should =~ /Error: Pry ran out of things to read/
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
data/test/test_pry.rb
CHANGED
@@ -1,10 +1,5 @@
|
|
1
1
|
require 'helper'
|
2
2
|
|
3
|
-
puts "Ruby Version #{RUBY_VERSION}"
|
4
|
-
puts "Testing Pry #{Pry::VERSION}"
|
5
|
-
puts "With method_source version #{MethodSource::VERSION}"
|
6
|
-
puts "--"
|
7
|
-
|
8
3
|
describe Pry do
|
9
4
|
|
10
5
|
if RUBY_PLATFORM !~ /mingw/ && RUBY_PLATFORM !~ /mswin/ && RUBY_PLATFORM != 'java'
|
@@ -19,7 +14,6 @@ describe Pry do
|
|
19
14
|
|
20
15
|
if RUBY_VERSION =~ /1.9/
|
21
16
|
describe "Exotic object support" do
|
22
|
-
|
23
17
|
# regression test for exotic object support
|
24
18
|
it "Should not error when return value is a BasicObject instance" do
|
25
19
|
|
@@ -64,7 +58,7 @@ describe Pry do
|
|
64
58
|
o = Object.new
|
65
59
|
pry_tester = Pry.new(:input => StringIO.new(input_string),
|
66
60
|
:output => str_output,
|
67
|
-
:exception_handler => proc { |_, exception| @excep = exception },
|
61
|
+
:exception_handler => proc { |_, exception, _pry_| @excep = exception },
|
68
62
|
:print => proc {}
|
69
63
|
).rep(o)
|
70
64
|
|
@@ -92,16 +86,14 @@ describe Pry do
|
|
92
86
|
o.instance_variable_get(:@x).should == 10
|
93
87
|
end
|
94
88
|
|
95
|
-
it 'should
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
Pry.new.rep(self)
|
89
|
+
it 'should display error and throw(:breakout) if Pry instance runs out of input' do
|
90
|
+
str_output = StringIO.new
|
91
|
+
catch(:breakout) do
|
92
|
+
redirect_pry_io(StringIO.new(":nothing\n"), str_output) do
|
93
|
+
Pry.new.repl
|
94
|
+
end
|
102
95
|
end
|
103
|
-
|
104
|
-
outp.string.empty?.should == true
|
96
|
+
str_output.string.should =~ /Error: Pry ran out of things to read/
|
105
97
|
end
|
106
98
|
|
107
99
|
it 'should make self evaluate to the receiver of the rep session' do
|
@@ -146,7 +138,6 @@ describe Pry do
|
|
146
138
|
str_output.string.should == ""
|
147
139
|
end
|
148
140
|
|
149
|
-
|
150
141
|
it 'should suppress output if input ends in a ";" (multi-line)' do
|
151
142
|
o = Object.new
|
152
143
|
str_output = StringIO.new
|
@@ -189,6 +180,19 @@ describe Pry do
|
|
189
180
|
end
|
190
181
|
end
|
191
182
|
|
183
|
+
describe "Pry#run_command" do
|
184
|
+
it 'should run a command in a specified context' do
|
185
|
+
b = Pry.binding_for(7)
|
186
|
+
p = Pry.new(:output => StringIO.new)
|
187
|
+
p.run_command("ls -m", b)
|
188
|
+
p.output.string.should =~ /divmod/
|
189
|
+
end
|
190
|
+
|
191
|
+
it 'should run a command in the context of a session' do
|
192
|
+
mock_pry("@session_ivar = 10", "_pry_.run_command('ls')").should =~ /@session_ivar/
|
193
|
+
end
|
194
|
+
end
|
195
|
+
|
192
196
|
describe "repl" do
|
193
197
|
describe "basic functionality" do
|
194
198
|
it 'should set an ivar on an object and exit the repl' do
|
@@ -559,14 +563,14 @@ describe Pry do
|
|
559
563
|
|
560
564
|
it 'should NOT try to interpolate pure ruby code (no commands) ' do
|
561
565
|
str_output = StringIO.new
|
562
|
-
Pry.new(:input => StringIO.new('
|
566
|
+
Pry.new(:input => StringIO.new('format \'#{aggy}\''), :output => str_output).rep
|
563
567
|
str_output.string.should.not =~ /NameError/
|
564
568
|
|
565
|
-
Pry.new(:input => StringIO.new('
|
569
|
+
Pry.new(:input => StringIO.new('format #{aggy}'), :output => str_output).rep
|
566
570
|
str_output.string.should.not =~ /NameError/
|
567
571
|
|
568
572
|
$test_interpolation = "blah"
|
569
|
-
Pry.new(:input => StringIO.new('
|
573
|
+
Pry.new(:input => StringIO.new('format \'#{$test_interpolation}\''), :output => str_output).rep
|
570
574
|
|
571
575
|
str_output.string.should.not =~ /blah/
|
572
576
|
$test_interpolation = nil
|
@@ -1136,9 +1140,9 @@ describe Pry do
|
|
1136
1140
|
end
|
1137
1141
|
|
1138
1142
|
describe "given the 'main' object" do
|
1139
|
-
it "returns the #
|
1143
|
+
it "returns the #to_s of main (special case)" do
|
1140
1144
|
o = TOPLEVEL_BINDING.eval('self')
|
1141
|
-
Pry.view_clip(o, VC_MAX_LENGTH).should == o.
|
1145
|
+
Pry.view_clip(o, VC_MAX_LENGTH).should == o.to_s
|
1142
1146
|
end
|
1143
1147
|
end
|
1144
1148
|
|
data/test/test_pry_output.rb
CHANGED
@@ -16,7 +16,7 @@ describe Pry do
|
|
16
16
|
it "should display serialization exceptions" do
|
17
17
|
Pry.config.print = lambda { |*a| raise "catch-22" }
|
18
18
|
|
19
|
-
mock_pry("1").should =~
|
19
|
+
mock_pry("1").should =~ /\(pry\) output error: #<RuntimeError: catch-22>/
|
20
20
|
end
|
21
21
|
|
22
22
|
it "should catch errors serializing exceptions" do
|
@@ -24,7 +24,7 @@ describe Pry do
|
|
24
24
|
raise Exception.new("catch-22").tap{ |e| class << e; def inspect; raise e; end; end }
|
25
25
|
end
|
26
26
|
|
27
|
-
mock_pry("1").should =~
|
27
|
+
mock_pry("1").should =~ /\(pry\) output error: failed to show result/
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
@@ -36,9 +36,5 @@ describe Pry do
|
|
36
36
|
it "should not be phased by un-inspectable things" do
|
37
37
|
mock_pry("class NastyClass; undef pretty_inspect; end", "NastyClass.new").should =~ /#<NastyClass:0x[0-9a-f]+>/
|
38
38
|
end
|
39
|
-
|
40
|
-
it "should warn you about un-inspectable things" do
|
41
|
-
mock_pry("class NastyClass; undef pretty_inspect; end", "NastyClass.new").should =~ /output error: #<(NoMethodError|NameError): undefined method `pretty_inspect'/
|
42
|
-
end
|
43
39
|
end
|
44
40
|
end
|
metadata
CHANGED
@@ -1,109 +1,107 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: pry
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.9.6
|
4
5
|
prerelease:
|
5
|
-
version: 0.9.5
|
6
6
|
platform: i386-mingw32
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- John Mair (banisterfiend)
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2011-09-19 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
16
15
|
name: ruby_parser
|
17
|
-
|
18
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &70165026897420 !ruby/object:Gem::Requirement
|
19
17
|
none: false
|
20
|
-
requirements:
|
21
|
-
- -
|
22
|
-
- !ruby/object:Gem::Version
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
23
21
|
version: 2.0.5
|
24
22
|
type: :runtime
|
25
|
-
version_requirements: *id001
|
26
|
-
- !ruby/object:Gem::Dependency
|
27
|
-
name: coderay
|
28
23
|
prerelease: false
|
29
|
-
|
24
|
+
version_requirements: *70165026897420
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: coderay
|
27
|
+
requirement: &70165026895400 !ruby/object:Gem::Requirement
|
30
28
|
none: false
|
31
|
-
requirements:
|
32
|
-
- -
|
33
|
-
- !ruby/object:Gem::Version
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
34
32
|
version: 0.9.8
|
35
33
|
type: :runtime
|
36
|
-
version_requirements: *id002
|
37
|
-
- !ruby/object:Gem::Dependency
|
38
|
-
name: slop
|
39
34
|
prerelease: false
|
40
|
-
|
35
|
+
version_requirements: *70165026895400
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: slop
|
38
|
+
requirement: &70165026894080 !ruby/object:Gem::Requirement
|
41
39
|
none: false
|
42
|
-
requirements:
|
40
|
+
requirements:
|
43
41
|
- - ~>
|
44
|
-
- !ruby/object:Gem::Version
|
42
|
+
- !ruby/object:Gem::Version
|
45
43
|
version: 2.1.0
|
46
44
|
type: :runtime
|
47
|
-
version_requirements: *id003
|
48
|
-
- !ruby/object:Gem::Dependency
|
49
|
-
name: method_source
|
50
45
|
prerelease: false
|
51
|
-
|
46
|
+
version_requirements: *70165026894080
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: method_source
|
49
|
+
requirement: &70165026893160 !ruby/object:Gem::Requirement
|
52
50
|
none: false
|
53
|
-
requirements:
|
54
|
-
- -
|
55
|
-
- !ruby/object:Gem::Version
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
56
54
|
version: 0.6.5
|
57
55
|
type: :runtime
|
58
|
-
version_requirements: *id004
|
59
|
-
- !ruby/object:Gem::Dependency
|
60
|
-
name: bacon
|
61
56
|
prerelease: false
|
62
|
-
|
57
|
+
version_requirements: *70165026893160
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: bacon
|
60
|
+
requirement: &70165031071820 !ruby/object:Gem::Requirement
|
63
61
|
none: false
|
64
|
-
requirements:
|
65
|
-
- -
|
66
|
-
- !ruby/object:Gem::Version
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
67
65
|
version: 1.1.0
|
68
66
|
type: :development
|
69
|
-
version_requirements: *id005
|
70
|
-
- !ruby/object:Gem::Dependency
|
71
|
-
name: open4
|
72
67
|
prerelease: false
|
73
|
-
|
68
|
+
version_requirements: *70165031071820
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: open4
|
71
|
+
requirement: &70165027815900 !ruby/object:Gem::Requirement
|
74
72
|
none: false
|
75
|
-
requirements:
|
73
|
+
requirements:
|
76
74
|
- - ~>
|
77
|
-
- !ruby/object:Gem::Version
|
75
|
+
- !ruby/object:Gem::Version
|
78
76
|
version: 1.0.1
|
79
77
|
type: :development
|
80
|
-
version_requirements: *id006
|
81
|
-
- !ruby/object:Gem::Dependency
|
82
|
-
name: win32console
|
83
78
|
prerelease: false
|
84
|
-
|
79
|
+
version_requirements: *70165027815900
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: win32console
|
82
|
+
requirement: &70165027814700 !ruby/object:Gem::Requirement
|
85
83
|
none: false
|
86
|
-
requirements:
|
87
|
-
- -
|
88
|
-
- !ruby/object:Gem::Version
|
84
|
+
requirements:
|
85
|
+
- - ! '>='
|
86
|
+
- !ruby/object:Gem::Version
|
89
87
|
version: 1.3.0
|
90
88
|
type: :runtime
|
91
|
-
|
89
|
+
prerelease: false
|
90
|
+
version_requirements: *70165027814700
|
92
91
|
description: An IRB alternative and runtime developer console
|
93
92
|
email: jrmair@gmail.com
|
94
|
-
executables:
|
93
|
+
executables:
|
95
94
|
- pry
|
96
95
|
extensions: []
|
97
|
-
|
98
96
|
extra_rdoc_files: []
|
99
|
-
|
100
|
-
files:
|
97
|
+
files:
|
101
98
|
- .document
|
102
99
|
- .gemtest
|
103
100
|
- .gitignore
|
104
101
|
- .yardopts
|
105
102
|
- CHANGELOG
|
106
103
|
- CONTRIBUTORS
|
104
|
+
- Gemfile
|
107
105
|
- LICENSE
|
108
106
|
- README.markdown
|
109
107
|
- Rakefile
|
@@ -163,7 +161,9 @@ files:
|
|
163
161
|
- test/test_default_commands/test_input.rb
|
164
162
|
- test/test_default_commands/test_introspection.rb
|
165
163
|
- test/test_default_commands/test_shell.rb
|
164
|
+
- test/test_exception_whitelist.rb
|
166
165
|
- test/test_history_array.rb
|
166
|
+
- test/test_input_stack.rb
|
167
167
|
- test/test_pry.rb
|
168
168
|
- test/test_pry_history.rb
|
169
169
|
- test/test_pry_output.rb
|
@@ -173,32 +173,29 @@ files:
|
|
173
173
|
- wiki/Home.md
|
174
174
|
homepage: http://pry.github.com
|
175
175
|
licenses: []
|
176
|
-
|
177
176
|
post_install_message:
|
178
177
|
rdoc_options: []
|
179
|
-
|
180
|
-
require_paths:
|
178
|
+
require_paths:
|
181
179
|
- lib
|
182
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
180
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
183
181
|
none: false
|
184
|
-
requirements:
|
185
|
-
- -
|
186
|
-
- !ruby/object:Gem::Version
|
187
|
-
version:
|
188
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
182
|
+
requirements:
|
183
|
+
- - ! '>='
|
184
|
+
- !ruby/object:Gem::Version
|
185
|
+
version: '0'
|
186
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
189
187
|
none: false
|
190
|
-
requirements:
|
191
|
-
- -
|
192
|
-
- !ruby/object:Gem::Version
|
193
|
-
version:
|
188
|
+
requirements:
|
189
|
+
- - ! '>='
|
190
|
+
- !ruby/object:Gem::Version
|
191
|
+
version: '0'
|
194
192
|
requirements: []
|
195
|
-
|
196
193
|
rubyforge_project:
|
197
|
-
rubygems_version: 1.
|
194
|
+
rubygems_version: 1.8.6
|
198
195
|
signing_key:
|
199
196
|
specification_version: 3
|
200
197
|
summary: An IRB alternative and runtime developer console
|
201
|
-
test_files:
|
198
|
+
test_files:
|
202
199
|
- test/helper.rb
|
203
200
|
- test/test_command_helpers.rb
|
204
201
|
- test/test_command_processor.rb
|
@@ -211,7 +208,9 @@ test_files:
|
|
211
208
|
- test/test_default_commands/test_input.rb
|
212
209
|
- test/test_default_commands/test_introspection.rb
|
213
210
|
- test/test_default_commands/test_shell.rb
|
211
|
+
- test/test_exception_whitelist.rb
|
214
212
|
- test/test_history_array.rb
|
213
|
+
- test/test_input_stack.rb
|
215
214
|
- test/test_pry.rb
|
216
215
|
- test/test_pry_history.rb
|
217
216
|
- test/test_pry_output.rb
|