module BenchmarkDriver::Rvm
def self.ruby_path(version)
-
version
(String
) --
def self.ruby_path(version) path = if version == 'system' system_ruby_path else rubies = Pathname.new("#{ENV['rvm_path']}/rubies") abort "Rubies path '#{rubies}' not found" unless rubies.exist? ruby_list = rubies.children.select { |path| path.directory? && path.basename.to_s.match(version) } ruby_root = ruby_list.detect { |path| path.basename.to_s == version } || ruby_list[0] abort "Version '#{version}' not found" unless ruby_root "#{ruby_root}/bin/ruby" end unless File.exist?(path) abort "Binary '#{path}' not found" end path end