Sha256: ce9d8bdc084e976e8d0acbafd23e7818aa5d26731e0bc18f815fc741f8bd7c1f
Contents?: true
Size: 1.19 KB
Versions: 1
Compression:
Stored size: 1.19 KB
Contents
module Mach5 def self.configure(project_name, &block) Config.new(project_name, block) end class Config attr_accessor :before_commands attr_accessor :run_commands attr_accessor :after_commands attr_accessor :project_name attr_accessor :output_folder attr_accessor :benchmarks def initialize(project_name, block) @project_name = project_name @benchmarks = Benchmark.new(Hash.new, Hash.new) instance_eval(&block) end %w{before run after}.each do |method| define_method(method) do |&block| instance_variable_set("@commands", []) instance_eval(&block) instance_variable_set("@#{method}_commands", instance_variable_get("@commands")) end end 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 def output(folder) @output_folder = folder end def add(benchmark) @benchmarks.add(@commit_id, benchmark) end def exec(command) @commands << command end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mach5-tools-0.1.0 | lib/mach5-tools/config.rb |