mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
0.9.7.2 hotfix: fixed indentation issues, now passing eval_string into Pry#run_command
This commit is contained in:
parent
492793632f
commit
e8f5d55c31
4 changed files with 28 additions and 9 deletions
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
class Pry
|
||||
VERSION = "0.9.7.1"
|
||||
VERSION = "0.9.7.2"
|
||||
end
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue