pry 0.9.9.6pre2-java → 0.9.10-java

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.
Files changed (68) hide show
  1. data/CHANGELOG +41 -0
  2. data/CONTRIBUTORS +27 -26
  3. data/README.markdown +4 -4
  4. data/Rakefile +2 -2
  5. data/lib/pry.rb +25 -19
  6. data/lib/pry/cli.rb +31 -10
  7. data/lib/pry/code.rb +41 -83
  8. data/lib/pry/command.rb +87 -76
  9. data/lib/pry/command_set.rb +13 -20
  10. data/lib/pry/completion.rb +139 -121
  11. data/lib/pry/config.rb +4 -0
  12. data/lib/pry/core_extensions.rb +88 -31
  13. data/lib/pry/default_commands/cd.rb +31 -8
  14. data/lib/pry/default_commands/context.rb +4 -58
  15. data/lib/pry/default_commands/easter_eggs.rb +1 -1
  16. data/lib/pry/default_commands/editing.rb +21 -14
  17. data/lib/pry/default_commands/find_method.rb +5 -7
  18. data/lib/pry/default_commands/gist.rb +187 -0
  19. data/lib/pry/default_commands/hist.rb +6 -6
  20. data/lib/pry/default_commands/input_and_output.rb +73 -129
  21. data/lib/pry/default_commands/introspection.rb +107 -52
  22. data/lib/pry/default_commands/ls.rb +1 -1
  23. data/lib/pry/default_commands/misc.rb +0 -5
  24. data/lib/pry/default_commands/whereami.rb +92 -0
  25. data/lib/pry/helpers/base_helpers.rb +6 -1
  26. data/lib/pry/helpers/command_helpers.rb +30 -9
  27. data/lib/pry/helpers/documentation_helpers.rb +7 -7
  28. data/lib/pry/helpers/options_helpers.rb +1 -1
  29. data/lib/pry/helpers/text.rb +7 -9
  30. data/lib/pry/history.rb +15 -2
  31. data/lib/pry/hooks.rb +1 -1
  32. data/lib/pry/indent.rb +17 -10
  33. data/lib/pry/method.rb +35 -19
  34. data/lib/pry/module_candidate.rb +130 -0
  35. data/lib/pry/pry_class.rb +54 -22
  36. data/lib/pry/pry_instance.rb +71 -14
  37. data/lib/pry/repl_file_loader.rb +80 -0
  38. data/lib/pry/version.rb +1 -1
  39. data/lib/pry/wrapped_module.rb +121 -142
  40. data/pry.gemspec +13 -13
  41. data/test/candidate_helper1.rb +11 -0
  42. data/test/candidate_helper2.rb +8 -0
  43. data/test/helper.rb +16 -0
  44. data/test/test_code.rb +1 -1
  45. data/test/test_command.rb +364 -270
  46. data/test/test_command_integration.rb +235 -267
  47. data/test/test_completion.rb +36 -0
  48. data/test/test_control_d_handler.rb +45 -0
  49. data/test/test_default_commands/example.erb +5 -0
  50. data/test/test_default_commands/test_cd.rb +316 -11
  51. data/test/test_default_commands/test_context.rb +143 -192
  52. data/test/test_default_commands/test_documentation.rb +81 -14
  53. data/test/test_default_commands/test_find_method.rb +10 -2
  54. data/test/test_default_commands/test_input.rb +102 -111
  55. data/test/test_default_commands/test_introspection.rb +17 -12
  56. data/test/test_default_commands/test_ls.rb +8 -6
  57. data/test/test_default_commands/test_shell.rb +18 -15
  58. data/test/test_default_commands/test_show_source.rb +170 -44
  59. data/test/test_exception_whitelist.rb +6 -2
  60. data/test/test_hooks.rb +32 -0
  61. data/test/test_input_stack.rb +19 -16
  62. data/test/test_method.rb +0 -4
  63. data/test/test_prompt.rb +60 -0
  64. data/test/test_pry.rb +23 -31
  65. data/test/test_pry_defaults.rb +75 -57
  66. data/test/test_syntax_checking.rb +12 -11
  67. data/test/test_wrapped_module.rb +103 -0
  68. metadata +72 -26
