exe/benchmark-driver in benchmark_driver-0.7.0 vs exe/benchmark-driver in benchmark_driver-0.7.1
- old
+ new
@@ -1,10 +1,9 @@
#!/usr/bin/env ruby
$:.unshift File.expand_path('../lib', __dir__)
require 'benchmark/driver'
-require 'benchmark/driver/bundle_installer'
require 'benchmark/driver/yaml_parser'
require 'optparse'
require 'yaml'
#
@@ -15,22 +14,18 @@
o.banner = "Usage: #{File.basename($0, '.*')} [options] [YAML]"
o.on('-e', '--executables [EXECS]', 'Ruby executables (e1::path1,arg1,...; e2::path2,arg2;...)') do |e|
abort '-e, --executable must take argument but not given' if e.nil?
options[:execs] ||= []
e.split(';').each do |name_path|
- name, path = name_path.split('::', 2)
- options[:execs] << Benchmark::Driver::Configuration::Executable.new(name, path ? path.split(',') : [name])
+ options[:execs] << Benchmark::Driver::Configuration::Executable.parse(name_path)
end
end
o.on('--rbenv [VERSIONS]', 'Ruby executables in rbenv (x.x.x,arg1,...;y.y.y,arg2,...;...)') do |r|
abort '--rbenv must take argument but not given' if r.nil?
options[:execs] ||= []
r.split(';').each do |spec|
- version, *args = spec.split(',')
- path = `RBENV_VERSION='#{version}' rbenv which ruby`.rstrip
- abort "Failed to execute 'rbenv which ruby'" unless $?.success?
- options[:execs] << Benchmark::Driver::Configuration::Executable.new(version, [path, *args])
+ options[:execs] << Benchmark::Driver::Configuration::Executable.parse_rbenv(spec)
end
end
o.on('-o', '--output [TYPE]', 'Specify output type (ips, time, memory, markdown)') do |t|
abort '-o, --output must take argument but not given' if t.nil?
options[:output] = t
@@ -80,31 +75,25 @@
#
# Proceed parsed options
#
config = Benchmark::Driver::Configuration.new(jobs)
-config.runner_options = Benchmark::Driver::Configuration::RunnerOptions.new(:exec)
+config.runner_options = Benchmark::Driver::Configuration::RunnerOptions.new
config.output_options = Benchmark::Driver::Configuration::OutputOptions.new(:ips)
-if options.key?(:execs)
- # Proceed execs first for --bundler
- config.runner_options.executables = options.delete(:execs)
-end
-
options.each do |key, value|
case key
when :bundler
- config.runner_options.executables.each do |executable|
- Benchmark::Driver::BundleInstaller.bundle_install_for(executable)
- executable.command << '-rbundler/setup'
- end
+ config.runner_options.bundler = value
when :compare
config.output_options.compare = value
when :dir
dir = File.dirname(path)
config.jobs.each do |job|
job.prelude = "__dir__ = #{dir.dump}.freeze; #{job.prelude}"
end
+ when :execs
+ config.runner_options.executables = options.delete(:execs)
when :filter
filter = Regexp.compile(value)
config.jobs.select! do |job|
job.name.match(filter)
end