Module: One9::Report
Instance Method Summary collapse
- #changes(query = nil) ⇒ Object
- #later(meths, stacks) ⇒ Object
- #lines(*args) ⇒ Object
- #list(*args) ⇒ Object
- #lock_file ⇒ Object
- #marshal_file ⇒ Object
- #print(meths, stacks) ⇒ Object
- #quickfix(*args) ⇒ Object
- #report_exists! ⇒ Object
Instance Method Details
#changes(query = nil) ⇒ Object
20 21 22 23 24 25 |
# File 'lib/one9/report.rb', line 20 def changes(query=nil) meths = One9.load_methods meths = query_methods(meths, query) table meths, :fields => [:name, :message, :type], :headers => {:name => 'method', :stacks => 'lines'} end |
#later(meths, stacks) ⇒ Object
53 54 55 56 |
# File 'lib/one9/report.rb', line 53 def later(meths, stacks) File.unlink(lock_file) if File.exists?(lock_file) at_exit { print_and_save(meths, stacks) } end |
#lines(*args) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/one9/report.rb', line 13 def lines(*args) (args) meths, stacks = setup results = method_lines(meths, stacks, args[0]) table results.map {|m,l| [m.name, l] } , :change_fields => [:method, :line] end |
#list(*args) ⇒ Object
6 7 8 9 10 11 |
# File 'lib/one9/report.rb', line 6 def list(*args) (args) meths, stacks = setup meths = query_methods(meths, args[0]) print(meths, stacks) end |
#lock_file ⇒ Object
62 63 64 |
# File 'lib/one9/report.rb', line 62 def lock_file "#{One9.dir}/report.lock" end |
#marshal_file ⇒ Object
58 59 60 |
# File 'lib/one9/report.rb', line 58 def marshal_file "#{One9.dir}/one9.marshal" end |
#print(meths, stacks) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/one9/report.rb', line 37 def print(meths, stacks) FileUtils.touch lock_file if File.exists? One9.dir Hirb.enable results = ReportMethod.create(meths, stacks) results = results.select {|e| e.count > 0 } puts "\n** One9 Report **" return puts('No 1.9 changes found') if results.size.zero? table results, :fields => [:name, :count, :message, :type, :stacks], :headers => {:name => 'method', :stacks => 'lines'}, :filters => { :stacks => [:join, ','] } end |
#quickfix(*args) ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'lib/one9/report.rb', line 27 def quickfix(*args) (args) meths, stacks = setup results = method_lines(meths, stacks, args[0]) results.map! {|meth, trace| trace[/^([^:]+:\d+:?)(.*)/] ? "#{$1} #{meth.name} - #{meth.}" : trace } puts results end |
#report_exists! ⇒ Object
49 50 51 |
# File 'lib/one9/report.rb', line 49 def report_exists! raise(NoReportError) unless File.exists? marshal_file end |