0.9.7.2 hotfix: fixed indentation issues, now passing eval_string into Pry#run_command

This commit is contained in:
John Mair 2011-10-28 00:10:12 +13:00
parent 492793632f
commit e8f5d55c31
4 changed files with 28 additions and 9 deletions

View File

@ -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 File

@ -254,6 +254,8 @@ class Pry
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 @@ class Pry
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 @@ class Pry
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 File

@ -1,3 +1,3 @@
class Pry
VERSION = "0.9.7.1"
VERSION = "0.9.7.2"
end

View File

@ -184,10 +184,19 @@ describe Pry do
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