lib/bauxite/actions/debug.rb in bauxite-0.2.0 vs lib/bauxite/actions/debug.rb in bauxite-0.3.0

- old
+ new

@@ -31,22 +31,27 @@ # For example: # debug # # => this breaks into the debug console # :category: Action Methods def debug - lambda { _debug_process } + lambda do + @ctx.with_vars({ '__DEBUG__' => true }) do + _debug_process + end + end end private @@debug_line = 0 def _debug_process Readline.completion_append_character = " " Readline.completer_word_break_characters = "" Readline.completion_proc = lambda { |str| _debug_auto_complete(str) } while line = _debug_get_line - break if line.strip == 'exit' + next if not line or line == '' + break if line == 'exit' @ctx.handle_errors(false, false) do @ctx.exec_action({ :text => line, :file => '<debug>', :line => @@debug_line }, true) end @@debug_line += 1 end @@ -56,10 +61,10 @@ line = Readline.readline(@ctx.logger.debug_prompt, true) return nil if line.nil? if line =~ /^\s*$/ or Readline::HISTORY.to_a[-2] == line Readline::HISTORY.pop end - line + line.strip end def _debug_auto_complete(str) action_name = str.sub(/ .*/, '') #puts "\n\nac: ==>#{str}<==\nname: ==>#{action_name}<==\n\n"