pry 0.9.4pre5-i386-mswin32 → 0.9.4pre6-i386-mswin32

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.
data/CHANGELOG CHANGED
@@ -1,4 +1,20 @@
1
- */8/2011 version 0.9.4
1
+ 8/9/2011 version 0.9.4
2
+
3
+ MAJOR NEW FEATURES:
4
+ - JRuby support, including show-method/edit-method and editor integration on both 1.8 and 1.9 versions
5
+ - extended cd syntax: cd ../@x/y
6
+ - play command now works much better with _in_ array (this is a very powerful feature, esp with Pry::NAV_PROMPT)
7
+ - history saving/loading is now lightning fast
8
+ - 'edit' (entered by itself) now opens current lines in input buffer in an editor, and evals on exit
9
+ - 'edit' command is also, in general more intelligent
10
+ - ls output no longer in array format, and colors can be configured, e.g: Pry.config.ls.ivar_color = :bright_blue
11
+ - new switch-to command for moving around the binding stack without exiting out of sessions
12
+ - more sophisticated prompts, Pry::NAV_PROMPT to ease deep spelunking of code
13
+ - major bug fix for windows systems
14
+ - much better support for huge objects, should no longer hang pry (see #245)
15
+ - cat --ex and edit --ex now work better
16
+
17
+ complete CHANGELOG:
2
18
  * tempfile should end in .rb (for edit -t)
3
19
  * ls output should not be in array format
4
20
  * fix history saving (should not save all of Readline::HISTORY, but only what changed)
@@ -9,8 +25,6 @@
9
25
  * got rid of warnings caused by stricter ruby 1.9.3 rules
10
26
  * remove interpolation of command names and fix interpolation error messag (update WIKI) (thanks ryanf!)
11
27
  * 'nested sessions' now use binding stacks (so each instance manages its own collection of bindings without spawning other instances)
12
- * changed `exit` command so that it now called Kernel#exit (after saving history)
13
- * 'quit' now behaves like 'exit-all' (and aliased to exit-all) - it breaks out of the repl loop and sets empties the binding_stack
14
28
  * 'cd ..' just pops a binding off the binding_stack with special behaviour when only one binding in stack - it breaks out of the repl loop
15
29
  * added switch-to command (like jump-to but doesnt unwind the stack)
16
30
  * show-method and show-doc now accept multiple method names
@@ -34,6 +48,8 @@
34
48
  * added Pry::NAV_PROMPT (great new navigation prompt, per robgleeson) and Pry::SIMPLE_PRINT for simple (IRB-style) print output (just using inspect)
35
49
  * _pry_ now passed as 3rd parameter to :before_session hook
36
50
  * ls colors now configurable via Pry.config.ls.local_var_color = :bright_red etc
51
+ * ls separator configurable via, e.g Pry.config.ls.separator = " "
52
+ * Pry.view_clip() now only calls inspect on a few immediates, otherwise uses the #<> syntax, which has been truncated further to exclude teh mem address, again related to #245
37
53
 
38
54
  */7/2011 version 0.9.3
39
55
  * cat --ex (cats 5 lines above and below line in file where exception was raised)
@@ -1,13 +1,16 @@
1
- 564 John Mair
1
+ 616 John Mair
2
2
  76 Rob Gleeson
3
3
  50 Lee Jarvis
4
- 46 Mon ouïe
4
+ 47 Mon ouïe
5
5
  18 David Palm
6
+ 16 Conrad Irwin
7
+ 14 Ryan Fitzgerald
6
8
  13 epitron
7
- 8 Conrad Irwin
8
- 6 Ryan Fitzgerald
9
9
  2 Darrick Wiebe
10
- 2 Xavier Shay
10
+ 2 robgleeson
11
11
  2 Eric Christopherson
12
- 1 Josh Cheek
12
+ 2 Xavier Shay
13
13
  1 Tim Pope
14
+ 1 Gosha Arinich
15
+ 1 Josh Cheek
16
+ 1 Eero Saynatkari
data/TODO CHANGED
@@ -19,7 +19,6 @@
19
19
  * whitelist exceptions
20
20
  * hooks system
21
21
  * jruby shell command support
22
- *
23
22
 
24
23
  0.9.3
25
24
  * hist command now excludes last line of input (the command invocation itself)
data/lib/pry.rb CHANGED
@@ -17,7 +17,7 @@ class Pry
17
17
  end
18
18
  }
