pry 0.9.0pre3-java → 0.9.4pre2-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. data/.gitignore +1 -0
  2. data/CHANGELOG +84 -6
  3. data/CONTRIBUTORS +13 -0
  4. data/README.markdown +23 -183
  5. data/Rakefile +22 -19
  6. data/TODO +36 -6
  7. data/bin/pry +12 -1
  8. data/lib/pry.rb +60 -12
  9. data/lib/pry/command_context.rb +21 -0
  10. data/lib/pry/command_processor.rb +62 -16
  11. data/lib/pry/command_set.rb +25 -11
  12. data/lib/pry/commands.rb +0 -3
  13. data/lib/pry/completion.rb +6 -6
  14. data/lib/pry/config.rb +25 -5
  15. data/lib/pry/default_commands/basic.rb +27 -6
  16. data/lib/pry/default_commands/context.rb +84 -35
  17. data/lib/pry/default_commands/documentation.rb +69 -31
  18. data/lib/pry/default_commands/easter_eggs.rb +5 -0
  19. data/lib/pry/default_commands/input.rb +193 -56
  20. data/lib/pry/default_commands/introspection.rb +98 -50
  21. data/lib/pry/default_commands/ls.rb +51 -21
  22. data/lib/pry/default_commands/shell.rb +57 -13
  23. data/lib/pry/extended_commands/experimental.rb +0 -32
  24. data/lib/pry/extended_commands/user_command_api.rb +33 -2
  25. data/lib/pry/helpers/base_helpers.rb +30 -10
  26. data/lib/pry/helpers/command_helpers.rb +75 -16
  27. data/lib/pry/helpers/text.rb +12 -11
  28. data/lib/pry/history.rb +61 -0
  29. data/lib/pry/plugins.rb +23 -12
  30. data/lib/pry/pry_class.rb +51 -50
  31. data/lib/pry/pry_instance.rb +129 -119
  32. data/lib/pry/version.rb +1 -1
  33. data/pry.gemspec +46 -0
  34. data/test/helper.rb +37 -3
  35. data/test/test_command_processor.rb +62 -19
  36. data/test/test_command_set.rb +40 -2
  37. data/test/test_completion.rb +27 -0
  38. data/test/test_default_commands/test_context.rb +185 -1
  39. data/test/test_default_commands/test_documentation.rb +10 -0
  40. data/test/test_default_commands/test_input.rb +207 -11
  41. data/test/test_default_commands/test_introspection.rb +20 -1
  42. data/test/test_default_commands/test_shell.rb +18 -0
  43. data/test/test_pry.rb +261 -45
  44. data/test/test_pry_history.rb +82 -0
  45. data/test/test_pry_output.rb +44 -0
  46. data/test/test_special_locals.rb +35 -0
  47. metadata +185 -159
