lib/benchmark_driver/ridkuse.rb in benchmark_driver-0.15.4 vs lib/benchmark_driver/ridkuse.rb in benchmark_driver-0.15.5
- old
+ new
@@ -2,22 +2,22 @@
require 'shellwords'
module BenchmarkDriver
module RidkUse
# Execute "ridk use list" command to get a list of Ruby versions.
- #
+ #
# * "ridk use list" is a sub-command of ridk. It returns a list of installed ruby versions.
# * "ridk" is a helper command tool of RubyInstaller2 for Windows, that to manage the runtime environment of RubyInstaller-2.4 and up.
#
# refer to:
# {The ridk tool · oneclick/rubyinstaller2 Wiki}[https://github.com/oneclick/rubyinstaller2/wiki/The-ridk-tool]
#
def self.ridk_use_list
ruby_list = []
regex = /(\d+)\s-\s([^\s]+)\s\truby\s([^\s]+)\s/
cmd = "ridk use list"
- stdout, status = Open3.capture2e(cmd)
+ stdout, _status = Open3.capture2e(cmd)
stdout.each_line do |line|
if matched = regex.match(line)
idx, rubypath, rubyver = matched[1..3]
ruby_list << rubyver << [idx, "#{rubypath}/bin/ruby.exe"]
@@ -25,10 +25,10 @@
abort "Failed to execute 'ridk use list'"
end
end
Hash[*ruby_list]
end
-
+
# @param [String] version
def self.ruby_path(version)
ruby_list = BenchmarkDriver::RidkUse.ridk_use_list
regex = Regexp.new(version)
matched = ruby_list.keys.find {|k| k =~ regex}