#!/usr/bin/env ruby $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib') require 'rubygems' require 'gruff' require 'grapher' require 'trollop' opts = Trollop::options do banner <<-EOS Takes a stresser csv file and creates graph images from it. Usage: stresser-grapher [options] csv_file where [options] are: EOS opt :report, "The report to generate", :type => String opt :report_definitions, "You can provide your own yaml file - it maps csv columns to data rows in an image", :type => String, :default => "lib/reports.yml" opt :output_dir, "Output directory", :type => String end.merge(:csv_file => ARGV.last) Trollop::die :output_dir, "must be writeable" unless opts[:output_dir] and File.stat(opts[:output_dir]).writable? Trollop::die :output_dir, "must be a directory" unless opts[:output_dir] and File.stat(opts[:output_dir]).directory? Grapher.generate_reports(opts) `open #{ARGV[1]}` if ARGV.last == "open" puts "Done."