module Mach5::Command::Chart

Public Instance Methods

_all_charts() click to toggle source
# File lib/mach5-tools/command/chart.rb, line 4
def _all_charts
  @config.charts.each do |chart|
    _generate_chart(chart)
  end
end
_check_benchmarks(chart) click to toggle source
# File lib/mach5-tools/command/chart.rb, line 32
def _check_benchmarks(chart)
  benchmarks = []
  chart.series.each do |benchmark|
    filename = _filename(benchmark[:commit_id], benchmark[:benchmark_id])
    benchmarks << "#{benchmark[:commit_id]}.#{benchmark[:benchmark_id]}" unless File.exists?(filename)
  end
  benchmarks
end
_filename(commit_id, benchmark_id) click to toggle source
# File lib/mach5-tools/command/chart.rb, line 41
def _filename(commit_id, benchmark_id)
  if @config.benchmarks.tagged[commit_id]
    "#{File.join(@config.output_folder, @config.benchmarks.tagged[commit_id])}.#{benchmark_id}.json"
  else
    "#{File.join(@config.output_folder, commit_id)}.#{benchmark_id}.json"
  end
end
_generate_chart(chart) click to toggle source
# File lib/mach5-tools/command/chart.rb, line 26
def _generate_chart(chart)
  benchmarks = _check_benchmarks(chart)
  _only_benchmarks(benchmarks) if benchmarks.size > 0
  Kernel.system "phantomjs #{File.join(File.dirname(__FILE__), "../js/chart.js")} #{File.join(File.dirname(__FILE__), "../js")} \"[#{chart.build.to_json.gsub("\"", "\\\"")}]\" #{File.join(@config.output_folder, chart.id)}.png"
end
_only_charts(charts) click to toggle source
# File lib/mach5-tools/command/chart.rb, line 10
def _only_charts(charts)
  @config.charts.each do |chart|
    if charts.include? chart.id
      _generate_chart(chart)
    end
  end
end
_only_new_charts() click to toggle source
# File lib/mach5-tools/command/chart.rb, line 18
def _only_new_charts
  @config.charts.each do |chart|
    unless File.exists?("#{File.join(@config.output_folder, chart.id)}.png")
      _generate_chart(chart)
    end
  end
end
list_charts() click to toggle source
# File lib/mach5-tools/command/chart.rb, line 49
def list_charts
  @config.charts.map(&:id)
end