class Mach5::Config

Attributes

after_commands[RW]
before_commands[RW]
benchmarks[RW]
charts[RW]
output_folder[RW]
project_name[RW]
run_commands[RW]

Public Class Methods

new(project_name, block) click to toggle source
# File lib/mach5-tools/config.rb, line 15
def initialize(project_name, block)
  @project_name = project_name
  @benchmarks = Benchmark.new(Hash.new, Hash.new)
  @charts = []
  @output_folder = "_benchmark"
  instance_eval(&block)
end

Public Instance Methods

add(benchmark) click to toggle source
# File lib/mach5-tools/config.rb, line 46
def add(benchmark)
  @benchmarks.add(@commit_id, benchmark)
end
add_serie(benchmark, &block) click to toggle source
# File lib/mach5-tools/config.rb, line 79
def add_serie(benchmark, &block)
  @serie_label = nil
  @serie_color = nil
  block.call if block
  @chart_series << {commit_id: benchmark.keys[0], benchmark_id: benchmark.values[0], label: @serie_label, color: @serie_color}
end
benchmark(commit_id, &block) click to toggle source
# File lib/mach5-tools/config.rb, line 31
def benchmark(commit_id, &block)
  if commit_id.is_a? Hash
    @commit_id = commit_id.keys[0]
    @benchmarks.tag(@commit_id, commit_id.values[0])
  else
    @commit_id = commit_id
  end
  instance_eval(&block)
  @commit_id = ""
end
categories(cat) click to toggle source
# File lib/mach5-tools/config.rb, line 116
def categories(cat)
  @chart_x_axis_categories = cat
end
chart(chart_id, &block) click to toggle source
# File lib/mach5-tools/config.rb, line 54
def chart(chart_id, &block)
  @chart_series = []
  @chart_type = "line"
  @chart_size = "700x500"
  @chart_title = "Benchmark"
  @chart_x_axis = "X"
  @chart_y_axis = "Y"
  @data_type = "runs_total_time"
  instance_eval(&block)
  chart = Chart.new(chart_id)
  chart.data_type = @data_type
  chart.type = @chart_type
  chart.size = @chart_size
  chart.title = @chart_title
  chart.x_axis = @chart_x_axis
  chart.y_axis = @chart_y_axis
  chart.series = @chart_series
  chart.config = self
  @charts << chart
end
color(str) click to toggle source
# File lib/mach5-tools/config.rb, line 112
def color(str)
  @serie_color = str
end
data_type(type) click to toggle source
# File lib/mach5-tools/config.rb, line 86
def data_type(type)
  @data_type = type
end
exec(command) click to toggle source
# File lib/mach5-tools/config.rb, line 50
def exec(command)
  @commands << command
end
label(str) click to toggle source
# File lib/mach5-tools/config.rb, line 108
def label(str)
  @serie_label = str
end
output(folder) click to toggle source
# File lib/mach5-tools/config.rb, line 42
def output(folder)
  @output_folder = folder
end
size(str) click to toggle source
# File lib/mach5-tools/config.rb, line 100
def size(str)
  @chart_size = str
end
title(str) click to toggle source
# File lib/mach5-tools/config.rb, line 75
def title(str)
  @chart_title = str
end
type(str) click to toggle source
# File lib/mach5-tools/config.rb, line 104
def type(str)
  @chart_type = str
end
x_axis(label, &block) click to toggle source
# File lib/mach5-tools/config.rb, line 90
def x_axis(label, &block)
  @chart_x_axis_categories = nil
  block.call if block
  @chart_x_axis = {label: label, categories: @chart_x_axis_categories}
end
y_axis(label) click to toggle source
# File lib/mach5-tools/config.rb, line 96
def y_axis(label)
  @chart_y_axis = label
end