Class: Mach5::Config
- Inherits:
-
Object
- Object
- Mach5::Config
- Defined in:
- lib/mach5-tools/config.rb
Instance Attribute Summary collapse
-
#after_commands ⇒ Object
Returns the value of attribute after_commands.
-
#before_commands ⇒ Object
Returns the value of attribute before_commands.
-
#benchmarks ⇒ Object
Returns the value of attribute benchmarks.
-
#charts ⇒ Object
Returns the value of attribute charts.
-
#output_folder ⇒ Object
Returns the value of attribute output_folder.
-
#project_name ⇒ Object
Returns the value of attribute project_name.
-
#run_commands ⇒ Object
Returns the value of attribute run_commands.
Instance Method Summary collapse
- #add(benchmark) ⇒ Object
- #add_serie(benchmark, &block) ⇒ Object
- #benchmark(commit_id, &block) ⇒ Object
- #categories(cat) ⇒ Object
- #chart(chart_id, &block) ⇒ Object
- #color(str) ⇒ Object
- #data_type(type) ⇒ Object
- #exec(command) ⇒ Object
-
#initialize(project_name, block) ⇒ Config
constructor
A new instance of Config.
- #label(str) ⇒ Object
- #output(folder) ⇒ Object
- #size(str) ⇒ Object
- #title(str) ⇒ Object
- #type(str) ⇒ Object
- #x_axis(label, &block) ⇒ Object
- #y_axis(label) ⇒ Object
Constructor Details
#initialize(project_name, block) ⇒ Config
Returns a new instance of Config.
15 16 17 18 19 20 21 |
# 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 |
Instance Attribute Details
#after_commands ⇒ Object
Returns the value of attribute after_commands.
9 10 11 |
# File 'lib/mach5-tools/config.rb', line 9 def after_commands @after_commands end |
#before_commands ⇒ Object
Returns the value of attribute before_commands.
7 8 9 |
# File 'lib/mach5-tools/config.rb', line 7 def before_commands @before_commands end |
#benchmarks ⇒ Object
Returns the value of attribute benchmarks.
12 13 14 |
# File 'lib/mach5-tools/config.rb', line 12 def benchmarks @benchmarks end |
#charts ⇒ Object
Returns the value of attribute charts.
13 14 15 |
# File 'lib/mach5-tools/config.rb', line 13 def charts @charts end |
#output_folder ⇒ Object
Returns the value of attribute output_folder.
11 12 13 |
# File 'lib/mach5-tools/config.rb', line 11 def output_folder @output_folder end |
#project_name ⇒ Object
Returns the value of attribute project_name.
10 11 12 |
# File 'lib/mach5-tools/config.rb', line 10 def project_name @project_name end |
#run_commands ⇒ Object
Returns the value of attribute run_commands.
8 9 10 |
# File 'lib/mach5-tools/config.rb', line 8 def run_commands @run_commands end |
Instance Method Details
#add(benchmark) ⇒ Object
46 47 48 |
# File 'lib/mach5-tools/config.rb', line 46 def add(benchmark) @benchmarks.add(@commit_id, benchmark) end |
#add_serie(benchmark, &block) ⇒ Object
79 80 81 82 83 84 |
# 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) ⇒ Object
31 32 33 34 35 36 37 38 39 40 |
# 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) ⇒ Object
116 117 118 |
# File 'lib/mach5-tools/config.rb', line 116 def categories(cat) @chart_x_axis_categories = cat end |
#chart(chart_id, &block) ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# 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) ⇒ Object
112 113 114 |
# File 'lib/mach5-tools/config.rb', line 112 def color(str) @serie_color = str end |
#data_type(type) ⇒ Object
86 87 88 |
# File 'lib/mach5-tools/config.rb', line 86 def data_type(type) @data_type = type end |
#exec(command) ⇒ Object
50 51 52 |
# File 'lib/mach5-tools/config.rb', line 50 def exec(command) @commands << command end |
#label(str) ⇒ Object
108 109 110 |
# File 'lib/mach5-tools/config.rb', line 108 def label(str) @serie_label = str end |
#output(folder) ⇒ Object
42 43 44 |
# File 'lib/mach5-tools/config.rb', line 42 def output(folder) @output_folder = folder end |
#size(str) ⇒ Object
100 101 102 |
# File 'lib/mach5-tools/config.rb', line 100 def size(str) @chart_size = str end |
#title(str) ⇒ Object
75 76 77 |
# File 'lib/mach5-tools/config.rb', line 75 def title(str) @chart_title = str end |
#type(str) ⇒ Object
104 105 106 |
# File 'lib/mach5-tools/config.rb', line 104 def type(str) @chart_type = str end |
#x_axis(label, &block) ⇒ Object
90 91 92 93 94 |
# 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) ⇒ Object
96 97 98 |
# File 'lib/mach5-tools/config.rb', line 96 def y_axis(label) @chart_y_axis = label end |