pry 0.8.0pre8-java → 0.8.0pre9-java

Sign up to get free protection for your applications and to get access to all the features.
data/lib/pry/commands.rb CHANGED
@@ -23,9 +23,34 @@ class Pry
23
23
  Pry.start(target)
24
24
  end
25
25
 
26
+ # this cannot be accessed, it's just for help purposed.
26
27
  command ".<shell command>", "All text following a '.' is forwarded to the shell." do
27
28
  end
28
29
 
30
+ command "hist", "Show and replay Readline history" do |*args|
31
+ require 'slop'
32
+ if args.empty?
33
+ text = add_line_numbers(Readline::HISTORY.to_a.join("\n"), 0)
34
+ stagger_output(text)
35
+ next
36
+ end
37
+
38
+ opts = Slop.parse(args) do
39
+ banner "Usage: hist [-rSTART..END]"
40
+ on :r, :replay, 'The line (or range of lines) to replay.', true, :as => Range do |r|
41
+ options[:r].argument_value = r.to_i if r.is_a?(String)
42
+ end
43
+ on :h, :help, 'Show this message.', :tail => true do
44
+ output.puts help
45
+ end
46
+ end
47
+
48
+ next if opts.h?
49
+
50
+ actions = Array(Readline::HISTORY.to_a[opts[:r]]).join("\n") + "\n"
51
+ Pry.active_instance.input = StringIO.new(actions)
52
+ end
53
+
29
54
  command "exit-program", "End the current program. Aliases: quit-program, !!!" do
30
55
  exit
31
56
  end
@@ -193,10 +193,7 @@ class Pry
193
193
  loop do
194
194
  val = retrieve_line(eval_string, target)
195
195
  process_line(val, eval_string, target)
196
- if valid_expression?(eval_string)
197
- redo if null_input?(val)
198
- break
199
- end
196
+ break if valid_expression?(eval_string) && !null_input?(val)
200
197
  end
201
198
 
202
199
  @suppress_output = true if eval_string =~ /;\Z/
@@ -276,10 +273,22 @@ class Pry
276
273
  # as it has a second parameter.
277
274
  input.readline(current_prompt, true)
278
275
  else
279
- if input.method(:readline).arity == 1
280
- input.readline(current_prompt)
281
- else
282
- input.readline
276
+ begin
277
+ if input.method(:readline).arity == 1
278
+ input.readline(current_prompt)
279
+ else
280
+ input.readline
281
+ end
282
+ rescue Exception => ex
283
+ self.input = Readline
284
+ ""
285
+
286
+ # FIX ME!!!
287
+ # failing test is due to null_input?() being true for a
288
+ # command that doesn't return a value. This causes a EOFError
289
+ # exception for a 'rep' (as in test) as it makes the read loop
290
+ # redo and so it tries to read from a non-existent string
291
+ # binding.pry
283
292
  end
284
293
  end
285
294
  end
data/lib/pry/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class Pry
2
- VERSION = "0.8.0pre8"
2
+ VERSION = "0.8.0pre9"
3
3
  end
data/test/test.rb CHANGED
@@ -380,7 +380,7 @@ describe Pry do
380
380
  end
381
381
  end
382
382
  str_output = StringIO.new
383
- Pry.new(:input => StringIO.new("hello"), :output => str_output, :commands => Command68).rep
383
+ Pry.new(:input => StringIO.new("hello\n"), :output => str_output, :commands => Command68).rep
384
384
  str_output.string.should =~ /:kept_hello/
385
385
 
386
386
  Object.remove_const(:Command68)
@@ -393,7 +393,7 @@ describe Pry do
393
393
  end
394
394
  end
395
395
  str_output = StringIO.new
396
- Pry.new(:input => StringIO.new("hello"), :output => str_output, :commands => Command68).rep
396
+ Pry.new(:input => StringIO.new("hello\n"), :output => str_output, :commands => Command68).rep
397
397
  (str_output.string =~ /:kept_hello/).should == nil
398
398
 
399
399
  Object.remove_const(:Command68)
metadata CHANGED
@@ -1,127 +1,107 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pry
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: true
5
- segments:
6
- - 0
7
- - 8
8
- - 0pre8
9
- version: 0.8.0pre8
4
+ prerelease: 5
5
+ version: 0.8.0pre9
10
6
  platform: java
11
7
  authors:
12
- - John Mair (banisterfiend)
8
+ - John Mair (banisterfiend)
13
9
  autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
12
 
17
- date: 2011-04-13 00:00:00 +12:00
13
+ date: 2011-04-15 00:00:00 +12:00
18
14
  default_executable:
19
15
  dependencies:
20
- - !ruby/object:Gem::Dependency
21
- name: ruby_parser
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
- none: false
25
- requirements:
26
- - - ">="
27
- - !ruby/object:Gem::Version
28
- segments:
29
- - 2
30
- - 0
31
- - 5
32
- version: 2.0.5
33
- type: :runtime
34
- version_requirements: *id001
35
- - !ruby/object:Gem::Dependency
36
- name: coderay
37
- prerelease: false
38
- requirement: &id002 !ruby/object:Gem::Requirement
39
- none: false
40
- requirements:
41
- - - ">="
42
- - !ruby/object:Gem::Version
43
- segments:
44
- - 0
45
- - 9
46
- - 7
47
- version: 0.9.7
48
- type: :runtime
49
- version_requirements: *id002
50
- - !ruby/object:Gem::Dependency
51
- name: bacon
52
- prerelease: false
53
- requirement: &id003 !ruby/object:Gem::Requirement
54
- none: false
55
- requirements:
56
- - - ">="
57
- - !ruby/object:Gem::Version
58
- segments:
59
- - 1
60
- - 1
61
- - 0
62
- version: 1.1.0
63
- type: :development
64
- version_requirements: *id003
65
- - !ruby/object:Gem::Dependency
66
- name: method_source
67
- prerelease: false
68
- requirement: &id004 !ruby/object:Gem::Requirement
69
- none: false
70
- requirements:
71
- - - "="
72
- - !ruby/object:Gem::Version
73
- segments:
74
- - 0
75
- - 2
76
- - 0
77
- version: 0.2.0
78
- type: :runtime
79
- version_requirements: *id004
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.7
36
+ type: :runtime
37
+ version_requirements: *id002
38
+ - !ruby/object:Gem::Dependency
39
+ name: bacon
40
+ prerelease: false
41
+ requirement: &id003 !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: 1.1.0
47
+ type: :development
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.2.0
58
+ type: :runtime
59
+ version_requirements: *id004
80
60
  description: attach an irb-like session to any object at runtime
81
61
  email: jrmair@gmail.com
82
62
  executables:
83
- - pry
63
+ - pry
84
64
  extensions: []
85
65
 
86
66
  extra_rdoc_files: []
87
67
 
88
68
  files:
89
- - lib/pry/commands.rb
90
- - lib/pry/version.rb
91
- - lib/pry/TAGS
92
- - lib/pry/command_base.rb
93
- - lib/pry/prompts.rb
94
- - lib/pry/hooks.rb
95
- - lib/pry/custom_completions.rb
96
- - lib/pry/core_extensions.rb
97
- - lib/pry/command_helpers.rb
98
- - lib/pry/command_processor.rb
99
- - lib/pry/completion.rb
100
- - lib/pry/print.rb
101
- - lib/pry/pry_class.rb
102
- - lib/pry/command_base_helpers.rb
103
- - lib/pry/pry_instance.rb
104
- - lib/pry.rb
105
- - examples/example_commands.rb
106
- - examples/example_image_edit.rb
107
- - examples/example_input2.rb
108
- - examples/example_prompt.rb
109
- - examples/example_command_override.rb
110
- - examples/example_output.rb
111
- - examples/example_hooks.rb
112
- - examples/example_print.rb
113
- - examples/example_basic.rb
114
- - examples/example_input.rb
115
- - test/test.rb
116
- - test/test_helper.rb
117
- - test/testrc
118
- - CHANGELOG
119
- - LICENSE
120
- - README.markdown
121
- - Rakefile
122
- - .gemtest
123
- - bin/pry
124
- has_rdoc: yard
69
+ - lib/pry.rb
70
+ - lib/pry/commands.rb
71
+ - lib/pry/version.rb
72
+ - lib/pry/TAGS
73
+ - lib/pry/command_base.rb
74
+ - lib/pry/prompts.rb
75
+ - lib/pry/hooks.rb
76
+ - lib/pry/custom_completions.rb
77
+ - lib/pry/core_extensions.rb
78
+ - lib/pry/command_helpers.rb
79
+ - lib/pry/command_processor.rb
80
+ - lib/pry/completion.rb
81
+ - lib/pry/print.rb
82
+ - lib/pry/pry_class.rb
83
+ - lib/pry/command_base_helpers.rb
84
+ - lib/pry/pry_instance.rb
85
+ - examples/example_commands.rb
86
+ - examples/example_image_edit.rb
87
+ - examples/example_input2.rb
88
+ - examples/example_prompt.rb
89
+ - examples/example_command_override.rb
90
+ - examples/example_output.rb
91
+ - examples/example_hooks.rb
92
+ - examples/example_print.rb
93
+ - examples/example_basic.rb
94
+ - examples/example_input.rb
95
+ - test/test.rb
96
+ - test/test_helper.rb
97
+ - test/testrc
98
+ - CHANGELOG
99
+ - LICENSE
100
+ - README.markdown
101
+ - Rakefile
102
+ - .gemtest
103
+ - bin/pry
104
+ has_rdoc: true
125
105
  homepage: http://banisterfiend.wordpress.com
126
106
  licenses: []
127
107
 
@@ -129,29 +109,23 @@ post_install_message:
129
109
  rdoc_options: []
130
110
 
131
111
  require_paths:
132
- - lib
112
+ - lib
133
113
  required_ruby_version: !ruby/object:Gem::Requirement
134
114
  none: false
135
115
  requirements:
136
- - - ">="
137
- - !ruby/object:Gem::Version
138
- segments:
139
- - 0
140
- version: "0"
116
+ - - ">="
117
+ - !ruby/object:Gem::Version
118
+ version: "0"
141
119
  required_rubygems_version: !ruby/object:Gem::Requirement
142
120
  none: false
143
121
  requirements:
144
- - - ">"
145
- - !ruby/object:Gem::Version
146
- segments:
147
- - 1
148
- - 3
149
- - 1
150
- version: 1.3.1
122
+ - - ">"
123
+ - !ruby/object:Gem::Version
124
+ version: 1.3.1
151
125
  requirements: []
152
126
 
153
127
  rubyforge_project:
154
- rubygems_version: 1.3.7
128
+ rubygems_version: 1.5.1
155
129
  signing_key:
156
130
  specification_version: 3
157
131
  summary: attach an irb-like session to any object at runtime