pry 0.9.3pre1-i386-mswin32 → 0.9.4-i386-mswin32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. data/CHANGELOG +53 -0
  2. data/CONTRIBUTORS +13 -0
  3. data/README.markdown +4 -2
  4. data/Rakefile +17 -3
  5. data/TODO +22 -0
  6. data/lib/pry.rb +102 -24
  7. data/lib/pry/command_context.rb +12 -0
  8. data/lib/pry/command_processor.rb +50 -19
  9. data/lib/pry/command_set.rb +17 -7
  10. data/lib/pry/completion.rb +6 -6
  11. data/lib/pry/config.rb +6 -2
  12. data/lib/pry/default_commands/basic.rb +8 -4
  13. data/lib/pry/default_commands/context.rb +84 -36
  14. data/lib/pry/default_commands/documentation.rb +50 -30
  15. data/lib/pry/default_commands/easter_eggs.rb +5 -0
  16. data/lib/pry/default_commands/input.rb +20 -16
  17. data/lib/pry/default_commands/introspection.rb +61 -77
  18. data/lib/pry/default_commands/ls.rb +22 -14
  19. data/lib/pry/default_commands/shell.rb +32 -17
  20. data/lib/pry/extended_commands/user_command_api.rb +32 -1
  21. data/lib/pry/helpers/base_helpers.rb +21 -9
  22. data/lib/pry/helpers/command_helpers.rb +99 -17
  23. data/lib/pry/helpers/text.rb +12 -11
  24. data/lib/pry/history.rb +61 -0
  25. data/lib/pry/plugins.rb +19 -8
  26. data/lib/pry/pry_class.rb +49 -60
  27. data/lib/pry/pry_instance.rb +122 -119
  28. data/lib/pry/version.rb +1 -1
  29. data/pry.gemspec +15 -14
  30. data/test/helper.rb +31 -0
  31. data/test/test_command_processor.rb +8 -87
  32. data/test/test_command_set.rb +40 -2
  33. data/test/test_completion.rb +26 -0
  34. data/test/test_default_commands/test_context.rb +185 -1
  35. data/test/test_default_commands/test_documentation.rb +10 -0
  36. data/test/test_default_commands/test_input.rb +39 -13
  37. data/test/test_default_commands/test_introspection.rb +11 -1
  38. data/test/test_default_commands/test_shell.rb +18 -0
  39. data/test/test_pry.rb +217 -47
  40. data/test/test_pry_history.rb +84 -0
  41. data/test/test_pry_output.rb +44 -0
  42. data/test/test_special_locals.rb +35 -0
  43. metadata +83 -77
@@ -0,0 +1,84 @@
1
+ require 'helper'
2
+ require 'tempfile'
3
+
4
+ describe Pry do
5
+
6
+ before do
7
+ Pry.history.clear
8
+ @file = Tempfile.new(["tmp", ".pry_history"])
9
+ @hist = @file.path
10
+ File.open(@hist, 'w') {|f| f << "1\n2\n3\n" }
11
+ @old_hist = Pry.config.history.file
12
+ Pry.config.history.file = @hist
13
+ Pry.load_history
14
+ end
15
+
16
+ after do
17
+ @file.close
18
+ File.unlink(@hist)
19
+ Pry.config.history.file = @old_hist
20
+ end
21
+
22
+ describe ".load_history" do
23
+ it "should read the contents of the file" do
24
+ Pry.history.to_a[-2..-1].should === ["2", "3"]
25
+ end
26
+ end
27
+
28
+ describe ".save_history" do
29
+ it "should include a trailing newline" do
30
+ Pry.history << "4"
31
+ Pry.save_history
32
+ File.read(@hist).should =~ /4\n\z/
33
+ end
34
+
35
+ it "should not change anything if history is not changed" do
36
+ File.open(@hist, 'w') {|f| f << "4\n5\n6\n" }
37
+ Pry.save_history
38
+ File.read(@hist).should == "4\n5\n6\n"
39
+ end
40
+
41
+ it "should append new lines to the file" do
42
+ Pry.history << "4"
43
+ Pry.save_history
44
+ File.read(@hist).should == "1\n2\n3\n4\n"
45
+ end
46
+
47
+ it "should not clobber lines written by other Pry's in the meantime" do
48
+ Pry.history << "5"
49
+ File.open(@hist, 'a') {|f| f << "4\n" }
50
+ Pry.save_history
51
+
52
+ Pry.history.to_a[-3..-1].should == ["2", "3", "5"]
53
+ File.read(@hist).should == "1\n2\n3\n4\n5\n"
54
+ end
55
+
56
+ it "should not delete lines from the file if this session's history was cleared" do
57
+ Pry.history.clear
58
+ Pry.save_history
59
+ File.read(@hist).should == "1\n2\n3\n"
60
+ end
61
+
62
+ it "should save new lines that are added after the history was cleared" do
63
+ Pry.history.clear
64
+ Pry.history << "4"
65
+
66
+ # doing this twice as libedit on 1.8.7 has bugs and sometimes ignores the
67
+ # first line in history
68
+ Pry.history << "4"
69
+ Pry.save_history
70
+ File.read(@hist).should =~ /1\n2\n3\n4\n/
71
+ end
72
+
73
+ it "should only append new lines the second time it is saved" do
74
+ Pry.history << "4"
75
+ Pry.save_history
76
+ File.open(@hist, 'a') {|f| f << "5\n" }
77
+ Pry.history << "6"
78
+ Pry.save_history
79
+
80
+ Pry.history.to_a[-4..-1].should == ["2", "3", "4", "6"]
81
+ File.read(@hist).should == "1\n2\n3\n4\n5\n6\n"
82
+ end
83
+ end
84
+ 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
@@ -1,108 +1,106 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: pry
3
- version: !ruby/object:Gem::Version
4
- prerelease: 5
5
- version: 0.9.3pre1
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.9.4
5
+ prerelease:
6
6
  platform: i386-mswin32
7
- authors:
7
+ authors:
8
8
  - John Mair (banisterfiend)
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2011-07-27 00:00:00 Z
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
12
+ date: 2011-09-08 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
16
15
  name: ruby_parser
17
- prerelease: false
18
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &70183683480540 !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
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: *70183683480540
25
+ - !ruby/object:Gem::Dependency
26
+ name: coderay
27
+ requirement: &70183683479880 !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
- requirement: &id003 !ruby/object:Gem::Requirement
35
+ version_requirements: *70183683479880
36
+ - !ruby/object:Gem::Dependency
37
+ name: slop
38
+ requirement: &70183683479180 !ruby/object:Gem::Requirement
41
39
  none: false
42
- requirements:
40
+ requirements:
43
41
  - - ~>
44
- - !ruby/object:Gem::Version
45
- version: 1.9.0
42
+ - !ruby/object:Gem::Version
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
- requirement: &id004 !ruby/object:Gem::Requirement
46
+ version_requirements: *70183683479180
47
+ - !ruby/object:Gem::Dependency
48
+ name: method_source
49
+ requirement: &70183683478540 !ruby/object:Gem::Requirement
52
50
  none: false
53
- requirements:
54
- - - ">="
55
- - !ruby/object:Gem::Version
56
- version: 0.6.0
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
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
- requirement: &id005 !ruby/object:Gem::Requirement
57
+ version_requirements: *70183683478540
58
+ - !ruby/object:Gem::Dependency
59
+ name: bacon
60
+ requirement: &70183683477780 !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
- requirement: &id006 !ruby/object:Gem::Requirement
68
+ version_requirements: *70183683477780
69
+ - !ruby/object:Gem::Dependency
70
+ name: open4
71
+ requirement: &70183683477120 !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
- requirement: &id007 !ruby/object:Gem::Requirement
79
+ version_requirements: *70183683477120
80
+ - !ruby/object:Gem::Dependency
81
+ name: win32console
82
+ requirement: &70183683475700 !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
- version_requirements: *id007
89
+ prerelease: false
90
+ version_requirements: *70183683475700
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
103
+ - CONTRIBUTORS
106
104
  - LICENSE