19
19
 
20
- # The default prints
20
+ # The default print
21
21
  DEFAULT_PRINT = proc do |output, value|
22
22
  stringified = begin
23
23
  value.pretty_inspect
@@ -45,6 +45,11 @@ class Pry
45
45
  end
46
46
  end
47
47
 
48
+ # useful when playing with truly enormous objects
49
+ CLIPPED_PRINT = proc do |output, value|
50
+ output.puts "=> #{Pry.view_clip(value)}"
51
+ end
52
+
48
53
  # Will only show the first line of the backtrace
49
54
  DEFAULT_EXCEPTION_HANDLER = proc do |output, exception|
50
55
  output.puts "#{exception.class}: #{exception.message}"
@@ -53,22 +58,23 @@ class Pry
53
58
 
54
59
  # The default prompt; includes the target and nesting level
55
60
  DEFAULT_PROMPT = [
56
- proc { |target_self, nest_level, _|
57
- if nest_level == 0
58
- "pry(#{Pry.view_clip(target_self)})> "
59
- else
60
- "pry(#{Pry.view_clip(target_self)}):#{Pry.view_clip(nest_level)}> "
61
- end
62
- },
63
-
64
- proc { |target_self, nest_level, _|
65
- if nest_level == 0
66
- "pry(#{Pry.view_clip(target_self)})* "
67
- else
68
- "pry(#{Pry.view_clip(target_self)}):#{Pry.view_clip(nest_level)}* "
69
- end
70
- }
61
+ proc { |target_self, nest_level, _|
62
+ if nest_level == 0
63
+ "pry(#{Pry.view_clip(target_self)})> "
64
+ else
65
+ "pry(#{Pry.view_clip(target_self)}):#{nest_level}> "
66
+ end
67
+ },
68
+
69
+ proc { |target_self, nest_level, _|
70
+ if nest_level == 0
71
+ "pry(#{Pry.view_clip(target_self)})* "
72
+ else
73
+ "pry(#{Pry.view_clip(target_self)}):#{nest_level}* "
74
+ end
75
+ }
71
76
  ]
77
+
72
78
  # Deal with the ^D key being pressed, different behaviour in
73
79
  # different cases:
74
80
  # 1) In an expression - behave like `!` command (clear input buffer)
@@ -92,22 +98,22 @@ class Pry
92
98
  SIMPLE_PROMPT = [proc { ">> " }, proc { " | " }]
93
99
 
94
100
  SHELL_PROMPT = [
95
- proc { |target_self, _, _| "pry #{Pry.view_clip(target_self)}:#{Dir.pwd} $ " },
96
- proc { |target_self, _, _| "pry #{Pry.view_clip(target_self)}:#{Dir.pwd} * " }
101
+ proc { |target_self, _, _| "pry #{Pry.view_clip(target_self)}:#{Dir.pwd} $ " },
102
+ proc { |target_self, _, _| "pry #{Pry.view_clip(target_self)}:#{Dir.pwd} * " }
97
103
  ]
98
104
 
99
105
  # A prompt that includes the full object path as well as
100
106
  # input/output (_in_ and _out_) information. Good for navigation.
101
107
  NAV_PROMPT = [
102
- proc do |_, level, pry|
103
- tree = pry.binding_stack.map { |b| Pry.view_clip(b.eval("self")) }.join " / "
104
- "[#{pry.input_array.size}] (pry) #{tree}: #{level}> "
105
- end,
106
- proc do |_, level, pry|
107
- tree = pry.binding_stack.map { |b| Pry.view_clip(b.eval("self")) }.join " / "
108
- "[#{pry.input_array.size}] (pry) #{tree}: #{level}* "
109
- end,
110
- ]
108
+ proc do |_, level, pry|
109
+ tree = pry.binding_stack.map { |b| Pry.view_clip(b.eval("self")) }.join " / "
110
+ "[#{pry.input_array.size}] (pry) #{tree}: #{level}> "
111
+ end,
112
+ proc do |_, level, pry|
113
+ tree = pry.binding_stack.map { |b| Pry.view_clip(b.eval("self")) }.join " / "
114
+ "[#{pry.input_array.size}] (pry) #{tree}: #{level}* "
115
+ end,
116
+ ]
111
117
 
112
118
 
113
119
  # As a REPL, we often want to catch any unexpected exceptions that may have
@@ -116,15 +122,15 @@ class Pry
116
122
  module RescuableException
117
123
  def self.===(exception)
118
124
  case exception
119
- # Catch when the user hits ^C (Interrupt < SignalException), and assume
120
- # that they just wanted to stop the in-progress command (just like bash etc.)
125
+ # Catch when the user hits ^C (Interrupt < SignalException), and assume
126
+ # that they just wanted to stop the in-progress command (just like bash etc.)
121
127
  when Interrupt
122
128
  true
123
- # Don't catch signals (particularly not SIGTERM) as these are unlikely to be
124
- # intended for pry itself. We should also make sure that Kernel#exit works.
129
+ # Don't catch signals (particularly not SIGTERM) as these are unlikely to be
130
+ # intended for pry itself. We should also make sure that Kernel#exit works.
125
131
  when SystemExit, SignalException
126
132
  false
127
- # All other exceptions will be caught.
133
+ # All other exceptions will be caught.
128
134
  else
129
135
  true
130
136
  end
@@ -12,7 +12,7 @@ class Pry
12
12
  render_output(false, 1, Pry.color ? CodeRay.scan(eval_string, :ruby).term : eval_string)
13
13
  end
14
14
 