@@ -1,5 +1,9 @@
1
1
  require 'helper'
2
+
2
3
  describe Pry do
4
+ before do
5
+ @str_output = StringIO.new
6
+ end
3
7
 
4
8
  [
5
9
  ["p = '", "'"],
@@ -11,12 +15,11 @@ describe Pry do
11
15
  ["pouts(<<HI, 'foo", "bar", "HI", "baz')"],
12
16
  ].each do |foo|
13
17
  it "should not raise an error on broken lines: #{foo.join("\\n")}" do
14
- output = StringIO.new
15
- redirect_pry_io(InputTester.new(*foo), output) do
18
+ redirect_pry_io(InputTester.new(*foo), @str_output) do
16
19
  Pry.start
17
20
  end
18
21
 
19
- output.string.should.not =~ /SyntaxError/
22
+ @str_output.string.should.not =~ /SyntaxError/
20
23
  end
21
24
  end
22
25
 
@@ -30,25 +33,24 @@ describe Pry do
30
33
  ["o = Object.new.tap{ def o.render;","'MEH'", "}"] # in this case the syntax error is "expecting keyword_end".
31
34
  ]).compact.each do |foo|
32
35
  it "should raise an error on invalid syntax like #{foo.inspect}" do
33
- output = StringIO.new
34
- redirect_pry_io(InputTester.new(*foo), output) do
36
+ redirect_pry_io(InputTester.new(*foo), @str_output) do
35
37
  Pry.start
36
38
  end
37
- output.string.should =~ /SyntaxError/
39
+
40
+ @str_output.string.should =~ /SyntaxError/
38
41
  end
39
42
  end
40
43
 
41
44
  it "should not intefere with syntax errors explicitly raised" do
42
- output = StringIO.new
43
- redirect_pry_io(InputTester.new(%q{raise SyntaxError, "unexpected $end"}), output) do
45
+ redirect_pry_io(InputTester.new(%q{raise SyntaxError, "unexpected $end"}), @str_output) do
44
46
  Pry.start
45
47
  end
46
- output.string.should =~ /SyntaxError/
48
+
49
+ @str_output.string.should =~ /SyntaxError/
47
50
  end
48
51
 
49
52
  it "should allow trailing , to continue the line" do
50
53
  pry = Pry.new
51
-
52
54
  Pry::Code.complete_expression?("puts 1, 2,").should == false
53
55
  end
54
56
 
@@ -58,7 +60,6 @@ describe Pry do
58
60
  end
59
61
 
60
62
  it "should not clobber _ex_ on a SyntaxError in the repl" do
61
-
62
63
  mock_pry("raise RuntimeError, 'foo';", "puts foo)", "_ex_.is_a?(RuntimeError)").should =~ /^RuntimeError.*\nSyntaxError.*\n=> true/m
63
64
  end
64
65
  end
@@ -8,6 +8,109 @@ describe Pry::WrappedModule do
8
8
  end
9
9
  end
10
10
 