@@ -0,0 +1,82 @@
1
+ require 'helper'
2
+ require 'tempfile'
3
+
4
+ describe Pry do
5
+
6
+ before do
7
+ Pry.history.clear
8
+ @hist = Tempfile.new(["tmp", ".pry_history"]).tap(&:close).path
9
+ File.open(@hist, 'w') {|f| f << "1\n2\n3\n" }
10
+ @old_hist = Pry.config.history.file
11
+ Pry.config.history.file = @hist
12
+ Pry.load_history
13
+ end
14
+
15
+ after do
16
+ File.unlink @hist
17
+ Pry.config.history.file = @old_hist
18
+ end
19
+
20
+ describe ".load_history" do
21
+ it "should read the contents of the file" do
22
+ Pry.history.to_a[-2..-1].should === ["2", "3"]
23
+ end
24
+ end
25
+
26
+ describe ".save_history" do
27
+ it "should include a trailing newline" do
28
+ Pry.history << "4"
29
+ Pry.save_history
30
+ File.read(@hist).should =~ /4\n\z/
31
+ end
32
+
33
+ it "should not change anything if history is not changed" do
34
+ File.open(@hist, 'w') {|f| f << "4\n5\n6\n" }
35
+ Pry.save_history
36
+ File.read(@hist).should == "4\n5\n6\n"
37
+ end
38
+
39
+ it "should append new lines to the file" do
40
+ Pry.history << "4"
41
+ Pry.save_history
42
+ File.read(@hist).should == "1\n2\n3\n4\n"
43
+ end
44
+
45
+ it "should not clobber lines written by other Pry's in the meantime" do
46
+ Pry.history << "5"
47
+ File.open(@hist, 'a') {|f| f << "4\n" }
48
+ Pry.save_history
49
+
50
+ Pry.history.to_a[-3..-1].should == ["2", "3", "5"]
51
+ File.read(@hist).should == "1\n2\n3\n4\n5\n"
52
+ end
53
+
54
+ it "should not delete lines from the file if this session's history was cleared" do
55
+ Pry.history.clear
56
+ Pry.save_history
57
+ File.read(@hist).should == "1\n2\n3\n"
58
+ end
59
+
60
+ it "should save new lines that are added after the history was cleared" do
61
+ Pry.history.clear
62
+ Pry.history << "4"
63
+
64
+ # doing this twice as libedit on 1.8.7 has bugs and sometimes ignores the
65
+ # first line in history
66
+ Pry.history << "4"
67
+ Pry.save_history
68
+ File.read(@hist).should =~ /1\n2\n3\n4\n/
69
+ end
70
+
71
+ it "should only append new lines the second time it is saved" do
72
+ Pry.history << "4"
73
+ Pry.save_history
74
+ File.open(@hist, 'a') {|f| f << "5\n" }
75
+ Pry.history << "6"
76
+ Pry.save_history
77
+
78
+ Pry.history.to_a[-4..-1].should == ["2", "3", "4", "6"]
79
+ File.read(@hist).should == "1\n2\n3\n4\n5\n6\n"
80
+ end
81
+ end
82
+ end
@@ -0,0 +1,44 @@
1
+
2
+ describe Pry do
3
+ describe "output failsafe" do
4
+ after do
5
+ Pry.config.print = Pry::DEFAULT_PRINT
6
+ end
7
+
8
+ it "should catch serialization exceptions" do
9
+ Pry.config.print = lambda { |*a| raise "catch-22" }
10
+
11
+ lambda {
12
+ mock_pry("1")
13
+ }.should.not.raise
14
+ end
15
+
16
+ it "should display serialization exceptions" do
17
+ Pry.config.print = lambda { |*a| raise "catch-22" }
18
+
19
+ mock_pry("1").should =~ /output error: #<RuntimeError: catch-22>/
20
+ end
21
+
22
+ it "should catch errors serializing exceptions" do
23
+ Pry.config.print = lambda do |*a|
24
+ raise Exception.new("catch-22").tap{ |e| class << e; def inspect; raise e; end; end }
25
+ end
26
+
27
+ mock_pry("1").should =~ /output error: failed to show result/
28
+ end
29
+ end
30
+
31
+ describe "DEFAULT_PRINT" do
32
+ it "should output the right thing" do
33
+ mock_pry("{:a => 1}").should =~ /\{:a=>1\}/
34
+ end
35
+
36
+ it "should not be phased by un-inspectable things" do
37
+ mock_pry("class NastyClass; undef pretty_inspect; end", "NastyClass.new").should =~ /#<NastyClass:0x[0-9a-f]+>/
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
+ end
44
+ end
@@ -0,0 +1,35 @@
1
+ require 'helper'
2
+
3
+ describe "Special locals (_file_ and friends)" do
4
+ it 'locals should all exist upon initialization' do
5
+ mock_pry("_file_").should.not =~ /NameError/
6
+ mock_pry("_dir_").should.not =~ /NameError/
7
+ mock_pry("_ex_").should.not =~ /NameError/
8
+ mock_pry("_pry_").should.not =~ /NameError/
9
+ mock_pry("_").should.not =~ /NameError/
10
+ end
11
+
12
+ it 'locals should still exist after cd-ing into a new context' do
13
+ mock_pry("cd 0", "_file_").should.not =~ /NameError/
14
+ mock_pry("cd 0","_dir_").should.not =~ /NameError/
15
+ mock_pry("cd 0","_ex_").should.not =~ /NameError/
16
+ mock_pry("cd 0","_pry_").should.not =~ /NameError/
17
+ mock_pry("cd 0","_").should.not =~ /NameError/
18
+ end
19
+
20
+ it 'locals should keep value after cd-ing(_pry_ and _ex_)' do
21
+ mock_pry("$x = _pry_;", "cd 0", "_pry_ == $x").should =~ /true/
22
+ mock_pry("error blah;", "$x = _ex_;", "cd 0", "_ex_ == $x").should =~ /true/
23
+ end
24
+
25
+ it 'locals should keep value after cd-ing (_file_ and _dir_)' do
26
+ Pry.commands.command "file-and-dir-test" do
27
+ set_file_and_dir_locals("/blah/ostrich.rb")
28
+ end
29
+
30
+ mock_pry("file-and-dir-test", "cd 0", "_file_").should =~ /\/blah\/ostrich\.rb/
31
+ a = mock_pry("file-and-dir-test", "cd 0", "_dir_").should =~ /\/blah/
32
+ Pry.commands.delete "file-and-dir-test"
33
+ end
34
+
35
+ end
metadata CHANGED
@@ -2,194 +2,220 @@
2
2
  name: pry
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease: 5
5
- version: 0.9.0pre3
5
+ version: 0.9.4pre2
6
6
  platform: java
7
7
  authors:
8
- - John Mair (banisterfiend)
8
+ - John Mair (banisterfiend)
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-06-09 00:00:00 Z
13
+ date: 2011-09-07 00:00:00 +12:00
14
+ default_executable:
14
15
  dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: ruby_parser
17
- prerelease: false
18
- requirement: &id001 !ruby/object:Gem::Requirement
19
- none: false
20
- requirements:
21
- - - ">="
22
- - !ruby/object:Gem::Version
23
- version: 2.0.5
24
- type: :runtime
25
- version_requirements: *id001
26
- - !ruby/object:Gem::Dependency
27
- name: coderay
28
- prerelease: false
29
- requirement: &id002 !ruby/object:Gem::Requirement
30
- none: false
31
- requirements:
32
- - - ">="
33
- - !ruby/object:Gem::Version
34
- version: 0.9.8
35
- type: :runtime
36
- version_requirements: *id002
37
- - !ruby/object:Gem::Dependency
38
- name: slop
39
- prerelease: false
40
- requirement: &id003 !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ~>
44
- - !ruby/object:Gem::Version
45
- version: 1.6.0
46
- type: :runtime
47
- version_requirements: *id003
48
- - !ruby/object:Gem::Dependency
49
- name: method_source
50
- prerelease: false
51
- requirement: &id004 !ruby/object:Gem::Requirement
52
- none: false
53
- requirements:
54
- - - ">="
55
- - !ruby/object:Gem::Version
56
- version: 0.4.0
57
- type: :runtime
58
- version_requirements: *id004
59
- - !ruby/object:Gem::Dependency
60
- name: bacon
61
- prerelease: false
62
- requirement: &id005 !ruby/object:Gem::Requirement
63
- none: false
64
- requirements:
65
- - - ">="
66
- - !ruby/object:Gem::Version
67
- version: 1.1.0
68
- type: :development
69
- version_requirements: *id005
70
- - !ruby/object:Gem::Dependency
71
- name: open4
72
- prerelease: false
73
- requirement: &id006 !ruby/object:Gem::Requirement
74
- none: false
75
- requirements:
76
- - - ~>
77
- - !ruby/object:Gem::Version
78
- version: 1.0.1
79
- type: :development
80
- version_requirements: *id006
81
- description: an IRB alternative and runtime developer console
16
+ - !ruby/object:Gem::Dependency
17
+ name: ruby_parser
18
+ prerelease: false
19
+ requirement: &id001 !ruby/object:Gem::Requirement
20
+ none: false
21
+ requirements:
22
+ - - ">="
23
+ - !ruby/object:Gem::Version
24
+ version: 2.0.5
25
+ type: :runtime
26
+ version_requirements: *id001
27
+ - !ruby/object:Gem::Dependency
28
+ name: coderay
29
+ prerelease: false
30
+ requirement: &id002 !ruby/object:Gem::Requirement
31
+ none: false
32
+ requirements:
33
+ - - ">="
34
+ - !ruby/object:Gem::Version
35
+ version: 0.9.8
36
+ type: :runtime
37
+ version_requirements: *id002
38
+ - !ruby/object:Gem::Dependency
39
+ name: slop
40
+ prerelease: false
41
+ requirement: &id003 !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ~>
45
+ - !ruby/object:Gem::Version
46
+ version: 2.1.0
47
+ type: :runtime
48
+ version_requirements: *id003
49
+ - !ruby/object:Gem::Dependency
50
+ name: method_source
51
+ prerelease: false
52
+ requirement: &id004 !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ version: 0.6.5
58
+ type: :runtime
59
+ version_requirements: *id004
60
+ - !ruby/object:Gem::Dependency
61
+ name: bacon
62
+ prerelease: false
63
+ requirement: &id005 !ruby/object:Gem::Requirement
64
+ none: false
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: 1.1.0
69
+ type: :development
70
+ version_requirements: *id005
71
+ - !ruby/object:Gem::Dependency
72
+ name: open4
73
+ prerelease: false
74
+ requirement: &id006 !ruby/object:Gem::Requirement
75
+ none: false
76
+ requirements:
77
+ - - ~>
78
+ - !ruby/object:Gem::Version
79
+ version: 1.0.1
80
+ type: :development
81
+ version_requirements: *id006
82
+ - !ruby/object:Gem::Dependency
83
+ name: spoon
84
+ prerelease: false
85
+ requirement: &id007 !ruby/object:Gem::Requirement
86
+ none: false
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: 0.0.1
91
+ type: :runtime
92
+ version_requirements: *id007
93
+ description: An IRB alternative and runtime developer console
82
94
  email: jrmair@gmail.com