15
- command(/amend-line.?(-?\d+)?(?:\.\.(-?\d+))?/, "Amend a line of input in multi-line mode. Type `amend-line --help` for more information. Aliases %",
15
+ command(/amend-line(?: (-?\d+)(?:\.\.(-?\d+))?)?/, "Amend a line of input in multi-line mode. Type `amend-line --help` for more information. Aliases %",
16
16
  :interpolate => false, :listing => "amend-line") do |*args|
17
17
  start_line_number, end_line_number, replacement_line = *args
18
18
 
@@ -52,7 +52,7 @@ e.g amend-line puts 'hello again' # no line number modifies immediately preced
52
52
  run "show-input"
53
53
  end
54
54
 
55
- alias_command(/%.?(-?\d+)?(?:\.\.(-?\d+))?/, /amend-line.?(-?\d+)?(?:\.\.(-?\d+))?/, "")
55
+ alias_command(/%.?(-?\d+)?(?:\.\.(-?\d+))?/, /amend-line(?: (-?\d+)(?:\.\.(-?\d+))?)?/, "")
56
56
 
57
57
  command "play", "Play back a string variable or a method or a file as input. Type `play --help` for more information." do |*args|
58
58
  opts = Slop.parse!(args) do |opt|
@@ -146,8 +146,9 @@ class Pry
146
146
  should_reload_at_top_level = opts[:n] ? false : true
147
147
 
148
148
  elsif opts.t? || args.first.nil?
149
- file_name = Tempfile.new(["tmp", ".rb"]).tap(&:close).path
150
- File.open(file_name, "w") { |f| f.puts eval_string } if !eval_string.empty?
149
+ file_name = temp_file do |f|
150
+ f.puts eval_string if !eval_string.empty?
151
+ end
151
152
  line = eval_string.lines.count + 1
152
153
  should_reload_locally = opts[:n] ? false : true
153
154
  else
@@ -198,7 +198,7 @@ Shows local and instance variables by default.
198
198
  if !v.first.empty?
199
199
  text << "#{k}:\n--\n"
200
200
  filtered_list = v.first.grep options[:grep]
201
- text << text().send(ls_color_map[k], (filtered_list.join(" ")))
201
+ text << text().send(ls_color_map[k], (filtered_list.join(Pry.config.ls.separator)))
202
202
  text << "\n\n"
203
203
  end
204
204
  end
@@ -212,7 +212,7 @@ Shows local and instance variables by default.
212
212
  # plain
213
213
  else
214
214
  list = info.sort_by { |k, v| v.last }.map { |k, v| [k, [v.first.grep(options[:grep])], v.last] }
215
- list = list.each { |k, v| text << text().send(ls_color_map[k], v.first.join(" ")); text << " " }
215
+ list = list.each { |k, v| text << text().send(ls_color_map[k], v.first.join(Pry.config.ls.separator)); text << Pry.config.ls.separator }
216
216
 
217
217
  if !options[:f]
218
218
  stagger_output(text)
@@ -39,6 +39,16 @@ class Pry
39
39
  end
40
40
  end
41
41
 
42
+ # Open a temp file and yield it to the block, closing it after
43
+ # @return [String] The path of the temp file
44
+ def temp_file
45
+ file = Tempfile.new(["tmp", ".rb"])
46
+ yield file
47
+ file.path
48
+ ensure
49
+ file.close
50
+ end
51
+
42
52
  ########### RBX HELPERS #############
43
53
  def is_core_rbx_path?(path)
44
54
  rbx? &&
@@ -106,11 +106,13 @@ class Pry
106
106
  elsif TOPLEVEL_BINDING.eval('self') == obj
107
107
  # special case for 'main' object :)
108
108
  obj.inspect
109
+ elsif [String, Numeric, Symbol, nil, true, false].any? { |v| v === obj } && obj.inspect.length <= max_length
110
+ obj.inspect
109
111
  else
110
- "#<#{obj.class}:%#x>" % (obj.object_id << 1)
112
+ "#<#{obj.class}>"#:%x>"# % (obj.object_id << 1)
111
113
  end
112
114
 
113
- rescue
115
+ rescue RescuableException
114
116
  "unknown"
115
117
  end
116
118
 
@@ -210,6 +212,8 @@ class Pry
210
212
  Pry.config.ls.method_color = :green
211
213
  Pry.config.ls.instance_method_color = :bright_green
212
214
  Pry.config.ls.constant_color = :yellow
215
+
216
+ Pry.config.ls.separator = " "
213
217
  end
214
218
 
215
219
  # Set all the configurable options back to their default values
@@ -1,3 +1,3 @@
1
1
  class Pry
2
- VERSION = "0.9.4pre5"
2
+ VERSION = "0.9.4pre6"
3
3
  end
@@ -2,20 +2,20 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{pry}
5
- s.version = "0.9.4pre1"
5
+ s.version = "0.9.4"
6
6
 
7
- s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
8
- s.authors = [%q{John Mair (banisterfiend)}]
9
- s.date = %q{2011-09-07}
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["John Mair (banisterfiend)"]
9
+ s.date = %q{2011-09-08}
10
10
  s.description = %q{An IRB alternative and runtime developer console}
11
11
  s.email = %q{jrmair@gmail.com}
12
- s.executables = [%q{pry}]
13
- s.files = [%q{.document}, %q{.gemtest}, %q{.gitignore}, %q{.yardopts}, %q{CHANGELOG}, %q{CONTRIBUTORS}, %q{LICENSE}, %q{README.markdown}, %q{Rakefile}, %q{TODO}, %q{bin/pry}, %q{examples/example_basic.rb}, %q{examples/example_command_override.rb}, %q{examples/example_commands.rb}, %q{examples/example_hooks.rb}, %q{examples/example_image_edit.rb}, %q{examples/example_input.rb}, %q{examples/example_input2.rb}, %q{examples/example_output.rb}, %q{examples/example_print.rb}, %q{examples/example_prompt.rb}, %q{examples/helper.rb}, %q{lib/pry.rb}, %q{lib/pry/command_context.rb}, %q{lib/pry/command_processor.rb}, %q{lib/pry/command_set.rb}, %q{lib/pry/commands.rb}, %q{lib/pry/completion.rb}, %q{lib/pry/config.rb}, %q{lib/pry/core_extensions.rb}, %q{lib/pry/custom_completions.rb}, %q{lib/pry/default_commands/basic.rb}, %q{lib/pry/default_commands/context.rb}, %q{lib/pry/default_commands/documentation.rb}, %q{lib/pry/default_commands/easter_eggs.rb}, %q{lib/pry/default_commands/gems.rb}, %q{lib/pry/default_commands/input.rb}, %q{lib/pry/default_commands/introspection.rb}, %q{lib/pry/default_commands/ls.rb}, %q{lib/pry/default_commands/shell.rb}, %q{lib/pry/extended_commands/experimental.rb}, %q{lib/pry/extended_commands/user_command_api.rb}, %q{lib/pry/helpers.rb}, %q{lib/pry/helpers/base_helpers.rb}, %q{lib/pry/helpers/command_helpers.rb}, %q{lib/pry/helpers/text.rb}, %q{lib/pry/history.rb}, %q{lib/pry/history_array.rb}, %q{lib/pry/plugins.rb}, %q{lib/pry/pry_class.rb}, %q{lib/pry/pry_instance.rb}, %q{lib/pry/version.rb}, %q{pry.gemspec}, %q{test/helper.rb}, %q{test/test_command_helpers.rb}, %q{test/test_command_processor.rb}, %q{test/test_command_set.rb}, %q{test/test_completion.rb}, %q{test/test_default_commands.rb}, %q{test/test_default_commands/test_context.rb}, %q{test/test_default_commands/test_documentation.rb}, %q{test/test_default_commands/test_gems.rb}, %q{test/test_default_commands/test_input.rb}, %q{test/test_default_commands/test_introspection.rb}, %q{test/test_default_commands/test_shell.rb}, %q{test/test_history_array.rb}, %q{test/test_pry.rb}, %q{test/test_pry_history.rb}, %q{test/test_pry_output.rb}, %q{test/test_special_locals.rb}, %q{test/testrc}, %q{wiki/Customizing-pry.md}, %q{wiki/Home.md}]
12
+ s.executables = ["pry"]
13
+ s.files = [".document", ".gemtest", ".gitignore", ".yardopts", "CHANGELOG", "CONTRIBUTORS", "LICENSE", "README.markdown", "Rakefile", "TODO", "bin/pry", "examples/example_basic.rb", "examples/example_command_override.rb", "examples/example_commands.rb", "examples/example_hooks.rb", "examples/example_image_edit.rb", "examples/example_input.rb", "examples/example_input2.rb", "examples/example_output.rb", "examples/example_print.rb", "examples/example_prompt.rb", "examples/helper.rb", "lib/pry.rb", "lib/pry/command_context.rb", "lib/pry/command_processor.rb", "lib/pry/command_set.rb", "lib/pry/commands.rb", "lib/pry/completion.rb", "lib/pry/config.rb", "lib/pry/core_extensions.rb", "lib/pry/custom_completions.rb", "lib/pry/default_commands/basic.rb", "lib/pry/default_commands/context.rb", "lib/pry/default_commands/documentation.rb", "lib/pry/default_commands/easter_eggs.rb", "lib/pry/default_commands/gems.rb", "lib/pry/default_commands/input.rb", "lib/pry/default_commands/introspection.rb", "lib/pry/default_commands/ls.rb", "lib/pry/default_commands/shell.rb", "lib/pry/extended_commands/experimental.rb", "lib/pry/extended_commands/user_command_api.rb", "lib/pry/helpers.rb", "lib/pry/helpers/base_helpers.rb", "lib/pry/helpers/command_helpers.rb", "lib/pry/helpers/text.rb", "lib/pry/history.rb", "lib/pry/history_array.rb", "lib/pry/plugins.rb", "lib/pry/pry_class.rb", "lib/pry/pry_instance.rb", "lib/pry/version.rb", "pry.gemspec", "test/helper.rb", "test/test_command_helpers.rb", "test/test_command_processor.rb", "test/test_command_set.rb", "test/test_completion.rb", "test/test_default_commands.rb", "test/test_default_commands/test_context.rb", "test/test_default_commands/test_documentation.rb", "test/test_default_commands/test_gems.rb", "test/test_default_commands/test_input.rb", "test/test_default_commands/test_introspection.rb", "test/test_default_commands/test_shell.rb", "test/test_history_array.rb", "test/test_pry.rb", "test/test_pry_history.rb", "test/test_pry_output.rb", "test/test_special_locals.rb", "test/testrc", "wiki/Customizing-pry.md", "wiki/Home.md"]
14
14
  s.homepage = %q{http://pry.github.com}
15
- s.require_paths = [%q{lib}]
16
- s.rubygems_version = %q{1.8.6}
15
+ s.require_paths = ["lib"]
16
+ s.rubygems_version = %q{1.7.2}
17
17
  s.summary = %q{An IRB alternative and runtime developer console}
18
- s.test_files = [%q{test/helper.rb}, %q{test/test_command_helpers.rb}, %q{test/test_command_processor.rb}, %q{test/test_command_set.rb}, %q{test/test_completion.rb}, %q{test/test_default_commands.rb}, %q{test/test_default_commands/test_context.rb}, %q{test/test_default_commands/test_documentation.rb}, %q{test/test_default_commands/test_gems.rb}, %q{test/test_default_commands/test_input.rb}, %q{test/test_default_commands/test_introspection.rb}, %q{test/test_default_commands/test_shell.rb}, %q{test/test_history_array.rb}, %q{test/test_pry.rb}, %q{test/test_pry_history.rb}, %q{test/test_pry_output.rb}, %q{test/test_special_locals.rb}, %q{test/testrc}]
18
+ s.test_files = ["test/helper.rb", "test/test_command_helpers.rb", "test/test_command_processor.rb", "test/test_command_set.rb", "test/test_completion.rb", "test/test_default_commands.rb", "test/test_default_commands/test_context.rb", "test/test_default_commands/test_documentation.rb", "test/test_default_commands/test_gems.rb", "test/test_default_commands/test_input.rb", "test/test_default_commands/test_introspection.rb", "test/test_default_commands/test_shell.rb", "test/test_history_array.rb", "test/test_pry.rb", "test/test_pry_history.rb", "test/test_pry_output.rb", "test/test_special_locals.rb", "test/testrc"]
19
19
 
20
20
  if s.respond_to? :specification_version then
21
21
  s.specification_version = 3
@@ -24,14 +24,14 @@ Gem::Specification.new do |s|
24
24
  s.add_runtime_dependency(%q<ruby_parser>, [">= 2.0.5"])
25
25
  s.add_runtime_dependency(%q<coderay>, [">= 0.9.8"])
26
26
  s.add_runtime_dependency(%q<slop>, ["~> 2.1.0"])
27
- s.add_runtime_dependency(%q<method_source>, [">= 0.6.0"])
27
+ s.add_runtime_dependency(%q<method_source>, [">= 0.6.5"])
28
28
  s.add_development_dependency(%q<bacon>, [">= 1.1.0"])
29
29
  s.add_development_dependency(%q<open4>, ["~> 1.0.1"])
30
30
  else
31
31
  s.add_dependency(%q<ruby_parser>, [">= 2.0.5"])
32
32
  s.add_dependency(%q<coderay>, [">= 0.9.8"])
33
33
  s.add_dependency(%q<slop>, ["~> 2.1.0"])
34
- s.add_dependency(%q<method_source>, [">= 0.6.0"])
34
+ s.add_dependency(%q<method_source>, [">= 0.6.5"])
35
35
  s.add_dependency(%q<bacon>, [">= 1.1.0"])
36
36
  s.add_dependency(%q<open4>, ["~> 1.0.1"])
37
37
  end
@@ -39,7 +39,7 @@ Gem::Specification.new do |s|
39
39
  s.add_dependency(%q<ruby_parser>, [">= 2.0.5"])
40
40
  s.add_dependency(%q<coderay>, [">= 0.9.8"])
41
41
  s.add_dependency(%q<slop>, ["~> 2.1.0"])
42
- s.add_dependency(%q<method_source>, [">= 0.6.0"])
42
+ s.add_dependency(%q<method_source>, [">= 0.6.5"])
43
43
  s.add_dependency(%q<bacon>, [">= 1.1.0"])
44
44
  s.add_dependency(%q<open4>, ["~> 1.0.1"])
45
45
  end
@@ -2,7 +2,7 @@ require 'helper'
2
2
 
3
3
  describe "Pry::DefaultCommands::Input" do
4
4
 
5
- describe "amend-line-N" do
5
+ describe "amend-line" do
6
6
  it 'should correctly amend the last line of input when no line number specified ' do
7
7
  str_output = StringIO.new
8
8
  redirect_pry_io(InputTester.new("def hello", "puts :bing", "amend-line puts :blah", "show-input", "exit-all"), str_output) do
@@ -104,7 +104,7 @@ describe "Pry::DefaultCommands::Input" do
104
104
 
105
105
  it 'should correctly amend the specified range of lines, using negative numbers in range' do
106
106
  str_output = StringIO.new
107
- redirect_pry_io(InputTester.new("def hello", "puts :bing", "puts :bang", "puts :boast", "puts :heart", "amend-line-2..-2 puts :bong", "show-input", "exit-all"), str_output) do
107
+ redirect_pry_io(InputTester.new("def hello", "puts :bing", "puts :bang", "puts :boast", "puts :heart", "amend-line 2..-2 puts :bong", "show-input", "exit-all"), str_output) do
108
108
  pry
109
109
  end
110
110
  str_output.string.should =~ /\d+: def hello\n\d+: puts :bong\n\d+: puts :heart/
@@ -1131,23 +1131,37 @@ describe Pry do
1131
1131
  o = Object.new
1132
1132
  def o.inspect; "a" * VC_MAX_LENGTH; end
1133
1133
 
1134
- Pry.view_clip(o, VC_MAX_LENGTH).should =~ /Object:0x.*?/
1134
+ Pry.view_clip(o, VC_MAX_LENGTH).should =~ /#<Object/
1135
1135
  end
1136
1136
  end
1137
1137
 
1138
- # describe "given the 'main' object" do
1139
- # it "returns the #inspect of main (special case)" do
1140
- # o = TOPLEVEL_BINDING.eval('self')
1141
- # Pry.view_clip(o, VC_MAX_LENGTH).should == o.inspect
1142
- # end
1143
- # end
1138
+ describe "given the 'main' object" do
1139
+ it "returns the #inspect of main (special case)" do
1140
+ o = TOPLEVEL_BINDING.eval('self')
1141
+ Pry.view_clip(o, VC_MAX_LENGTH).should == o.inspect
1142
+ end
1143
+ end
1144
+
1145
+ describe "given the a Numeric, String or Symbol object" do
1146
+ [1, 2.0, -5, "hello", :test].each do |o|
1147
+ it "returns the #inspect of the special-cased immediate object: #{o}" do
1148
+ Pry.view_clip(o, VC_MAX_LENGTH).should == o.inspect
1149
+ end
1150
+ end
1151
+
1152
+ # only testing with String here :)
1153
+ it "returns #<> format of the special-cased immediate object if #inspect is longer than maximum" do
1154
+ o = "o" * (VC_MAX_LENGTH + 1)
1155
+ Pry.view_clip(o, VC_MAX_LENGTH).should =~ /#<String/
1156
+ end
1157
+ end
1144
1158
 
1145
1159
  describe "given an object with an #inspect string as long as the maximum specified" do
1146
1160
  it "returns the #<> format of the object (never use inspect)" do
1147
1161
  o = Object.new
1148
1162
  def o.inspect; "a" * VC_MAX_LENGTH; end
1149
1163
 
1150
- Pry.view_clip(o, VC_MAX_LENGTH).should =~ /Object:0x.*?/
1164
+ Pry.view_clip(o, VC_MAX_LENGTH).should =~ /#<Object/
1151
1165
  end
1152
1166
  end
1153
1167
 
@@ -1158,7 +1172,7 @@ describe Pry do
1158
1172
  o = Object.new
1159
1173
  def o.inspect; "a" * (VC_MAX_LENGTH + 1); end
1160
1174
 
1161
- Pry.view_clip(o, VC_MAX_LENGTH).should =~ /Object:0x.*?/
1175
+ Pry.view_clip(o, VC_MAX_LENGTH).should =~ /#<Object/
1162
1176
  end
1163
1177
  end
1164
1178
 
@@ -1167,8 +1181,8 @@ describe Pry do
1167
1181
  it "returns a string of the #<class name:object idish> format" do
1168
1182
  c, m = Class.new, Module.new
1169
1183
 
1170
- Pry.view_clip(c, VC_MAX_LENGTH).should =~ /Class:0x.*?/
1171
- Pry.view_clip(m, VC_MAX_LENGTH).should =~ /Module:0x.*?/
1184
+ Pry.view_clip(c, VC_MAX_LENGTH).should =~ /#<Class/
1185
+ Pry.view_clip(m, VC_MAX_LENGTH).should =~ /#<Module/
1172
1186
  end
1173
1187
  end
1174
1188
 
@@ -1180,8 +1194,8 @@ describe Pry do
1180
1194
  def c.name; "a" * (VC_MAX_LENGTH + 1); end
1181
1195
  def m.name; "a" * (VC_MAX_LENGTH + 1); end
1182
1196
 
1183
- Pry.view_clip(c, VC_MAX_LENGTH).should =~ /Class:0x.*?/
1184
- Pry.view_clip(m, VC_MAX_LENGTH).should =~ /Module:0x.*?/
1197
+ Pry.view_clip(c, VC_MAX_LENGTH).should =~ /#<Class/
1198
+ Pry.view_clip(m, VC_MAX_LENGTH).should =~ /#<Module/
1185
1199
  end
1186
1200
  end
1187
1201
 
@@ -5,7 +5,8 @@ describe Pry do
5
5
 
6
6
  before do
7
7
  Pry.history.clear
8
- @hist = Tempfile.new(["tmp", ".pry_history"]).tap(&:close).path
8
+ @file = Tempfile.new(["tmp", ".pry_history"])
9
+ @hist = @file.path
9
10
  File.open(@hist, 'w') {|f| f << "1\n2\n3\n" }
10
11
  @old_hist = Pry.config.history.file
11
12
  Pry.config.history.file = @hist
@@ -13,7 +14,8 @@ describe Pry do
13
14
  end
14
15
 
15
16
  after do
16
- File.unlink @hist
17
+ @file.close
18
+ File.unlink(@hist)
17
19
  Pry.config.history.file = @old_hist
18
20
  end
19
21
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pry
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.4pre5
4
+ version: 0.9.4pre6
5
5
  prerelease: 5
6
6
  platform: i386-mswin32
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-09-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ruby_parser
16
- requirement: &70196685468520 !ruby/object:Gem::Requirement
16
+ requirement: &70110119591260 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 2.0.5
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70196685468520
24
+ version_requirements: *70110119591260
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: coderay
27
- requirement: &70196685467820 !ruby/object:Gem::Requirement
27
+ requirement: &70110119588300 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 0.9.8
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70196685467820
35
+ version_requirements: *70110119588300
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: slop
38
- requirement: &70196685467020 !ruby/object:Gem::Requirement
38
+ requirement: &70110119585800 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 2.1.0
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70196685467020
46
+ version_requirements: *70110119585800
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: method_source
49
- requirement: &70196685466120 !ruby/object:Gem::Requirement
49
+ requirement: &70110119585180 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 0.6.5
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70196685466120
57
+ version_requirements: *70110119585180
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: bacon
60
- requirement: &70196685464660 !ruby/object:Gem::Requirement
60
+ requirement: &70110119584320 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: 1.1.0
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70196685464660
68
+ version_requirements: *70110119584320
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: open4
71
- requirement: &70196685463160 !ruby/object:Gem::Requirement
71
+ requirement: &70110119583520 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ~>
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: 1.0.1
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *70196685463160
79
+ version_requirements: *70110119583520
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: win32console
82
- requirement: &70196685462380 !ruby/object:Gem::Requirement
82
+ requirement: &70110119582860 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,7 +87,7 @@ dependencies:
87
87
  version: 1.3.0
88
88
  type: :runtime
89
89
  prerelease: false
90
- version_requirements: *70196685462380
90
+ version_requirements: *70110119582860
91
91
  description: An IRB alternative and runtime developer console
92
92
  email: jrmair@gmail.com
93
93
  executables: