Permalink
Browse files

0.9.7.2 hotfix: fixed indentation issues, now passing eval_string int…

…o Pry#run_command
  • Loading branch information...
banister committed Oct 27, 2011
1 parent 4927936 commit e8f5d55c319cb8d078a0a7da035e7179d6bb49bd
Showing with 28 additions and 9 deletions.
  1. +8 −0 CHANGELOG
  2. +9 −7 lib/pry/pry_instance.rb
  3. +1 −1 lib/pry/version.rb
  4. +10 −1 test/test_pry.rb
View
@@ -1,3 +1,11 @@
+27/10/2011 version 0.9.7.2 hotfix
+* fixed indentation for 'super if' and 'ensure', 'next if', etc
+* refactored Pry#run_command so it can accept an eval_string parameter (so amend-line and so on can work with it)
+* changed ^D so it no longer resets indent level automatically
+
+26/10/2011 version 0.9.7.1 hotfix
+* fixed gem dependecy issues
+
25/10/2011 version 0.9.7
MAJOR NEW FEATURES:
View
@@ -254,6 +254,8 @@ def r(target=TOPLEVEL_BINDING, eval_string="")
val = ""
loop do
val = retrieve_line(eval_string, target)
+
+ # eval_string may be mutated by this method
process_line(val, eval_string, target)
break if valid_expression?(eval_string)
@@ -302,12 +304,10 @@ def retrieve_line(eval_string, target)
val = readline(current_prompt + indentation)
- # exit session if we receive EOF character (^D)
+ # invoke handler if we receive EOF character (^D)
if !val
output.puts ""
Pry.config.control_d_handler.call(eval_string, self)
-
- @indent.reset if Pry.config.auto_indent
""
else
# Change the eval_string into the input encoding (Issue 284)
@@ -359,12 +359,14 @@ def process_line(val, eval_string, target)
end
# Run the specified command.
- # @param [String] The command (and its params) to execute.
- # @param [Binding] The binding to use..
+ # @param [String] val The command (and its params) to execute.
+ # @param [String] eval_string The current input buffer.
+ # @param [Binding] target The binding to use..
+ # @return [Pry::CommandContext::VOID_VALUE]
# @example
# pry_instance.run_command("ls -m")
- def run_command(val, target = binding_stack.last)
- process_line(val, "", target)
+ def run_command(val, eval_string = "", target = binding_stack.last)
+ process_line(val, eval_string, target)
Pry::CommandContext::VOID_VALUE
end
View
@@ -1,3 +1,3 @@
class Pry
- VERSION = "0.9.7.1"
+ VERSION = "0.9.7.2"
end
View
@@ -184,10 +184,19 @@ class Hello
it 'should run a command in a specified context' do
b = Pry.binding_for(7)
p = Pry.new(:output => StringIO.new)
- p.run_command("ls -m", b)
+ p.run_command("ls -m", "", b)
p.output.string.should =~ /divmod/
end
+ it 'should run a command that modifies the passed in eval_string' do
+ b = Pry.binding_for(7)
+ p = Pry.new(:output => StringIO.new)
+ eval_string = "def hello\npeter pan\n"
+ p.run_command("amend-line !", eval_string, b)
+ eval_string.should =~ /def hello/
+ eval_string.should.not =~ /peter pan/
+ end
+
it 'should run a command in the context of a session' do
mock_pry("@session_ivar = 10", "_pry_.run_command('ls')").should =~ /@session_ivar/
end

0 comments on commit e8f5d55

Please sign in to comment.