8 NOW = "#{now.year}-#{'%02d' % now.month}-#{'%02d' % now.day}-" +
9 "#{'%02d' % now.hour}-#{'%02d' % now.min}-#{'%02d' % now.sec}"
11 OPTIONS = OpenStruct.new( :size => 1024,
14 options = OptionParser.new do |opts|
15 opts.on('-c', '--chart [FILENAME]', 'Output passing test times to SVG file at --path') do |c|
16 OPTIONS.chart = c || "#{NOW}-contributors.svg"
19 opts.on('-p', '--path PATH', 'Path prefix for --chart, --diff-chart, and --file') do |p|
23 opts.on('-s', '--size PIXELS', 'Size, in pixels, of --chart and/or --diff-chart') do |s|
31 puts options.summarize
38 attr_accessor :name,:lines
40 def initialize(name,lines)
46 @lines <=> other.lines
53 lines,name = l.match(/^\s*(\d+) (.+)/)[1,2]
54 contributors << Contributor.new(name,lines.to_i)
60 contributors.each do |c|
61 puts "#{c.name}, #{c.lines}"
68 graph = Scruffy::Graph.new
70 graph << Scruffy::Layers::Line.new( :title => 'Rubinius LOC by contributor',
71 :points => contributors.collect { |c| c.lines } )
73 graph.point_markers = contributors.collect { |c| c.name }
75 puts "Rendering chart to #{OPTIONS.chart}"
77 graph.render( :width => OPTIONS.size, :to => OPTIONS.path + OPTIONS.chart )