83
95
  executables:
84
- - pry
96
+ - pry
85
97
  extensions: []
86
98
 
87
99
  extra_rdoc_files: []
88
100
 
89
101
  files:
90
- - .document
91
- - .gemtest
92
- - .gitignore
93
- - .yardopts
94
- - CHANGELOG
95
- - LICENSE
96
- - README.markdown
97
- - Rakefile
98
- - TODO
99
- - bin/pry
100
- - examples/example_basic.rb
101
- - examples/example_command_override.rb
102
- - examples/example_commands.rb
103
- - examples/example_hooks.rb
104
- - examples/example_image_edit.rb
105
- - examples/example_input.rb
106
- - examples/example_input2.rb
107
- - examples/example_output.rb
108
- - examples/example_print.rb
109
- - examples/example_prompt.rb
110
- - examples/helper.rb
111
- - lib/pry.rb
112
- - lib/pry/command_context.rb
113
- - lib/pry/command_processor.rb
114
- - lib/pry/command_set.rb
115
- - lib/pry/commands.rb
116
- - lib/pry/completion.rb
117
- - lib/pry/config.rb
118
- - lib/pry/core_extensions.rb
119
- - lib/pry/custom_completions.rb
120
- - lib/pry/default_commands/basic.rb
121
- - lib/pry/default_commands/context.rb
122
- - lib/pry/default_commands/documentation.rb
123
- - lib/pry/default_commands/easter_eggs.rb
124
- - lib/pry/default_commands/gems.rb
125
- - lib/pry/default_commands/input.rb
126
- - lib/pry/default_commands/introspection.rb
127
- - lib/pry/default_commands/ls.rb
128
- - lib/pry/default_commands/shell.rb
129
- - lib/pry/extended_commands/experimental.rb
130
- - lib/pry/extended_commands/user_command_api.rb
131
- - lib/pry/helpers.rb
132
- - lib/pry/helpers/base_helpers.rb
133
- - lib/pry/helpers/command_helpers.rb
134
- - lib/pry/helpers/text.rb
135
- - lib/pry/history_array.rb
136
- - lib/pry/plugins.rb
137
- - lib/pry/pry_class.rb
138
- - lib/pry/pry_instance.rb
139
- - lib/pry/version.rb
140
- - test/helper.rb
141
- - test/test_command_helpers.rb
142
- - test/test_command_processor.rb
143
- - test/test_command_set.rb
144
- - test/test_default_commands.rb
145
- - test/test_default_commands/test_context.rb
146
- - test/test_default_commands/test_documentation.rb
147
- - test/test_default_commands/test_gems.rb
148
- - test/test_default_commands/test_input.rb
149
- - test/test_default_commands/test_introspection.rb
150
- - test/test_history_array.rb
151
- - test/test_pry.rb
152
- - test/testrc
153
- - wiki/Customizing-pry.md
154
- - wiki/Home.md
155
- homepage: http://banisterfiend.wordpress.com
102
+ - .document
103
+ - .gemtest
104
+ - .gitignore
105
+ - .yardopts
106
+ - CHANGELOG
107
+ - CONTRIBUTORS
108
+ - LICENSE
109
+ - README.markdown
110
+ - Rakefile
111
+ - TODO
112
+ - bin/pry
113
+ - examples/example_basic.rb
114
+ - examples/example_command_override.rb
115
+ - examples/example_commands.rb
116
+ - examples/example_hooks.rb
117
+ - examples/example_image_edit.rb
118
+ - examples/example_input.rb
119
+ - examples/example_input2.rb
120
+ - examples/example_output.rb
121
+ - examples/example_print.rb
122
+ - examples/example_prompt.rb
123
+ - examples/helper.rb
124
+ - lib/pry.rb
125
+ - lib/pry/command_context.rb
126
+ - lib/pry/command_processor.rb
127
+ - lib/pry/command_set.rb
128
+ - lib/pry/commands.rb
129
+ - lib/pry/completion.rb
130
+ - lib/pry/config.rb
131
+ - lib/pry/core_extensions.rb
132
+ - lib/pry/custom_completions.rb
133
+ - lib/pry/default_commands/basic.rb
134
+ - lib/pry/default_commands/context.rb
135
+ - lib/pry/default_commands/documentation.rb
136
+ - lib/pry/default_commands/easter_eggs.rb
137
+ - lib/pry/default_commands/gems.rb
138
+ - lib/pry/default_commands/input.rb
139
+ - lib/pry/default_commands/introspection.rb
140
+ - lib/pry/default_commands/ls.rb
141
+ - lib/pry/default_commands/shell.rb
142
+ - lib/pry/extended_commands/experimental.rb
143
+ - lib/pry/extended_commands/user_command_api.rb
144
+ - lib/pry/helpers.rb
145
+ - lib/pry/helpers/base_helpers.rb
146
+ - lib/pry/helpers/command_helpers.rb
147
+ - lib/pry/helpers/text.rb
148
+ - lib/pry/history.rb
149
+ - lib/pry/history_array.rb
150
+ - lib/pry/plugins.rb
151
+ - lib/pry/pry_class.rb
152
+ - lib/pry/pry_instance.rb
153
+ - lib/pry/version.rb
154
+ - pry.gemspec
155
+ - test/helper.rb
156
+ - test/test_command_helpers.rb
157
+ - test/test_command_processor.rb
158
+ - test/test_command_set.rb
159
+ - test/test_completion.rb
160
+ - test/test_default_commands.rb
161
+ - test/test_default_commands/test_context.rb
162
+ - test/test_default_commands/test_documentation.rb
163
+ - test/test_default_commands/test_gems.rb
164
+ - test/test_default_commands/test_input.rb
165
+ - test/test_default_commands/test_introspection.rb
166
+ - test/test_default_commands/test_shell.rb
167
+ - test/test_history_array.rb
168
+ - test/test_pry.rb
169
+ - test/test_pry_history.rb
170
+ - test/test_pry_output.rb
171
+ - test/test_special_locals.rb
172
+ - test/testrc
173
+ - wiki/Customizing-pry.md
174
+ - wiki/Home.md
175
+ has_rdoc: true
176
+ homepage: http://pry.github.com
156
177
  licenses: []
