Module: One9::Runner
Constant Summary collapse
- OPTIONS =
[ ['-v, --version', 'Print version'], ['-h, --help', 'Print help'] ]
- COMMANDS =
[ ['test', 'Spy on tests and print report.'], ['list', 'Print 1.9 changes report from last test'], ['edit', 'Place 1.9 changes from last test into an editor'], ['changes', 'Print all known 1.9 changes'], ['lines', 'Print 1.9 changes by line from last test'], ['quickfix', 'Generate 1.9 change list formatted for editors'] ]
- COMMANDS_HELP =
{ :test => "[COMMAND='rake test']", :list => '[QUERY] [-a|--all]', :changes => '[QUERY]', :lines => '[QUERY] [-a|--all]', :edit => '[QUERY]', :quickfix => '[QUERY] [-a|--all]' }
Instance Method Summary collapse
Instance Method Details
#edit(query = nil) ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/one9/runner.rb', line 56 def edit(query=nil) command_help(:edit, query) Report.report_exists! editor = ENV['EDITOR'] || 'vim' if editor[/^vim/] grep = "one9 quickfix #{query}".strip.gsub(' ', '\\ ') exec(%q[vim -c 'set grepprg=] + grep + %q[' -c 'botright copen' -c 'silent! grep']) else puts "No support for #{editor} yet. Patches welcome :)" end end |
#run(argv = ARGV) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/one9/runner.rb', line 27 def run(argv=ARGV) One9.config.merge! (argv) if One9.config[:help] || argv.empty? help elsif public_methods.map {|e| e.to_s }.include? argv[0] send(*argv) else abort "one9: Invalid command `#{argv[0]}'" end rescue NoReportError abort("one9 has no report. `one9 test` your project first.") rescue warn("one9 error: #{$!}\n #{$!.backtrace[0]}") end |
#test(*args) ⇒ Object
49 50 51 52 53 54 |
# File 'lib/one9/runner.rb', line 49 def test(*args) command_help(:test, *args) ENV['RUBYOPT'] = "-I#{File.dirname File.dirname(__FILE__)} -rone9/it" system args.empty? ? 'rake test' : args.join(' ') warn "** one9: Error occurred while testing **" unless $?.success? end |