107
105
  - README.markdown
108
106
  - Rakefile
@@ -143,6 +141,7 @@ files:
143
141
  - lib/pry/helpers/base_helpers.rb
144
142
  - lib/pry/helpers/command_helpers.rb
145
143
  - lib/pry/helpers/text.rb
144
+ - lib/pry/history.rb
146
145
  - lib/pry/history_array.rb
147
146
  - lib/pry/plugins.rb
148
147
  - lib/pry/pry_class.rb
@@ -153,55 +152,62 @@ files:
153
152
  - test/test_command_helpers.rb
154
153
  - test/test_command_processor.rb
155
154
  - test/test_command_set.rb
155
+ - test/test_completion.rb
156
156
  - test/test_default_commands.rb
157
157
  - test/test_default_commands/test_context.rb
158
158
  - test/test_default_commands/test_documentation.rb
159
159
  - test/test_default_commands/test_gems.rb
160
160
  - test/test_default_commands/test_input.rb
161
161
  - test/test_default_commands/test_introspection.rb
162
+ - test/test_default_commands/test_shell.rb
162
163
  - test/test_history_array.rb
163
164
  - test/test_pry.rb
165
+ - test/test_pry_history.rb
166
+ - test/test_pry_output.rb
167
+ - test/test_special_locals.rb
164
168
  - test/testrc
165
169
  - wiki/Customizing-pry.md
166
170
  - wiki/Home.md
167
171
  homepage: http://pry.github.com
168
172
  licenses: []
169
-
170
173
  post_install_message:
171
174
  rdoc_options: []
172
-
173
- require_paths:
175
+ require_paths:
174
176
  - lib
175
- required_ruby_version: !ruby/object:Gem::Requirement
177
+ required_ruby_version: !ruby/object:Gem::Requirement
176
178
  none: false
177
- requirements:
178
- - - ">="
179
- - !ruby/object:Gem::Version
180
- version: "0"
181
- required_rubygems_version: !ruby/object:Gem::Requirement
179
+ requirements:
180
+ - - ! '>='
181
+ - !ruby/object:Gem::Version
182
+ version: '0'
183
+ required_rubygems_version: !ruby/object:Gem::Requirement
182
184
  none: false
183
- requirements:
184
- - - ">"
185
- - !ruby/object:Gem::Version
186
- version: 1.3.1
185
+ requirements:
186
+ - - ! '>='
187
+ - !ruby/object:Gem::Version
188
+ version: '0'
187
189
  requirements: []
188
-
189
190
  rubyforge_project:
190
- rubygems_version: 1.7.2
191
+ rubygems_version: 1.8.6
191
192
  signing_key:
192
193
  specification_version: 3
193
194
  summary: An IRB alternative and runtime developer console
194
- test_files:
195
+ test_files:
195
196
  - test/helper.rb
196
197
  - test/test_command_helpers.rb
197
198
  - test/test_command_processor.rb
198
199
  - test/test_command_set.rb
200
+ - test/test_completion.rb
199
201
  - test/test_default_commands.rb
200
202
  - test/test_default_commands/test_context.rb
201
203
  - test/test_default_commands/test_documentation.rb
202
204
  - test/test_default_commands/test_gems.rb
203
205
  - test/test_default_commands/test_input.rb
204
206
  - test/test_default_commands/test_introspection.rb
207
+ - test/test_default_commands/test_shell.rb
205
208
  - test/test_history_array.rb
206
209
  - test/test_pry.rb
210
+ - test/test_pry_history.rb
211
+ - test/test_pry_output.rb
212
+ - test/test_special_locals.rb
207
213
  - test/testrc