processor/command/info_subcmd/source.rb in rb8-trepanning-0.1.3 vs processor/command/info_subcmd/source.rb in rb8-trepanning-0.1.4

- old
+ new

@@ -8,10 +8,11 @@ require 'linecache19' end require 'columnize' require_relative '../base/subcmd' require_relative '../../../app/complete' +require_relative '../../../app/run' class Trepan::Subcommand::InfoSource < Trepan::Subcommand unless defined?(HELP) Trepanning::Subcommand.set_name_prefix(__FILE__, self) DEFAULT_FILE_ARGS = %w(size mtime sha1) @@ -50,13 +51,18 @@ msg(m) end max_line = LineCache::size(canonic_name) msg 'File has %d lines.' % max_line if max_line msg('SHA1 is %s.' % LineCache::sha1(canonic_name)) - msg('Possible breakpoint line numbers:') - lines = LineCache.trace_line_numbers(canonic_name) - fmt_lines = columnize_numbers(lines) - msg(fmt_lines) + syntax_errors = Trepan::ruby_syntax_errors(canonic_name) + if syntax_errors + msg('Not a syntactically-correct Ruby program.') + else + msg('Possible breakpoint line numbers:') + lines = LineCache.trace_line_numbers(canonic_name) + fmt_lines = columnize_numbers(lines) + msg(fmt_lines) + end msg("Stat info:\n\t%s" % LineCache::stat(canonic_name).pretty_inspect) end end if __FILE__ == $0