pry 0.9.4pre1 → 0.9.4pre2

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 (39) hide show
  1. data/CHANGELOG +23 -0
  2. data/CONTRIBUTORS +13 -11
  3. data/README.markdown +2 -0
  4. data/Rakefile +16 -2
  5. data/TODO +8 -0
  6. data/lib/pry.rb +58 -9
  7. data/lib/pry/command_context.rb +11 -0
  8. data/lib/pry/command_processor.rb +43 -6
  9. data/lib/pry/command_set.rb +14 -4
  10. data/lib/pry/completion.rb +5 -5
  11. data/lib/pry/config.rb +6 -2
  12. data/lib/pry/default_commands/context.rb +83 -35
  13. data/lib/pry/default_commands/documentation.rb +37 -31
  14. data/lib/pry/default_commands/easter_eggs.rb +5 -0
  15. data/lib/pry/default_commands/input.rb +13 -10
  16. data/lib/pry/default_commands/introspection.rb +54 -40
  17. data/lib/pry/default_commands/shell.rb +9 -5
  18. data/lib/pry/helpers/base_helpers.rb +16 -5
  19. data/lib/pry/helpers/command_helpers.rb +41 -17
  20. data/lib/pry/helpers/text.rb +2 -1
  21. data/lib/pry/history.rb +61 -0
  22. data/lib/pry/plugins.rb +19 -8
  23. data/lib/pry/pry_class.rb +25 -62
  24. data/lib/pry/pry_instance.rb +105 -120
  25. data/lib/pry/version.rb +1 -1
  26. data/pry.gemspec +15 -14
  27. data/test/helper.rb +31 -0
  28. data/test/test_command_set.rb +7 -2
  29. data/test/test_completion.rb +7 -3
  30. data/test/test_default_commands/test_context.rb +185 -1
  31. data/test/test_default_commands/test_documentation.rb +10 -0
  32. data/test/test_default_commands/test_input.rb +16 -11
  33. data/test/test_default_commands/test_introspection.rb +10 -0
  34. data/test/test_default_commands/test_shell.rb +18 -0
  35. data/test/test_pry.rb +189 -40
  36. data/test/test_pry_history.rb +13 -13
  37. data/test/test_pry_output.rb +44 -0
  38. data/test/test_special_locals.rb +35 -0
  39. metadata +171 -162
@@ -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,160 +2,166 @@
2
2
  name: pry
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease: 5
5
- version: 0.9.4pre1
5
+ version: 0.9.4pre2
6
6
  platform: ruby
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-08-19 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.9.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.6.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
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
81
82
  description: An IRB alternative and runtime developer console
82
83
  email: jrmair@gmail.com
83
84
  executables:
84
- - pry
85
+ - pry
85
86
  extensions: []
86
87
 
87
88
  extra_rdoc_files: []
88
89
 
89
90
  files:
90
- - .document
91
- - .gemtest
92
- - .gitignore
93
- - .yardopts
94
- - CHANGELOG
95
- - CONTRIBUTORS
96
- - LICENSE
97
- - README.markdown
98
- - Rakefile
99
- - TODO
100
- - bin/pry
101
- - examples/example_basic.rb
102
- - examples/example_command_override.rb
103
- - examples/example_commands.rb
104
- - examples/example_hooks.rb
105
- - examples/example_image_edit.rb
106
- - examples/example_input.rb
107
- - examples/example_input2.rb
108
- - examples/example_output.rb
109
- - examples/example_print.rb
110
- - examples/example_prompt.rb
111
- - examples/helper.rb
112
- - lib/pry.rb
113
- - lib/pry/command_context.rb
114
- - lib/pry/command_processor.rb
115
- - lib/pry/command_set.rb
116
- - lib/pry/commands.rb
117
- - lib/pry/completion.rb
118
- - lib/pry/config.rb
119
- - lib/pry/core_extensions.rb
120
- - lib/pry/custom_completions.rb
121
- - lib/pry/default_commands/basic.rb
122
- - lib/pry/default_commands/context.rb
123
- - lib/pry/default_commands/documentation.rb
124
- - lib/pry/default_commands/easter_eggs.rb
125
- - lib/pry/default_commands/gems.rb
126
- - lib/pry/default_commands/input.rb
127
- - lib/pry/default_commands/introspection.rb
128
- - lib/pry/default_commands/ls.rb
129
- - lib/pry/default_commands/shell.rb
130
- - lib/pry/extended_commands/experimental.rb
131
- - lib/pry/extended_commands/user_command_api.rb
132
- - lib/pry/helpers.rb
133
- - lib/pry/helpers/base_helpers.rb
134
- - lib/pry/helpers/command_helpers.rb
135
- - lib/pry/helpers/text.rb
136
- - lib/pry/history_array.rb
137
- - lib/pry/plugins.rb
138
- - lib/pry/pry_class.rb
139
- - lib/pry/pry_instance.rb
140
- - lib/pry/version.rb
141
- - pry.gemspec
142
- - test/helper.rb
143
- - test/test_command_helpers.rb
144
- - test/test_command_processor.rb
145
- - test/test_command_set.rb
146
- - test/test_completion.rb
147
- - test/test_default_commands.rb
148
- - test/test_default_commands/test_context.rb
149
- - test/test_default_commands/test_documentation.rb
150
- - test/test_default_commands/test_gems.rb
151
- - test/test_default_commands/test_input.rb
152
- - test/test_default_commands/test_introspection.rb
153
- - test/test_history_array.rb
154
- - test/test_pry.rb
155
- - test/test_pry_history.rb
156
- - test/testrc
157
- - wiki/Customizing-pry.md
158
- - wiki/Home.md
91
+ - .document
92
+ - .gemtest
93
+ - .gitignore
94
+ - .yardopts
95
+ - CHANGELOG
96
+ - CONTRIBUTORS
97
+ - LICENSE
98
+ - README.markdown
99
+ - Rakefile
100
+ - TODO
101
+ - bin/pry
102
+ - examples/example_basic.rb
103
+ - examples/example_command_override.rb
104
+ - examples/example_commands.rb
105
+ - examples/example_hooks.rb
106
+ - examples/example_image_edit.rb
107
+ - examples/example_input.rb
108
+ - examples/example_input2.rb
109
+ - examples/example_output.rb
110
+ - examples/example_print.rb
111
+ - examples/example_prompt.rb
112
+ - examples/helper.rb
113
+ - lib/pry.rb
114
+ - lib/pry/command_context.rb
115
+ - lib/pry/command_processor.rb
116
+ - lib/pry/command_set.rb
117
+ - lib/pry/commands.rb
118
+ - lib/pry/completion.rb
119
+ - lib/pry/config.rb
120
+ - lib/pry/core_extensions.rb
121
+ - lib/pry/custom_completions.rb
122
+ - lib/pry/default_commands/basic.rb
123
+ - lib/pry/default_commands/context.rb
124
+ - lib/pry/default_commands/documentation.rb
125
+ - lib/pry/default_commands/easter_eggs.rb
126
+ - lib/pry/default_commands/gems.rb
127
+ - lib/pry/default_commands/input.rb
128
+ - lib/pry/default_commands/introspection.rb
129
+ - lib/pry/default_commands/ls.rb
130
+ - lib/pry/default_commands/shell.rb
131
+ - lib/pry/extended_commands/experimental.rb
132
+ - lib/pry/extended_commands/user_command_api.rb
133
+ - lib/pry/helpers.rb
134
+ - lib/pry/helpers/base_helpers.rb
135
+ - lib/pry/helpers/command_helpers.rb
136
+ - lib/pry/helpers/text.rb
137
+ - lib/pry/history.rb
138
+ - lib/pry/history_array.rb
139
+ - lib/pry/plugins.rb
140
+ - lib/pry/pry_class.rb
141
+ - lib/pry/pry_instance.rb
142
+ - lib/pry/version.rb
143
+ - pry.gemspec
144
+ - test/helper.rb
145
+ - test/test_command_helpers.rb
146
+ - test/test_command_processor.rb
147
+ - test/test_command_set.rb
148
+ - test/test_completion.rb
149
+ - test/test_default_commands.rb
150
+ - test/test_default_commands/test_context.rb
151
+ - test/test_default_commands/test_documentation.rb
152
+ - test/test_default_commands/test_gems.rb
153
+ - test/test_default_commands/test_input.rb
154
+ - test/test_default_commands/test_introspection.rb
155
+ - test/test_default_commands/test_shell.rb
156
+ - test/test_history_array.rb
157
+ - test/test_pry.rb
158
+ - test/test_pry_history.rb
159
+ - test/test_pry_output.rb
160
+ - test/test_special_locals.rb
161
+ - test/testrc
162
+ - wiki/Customizing-pry.md
163
+ - wiki/Home.md
164
+ has_rdoc: true
159
165
  homepage: http://pry.github.com
160
166
  licenses: []
161
167
 
@@ -163,39 +169,42 @@ post_install_message:
163
169
  rdoc_options: []
164
170
 
165
171
  require_paths:
166
- - lib
172
+ - lib
167
173
  required_ruby_version: !ruby/object:Gem::Requirement
168
174
  none: false
169
175
  requirements:
170
- - - ">="
171
- - !ruby/object:Gem::Version
172
- version: "0"
176
+ - - ">="
177
+ - !ruby/object:Gem::Version
178
+ version: "0"
173
179
  required_rubygems_version: !ruby/object:Gem::Requirement
174
180
  none: false
175
181
  requirements:
176
- - - ">"
177
- - !ruby/object:Gem::Version
178
- version: 1.3.1
182
+ - - ">"
183
+ - !ruby/object:Gem::Version
184
+ version: 1.3.1
179
185
  requirements: []
180
186
 
181
187
  rubyforge_project:
182
- rubygems_version: 1.7.2
188
+ rubygems_version: 1.5.1
183
189
  signing_key:
184
190
  specification_version: 3
185
191
  summary: An IRB alternative and runtime developer console
186
192
  test_files:
187
- - test/helper.rb
188
- - test/test_command_helpers.rb
189
- - test/test_command_processor.rb
190
- - test/test_command_set.rb
191
- - test/test_completion.rb
192
- - test/test_default_commands.rb
193
- - test/test_default_commands/test_context.rb
194
- - test/test_default_commands/test_documentation.rb
195
- - test/test_default_commands/test_gems.rb
196
- - test/test_default_commands/test_input.rb
197
- - test/test_default_commands/test_introspection.rb
198
- - test/test_history_array.rb
199
- - test/test_pry.rb
200
- - test/test_pry_history.rb
201
- - test/testrc
193
+ - test/helper.rb
194
+ - test/test_command_helpers.rb
195
+ - test/test_command_processor.rb
196
+ - test/test_command_set.rb
197
+ - test/test_completion.rb
198
+ - test/test_default_commands.rb
199
+ - test/test_default_commands/test_context.rb
200
+ - test/test_default_commands/test_documentation.rb
201
+ - test/test_default_commands/test_gems.rb
202
+ - test/test_default_commands/test_input.rb
203
+ - test/test_default_commands/test_introspection.rb
204
+ - test/test_default_commands/test_shell.rb
205
+ - test/test_history_array.rb
206
+ - test/test_pry.rb
207
+ - test/test_pry_history.rb
208
+ - test/test_pry_output.rb
209
+ - test/test_special_locals.rb
210
+ - test/testrc