Class: App

Inherits:
Thor
  • Object
show all
Defined in:
bin/mach5

Instance Method Summary collapse

Instance Method Details

#benchmarkObject



13
14
15
16
17
18
19
20
21
22
23
24
# File 'bin/mach5', line 13

def benchmark
  runner = Mach5::Runner.new(eval(File.open("Mach5file").readlines.join))
  if options.list
    runner.list_benchmarks.each do |benchmark|
      puts benchmark
    end
  elsif options.only
    runner.benchmark(only: options.only)
  else
    runner.benchmark(all: options.all)
  end
end

#chartObject



30
31
32
33
34
35
36
37
38
39
40
41
# File 'bin/mach5', line 30

def chart
  runner = Mach5::Runner.new(eval(File.open("Mach5file").readlines.join))
  if options.list
    runner.list_charts.each do |chart|
      puts chart
    end
  elsif options.only
    runner.chart(only: options.only)
  else
    runner.chart(all: options.all)
  end
end

#initObject



49
50
51
52
53
54
55
56
57
# File 'bin/mach5', line 49

def init
  if File.exists?("Mach5file")
    puts "There is already a Mach5file. If you want to overwrite it, try to remove it first and then generate a new one."
  else
    File.open("Mach5file", "w") do |f|
      f.write(File.open(File.join(File.dirname(__FILE__), "../lib/templates/Mach5file")).readlines.join.gsub("{{PROJECT_NAME}}", File.basename(Dir.getwd)))
    end
  end
end

#versionObject



44
45
46
# File 'bin/mach5', line 44

def version
  puts "v#{File.open(File.join(File.dirname(__FILE__), "../VERSION")).readlines.join}"
end