11
+ describe "candidates" do
12
+ before do
13
+ class Host
14
+ source_files = [File.join(File.dirname(__FILE__), "candidate_helper1.rb"),
15
+ File.join(File.dirname(__FILE__), "candidate_helper2.rb")]
16
+
17
+ source_files.each do |file|
18
+ binding.eval File.read(file), file, 1
19
+ end
20
+
21
+ # rank 2
22
+ class CandidateTest
23
+ def test6
24
+ end
25
+ end
26
+
27
+ class ForeverAlone
28
+ end
29
+ end
30
+ end
31
+
32
+ describe "number_of_candidates" do
33
+ it 'should return the correct number of candidates' do
34
+ Pry::WrappedModule(Host::CandidateTest).number_of_candidates.should == 3
35
+ end
36
+
37
+ it 'should return 0 candidates for a class with no methods and no other definitions' do
38
+ Pry::WrappedModule(Host::ForeverAlone).number_of_candidates.should == 0
39
+ end
40
+ end
41
+
42
+ describe "ordering of candidates" do
43
+ it 'should return class with largest number of methods as primary candidate' do
44
+ Pry::WrappedModule(Host::CandidateTest).candidate(0).file.should =~ /helper1/
45
+ end
46
+
47
+ it 'should return class with second largest number of methods as second ranked candidate' do
48
+ Pry::WrappedModule(Host::CandidateTest).candidate(1).file.should =~ /helper2/
49
+ end
50
+
51
+ it 'should return class with third largest number of methods as third ranked candidate' do
52
+ Pry::WrappedModule(Host::CandidateTest).candidate(2).file.should =~ /#{__FILE__}/
53
+ end
54
+
55
+ it 'should raise when trying to access non-existent candidate' do
56
+ lambda { Pry::WrappedModule(Host::CandidateTest).candidate(3) }.should.raise Pry::CommandError
57
+ end
58
+ end
59
+
60
+ describe "source_location" do
61
+ it 'should return primary candidates source_location by default' do
62
+ wm = Pry::WrappedModule(Host::CandidateTest)
63
+ wm.source_location.should == wm.candidate(0).source_location
64
+ end
65
+
66
+ it 'should return nil if no source_location can be found' do
67
+ Pry::WrappedModule(Host::ForeverAlone).source_location.should == nil
68
+ end
69
+ end
70
+
71
+ describe "source" do
72
+ it 'should return primary candidates source by default' do
73
+ wm = Pry::WrappedModule(Host::CandidateTest)
74
+ wm.source.should == wm.candidate(0).source
75
+ end
76
+
77
+ it 'should return source for highest ranked candidate' do
78
+ Pry::WrappedModule(Host::CandidateTest).candidate(0).source.should =~ /test1/
79
+ end
80
+
81
+ it 'should return source for second ranked candidate' do
82
+ Pry::WrappedModule(Host::CandidateTest).candidate(1).source.should =~ /test4/
83
+ end
84
+
85
+ it 'should return source for third ranked candidate' do
86
+ Pry::WrappedModule(Host::CandidateTest).candidate(2).source.should =~ /test6/
87
+ end
88
+ end
89
+
90
+ describe "doc" do
91
+ it 'should return primary candidates doc by default' do
92
+ wm = Pry::WrappedModule(Host::CandidateTest)
93
+ wm.doc.should == wm.candidate(0).doc
94
+ end
95
+
96
+ it 'should return doc for highest ranked candidate' do
97
+ Pry::WrappedModule(Host::CandidateTest).candidate(0).doc.should =~ /rank 0/
98
+ end
99
+
100
+ it 'should return doc for second ranked candidate' do
101
+ Pry::WrappedModule(Host::CandidateTest).candidate(1).doc.should =~ /rank 1/
102
+ end
103
+
104
+ it 'should return doc for third ranked candidate' do
105
+ Pry::WrappedModule(Host::CandidateTest).candidate(2).doc.should =~ /rank 2/
106
+ end
107
+ end
108
+
109
+ after do
110
+ Object.remove_const(:Host)
111
+ end
112
+ end
113
+
11
114
  describe ".method_prefix" do
12
115
  before do
13
116
  Foo = Class.new
metadata CHANGED
@@ -1,8 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pry
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.9.6pre2
5
- prerelease: 7
4
+ version: 0.9.10
5
+ prerelease:
6
6
  platform: java
7
7
  authors:
8
8
  - John Mair (banisterfiend)
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-05-10 00:00:00.000000000 Z
13
+ date: 2012-07-15 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: coderay
17
- requirement: &70365490043400 !ruby/object:Gem::Requirement
17
+ requirement: !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ~>
@@ -22,35 +22,47 @@ dependencies:
22
22
  version: 1.0.5
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *70365490043400
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ~>
29
+ - !ruby/object:Gem::Version
30
+ version: 1.0.5
26
31
  - !ruby/object:Gem::Dependency
27
32
  name: slop
28
- requirement: &70365490042760 !ruby/object:Gem::Requirement
33
+ requirement: !ruby/object:Gem::Requirement
29
34
  none: false
30
35
  requirements:
31
- - - ! '>='
32
- - !ruby/object:Gem::Version
33
- version: 2.4.4
34
- - - <
36
+ - - ~>
35
37
  - !ruby/object:Gem::Version
36
- version: '3'
38
+ version: 3.3.1
37
39
  type: :runtime
38
40
  prerelease: false
39
- version_requirements: *70365490042760
41
+ version_requirements: !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ~>
45
+ - !ruby/object:Gem::Version
46
+ version: 3.3.1
40
47
  - !ruby/object:Gem::Dependency
41
48
  name: method_source
42
- requirement: &70365490041940 !ruby/object:Gem::Requirement
49
+ requirement: !ruby/object:Gem::Requirement
43
50
  none: false
44
51
  requirements:
45
52
  - - ~>
46
53
  - !ruby/object:Gem::Version
47
- version: 0.7.1
54
+ version: '0.8'
48
55
  type: :runtime
49
56
  prerelease: false
50
- version_requirements: *70365490041940
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ none: false
59
+ requirements:
60
+ - - ~>
61
+ - !ruby/object:Gem::Version
62
+ version: '0.8'
51
63
  - !ruby/object:Gem::Dependency
52
64
  name: bacon
53
- requirement: &70365490041400 !ruby/object:Gem::Requirement
65
+ requirement: !ruby/object:Gem::Requirement
54
66
  none: false
55
67
  requirements:
56
68
  - - ~>
@@ -58,10 +70,15 @@ dependencies:
58
70
  version: '1.1'
59
71
  type: :development
60
72
  prerelease: false
61
- version_requirements: *70365490041400
73
+ version_requirements: !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ~>
77
+ - !ruby/object:Gem::Version
78
+ version: '1.1'
62
79
  - !ruby/object:Gem::Dependency
63
80
  name: open4
64
- requirement: &70365490040860 !ruby/object:Gem::Requirement
81
+ requirement: !ruby/object:Gem::Requirement
65
82
  none: false
66
83
  requirements:
67
84
  - - ~>
@@ -69,10 +86,15 @@ dependencies:
69
86
  version: '1.3'
70
87
  type: :development
71
88
  prerelease: false
72
- version_requirements: *70365490040860
89
+ version_requirements: !ruby/object:Gem::Requirement
90
+ none: false
91
+ requirements:
92
+ - - ~>
93
+ - !ruby/object:Gem::Version
94
+ version: '1.3'
73
95
  - !ruby/object:Gem::Dependency
74
96
  name: rake
75
- requirement: &70365490040380 !ruby/object:Gem::Requirement
97
+ requirement: !ruby/object:Gem::Requirement
76
98
  none: false
77
99
  requirements:
78
100
  - - ~>
@@ -80,10 +102,15 @@ dependencies:
80
102
  version: '0.9'
81
103
  type: :development
82
104
  prerelease: false
83
- version_requirements: *70365490040380
105
+ version_requirements: !ruby/object:Gem::Requirement
106
+ none: false
107
+ requirements:
108
+ - - ~>
109
+ - !ruby/object:Gem::Version
110
+ version: '0.9'
84
111
  - !ruby/object:Gem::Dependency
85
112
  name: spoon
86
- requirement: &70365490039760 !ruby/object:Gem::Requirement
113
+ requirement: !ruby/object:Gem::Requirement
87
114
  none: false
88
115
  requirements:
89
116
  - - ~>
@@ -91,7 +118,12 @@ dependencies:
91
118
  version: '0.0'
92
119
  type: :runtime
93
120
  prerelease: false
94
- version_requirements: *70365490039760
121
+ version_requirements: !ruby/object:Gem::Requirement
122
+ none: false
123
+ requirements:
124
+ - - ~>
125
+ - !ruby/object:Gem::Version
126
+ version: '0.0'
95
127
  description: An IRB alternative and runtime developer console
96
128
  email:
97
129
  - jrmair@gmail.com
@@ -142,6 +174,7 @@ files:
142
174
  - lib/pry/default_commands/editing.rb
143
175
  - lib/pry/default_commands/find_method.rb
144
176
  - lib/pry/default_commands/gems.rb
177
+ - lib/pry/default_commands/gist.rb
145
178
  - lib/pry/default_commands/help.rb
146
179
  - lib/pry/default_commands/hist.rb
147
180
  - lib/pry/default_commands/input_and_output.rb
@@ -149,6 +182,7 @@ files:
149
182
  - lib/pry/default_commands/ls.rb
150
183
  - lib/pry/default_commands/misc.rb
151
184
  - lib/pry/default_commands/navigating_pry.rb
185
+ - lib/pry/default_commands/whereami.rb
152
186
  - lib/pry/extended_commands/experimental.rb
153
187
  - lib/pry/helpers.rb
154
188
  - lib/pry/helpers/base_helpers.rb
@@ -161,17 +195,21 @@ files:
161
195
  - lib/pry/hooks.rb
162
196
  - lib/pry/indent.rb
163
197
  - lib/pry/method.rb
198
+ - lib/pry/module_candidate.rb
164
199
  - lib/pry/plugins.rb
165
200
  - lib/pry/pry_class.rb
166
201
  - lib/pry/pry_instance.rb
167
202
  - lib/pry/rbx_method.rb
168
203
  - lib/pry/rbx_path.rb
204
+ - lib/pry/repl_file_loader.rb
169
205
  - lib/pry/version.rb
170
206
  - lib/pry/wrapped_module.rb
171
207
  - man/pry.1
172
208
  - man/pry.1.html
173
209
  - man/pry.1.ronn
174
210
  - pry.gemspec
211
+ - test/candidate_helper1.rb
212
+ - test/candidate_helper2.rb
175
213
  - test/helper.rb
176
214
  - test/test_cli.rb
177
215
  - test/test_code.rb
@@ -180,6 +218,8 @@ files:
180
218
  - test/test_command_integration.rb
181
219
  - test/test_command_set.rb
182
220
  - test/test_completion.rb
221
+ - test/test_control_d_handler.rb
222
+ - test/test_default_commands/example.erb
183
223
  - test/test_default_commands/test_cd.rb
184
224
  - test/test_default_commands/test_context.rb
185
225
  - test/test_default_commands/test_documentation.rb
@@ -197,6 +237,7 @@ files:
197
237
  - test/test_indent.rb
198
238
  - test/test_input_stack.rb
199
239
  - test/test_method.rb
240
+ - test/test_prompt.rb
200
241
  - test/test_pry.rb
201
242
  - test/test_pry_defaults.rb
202
243
  - test/test_pry_history.rb
@@ -223,16 +264,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
223
264
  required_rubygems_version: !ruby/object:Gem::Requirement
224
265
  none: false
225
266
  requirements:
226
- - - ! '>'
267
+ - - ! '>='
227
268
  - !ruby/object:Gem::Version
228
- version: 1.3.1
269
+ version: '0'
229
270
  requirements: []
230
271
  rubyforge_project:
231
- rubygems_version: 1.8.16
272
+ rubygems_version: 1.8.24
232
273
  signing_key:
233
274
  specification_version: 3
234
275
  summary: An IRB alternative and runtime developer console
235
276
  test_files:
277
+ - test/candidate_helper1.rb
278
+ - test/candidate_helper2.rb
236
279
  - test/helper.rb
237
280
  - test/test_cli.rb
238
281
  - test/test_code.rb
@@ -241,6 +284,8 @@ test_files:
241
284
  - test/test_command_integration.rb
242
285
  - test/test_command_set.rb
243
286
  - test/test_completion.rb
287
+ - test/test_control_d_handler.rb
288
+ - test/test_default_commands/example.erb
244
289
  - test/test_default_commands/test_cd.rb
245
290
  - test/test_default_commands/test_context.rb
246
291
  - test/test_default_commands/test_documentation.rb
@@ -258,6 +303,7 @@ test_files:
258
303
  - test/test_indent.rb
259
304
  - test/test_input_stack.rb
260
305
  - test/test_method.rb
306
+ - test/test_prompt.rb
261
307
  - test/test_pry.rb
262
308
  - test/test_pry_defaults.rb
263
309
  - test/test_pry_history.rb