157
178
 
158
179
  post_install_message:
159
180
  rdoc_options: []
160
181
 
161
182
  require_paths:
162
- - lib
183
+ - lib
163
184
  required_ruby_version: !ruby/object:Gem::Requirement
164
185
  none: false
165
186
  requirements:
166
- - - ">="
167
- - !ruby/object:Gem::Version
168
- version: "0"
187
+ - - ">="
188
+ - !ruby/object:Gem::Version
189
+ version: "0"
169
190
  required_rubygems_version: !ruby/object:Gem::Requirement
170
191
  none: false
171
192
  requirements:
172
- - - ">"
173
- - !ruby/object:Gem::Version
174
- version: 1.3.1
193
+ - - ">"
194
+ - !ruby/object:Gem::Version
195
+ version: 1.3.1
175
196
  requirements: []
176
197
 
177
198
  rubyforge_project:
178
- rubygems_version: 1.7.2
199
+ rubygems_version: 1.5.1
179
200
  signing_key:
180
201
  specification_version: 3
181
- summary: an IRB alternative and runtime developer console
202
+ summary: An IRB alternative and runtime developer console
182
203
  test_files:
183
- - test/helper.rb
184
- - test/test_command_helpers.rb
185
- - test/test_command_processor.rb
186
- - test/test_command_set.rb
187
- - test/test_default_commands.rb
188
- - test/test_default_commands/test_context.rb
189
- - test/test_default_commands/test_documentation.rb
190
- - test/test_default_commands/test_gems.rb
191
- - test/test_default_commands/test_input.rb
192
- - test/test_default_commands/test_introspection.rb
193
- - test/test_history_array.rb
194
- - test/test_pry.rb
195
- - test/testrc
204
+ - test/helper.rb
205
+ - test/test_command_helpers.rb
206
+ - test/test_command_processor.rb
207
+ - test/test_command_set.rb
208
+ - test/test_completion.rb
209
+ - test/test_default_commands.rb
210
+ - test/test_default_commands/test_context.rb
211
+ - test/test_default_commands/test_documentation.rb
212
+ - test/test_default_commands/test_gems.rb
213
+ - test/test_default_commands/test_input.rb
214
+ - test/test_default_commands/test_introspection.rb
215
+ - test/test_default_commands/test_shell.rb
216
+ - test/test_history_array.rb
217
+ - test/test_pry.rb
218
+ - test/test_pry_history.rb
219
+ - test/test_pry_output.rb
220
+ - test/test_special_locals.rb
221
+ - test/testrc