Sha256: c8b745b2638de133ae95b521b12d61259231d5f2a525771611b8b2370c152042

Contents?: true

Size: 731 Bytes

Versions: 17

Compression:

Stored size: 731 Bytes

Contents

require 'shellwords'

module BenchmarkDriver
  module Rbenv
    # @param [String] version
    def self.ruby_path(version)
      path = `RBENV_VERSION='#{version}' rbenv which ruby`.rstrip
      unless $?.success?
        abort "Failed to execute 'rbenv which ruby'"
      end
      path
    end

    # @param [String] full_spec - "2.5.0", "2.5.0 --jit", "JIT::2.5.0 --jit", etc.
    def self.parse_spec(full_spec)
      name, spec = full_spec.split('::', 2)
      spec ||= name # if `::` is not given, regard whole string as spec
      version, *args = spec.shellsplit
      BenchmarkDriver::Config::Executable.new(
        name: name,
        command: [BenchmarkDriver::Rbenv.ruby_path(version), *args],
      )
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
benchmark_driver-0.16.5 lib/benchmark_driver/rbenv.rb
benchmark_driver-0.16.4 lib/benchmark_driver/rbenv.rb
benchmark_driver-0.16.3 lib/benchmark_driver/rbenv.rb
benchmark_driver-0.16.2 lib/benchmark_driver/rbenv.rb
benchmark_driver-0.16.1 lib/benchmark_driver/rbenv.rb
benchmark_driver-0.16.0 lib/benchmark_driver/rbenv.rb
benchmark_driver-0.15.18 lib/benchmark_driver/rbenv.rb
benchmark_driver-0.15.17 lib/benchmark_driver/rbenv.rb
benchmark_driver-0.15.16 lib/benchmark_driver/rbenv.rb
benchmark_driver-0.15.15 lib/benchmark_driver/rbenv.rb
benchmark_driver-0.15.14 lib/benchmark_driver/rbenv.rb
benchmark_driver-0.15.13 lib/benchmark_driver/rbenv.rb
benchmark_driver-0.15.12 lib/benchmark_driver/rbenv.rb
benchmark_driver-0.15.11 lib/benchmark_driver/rbenv.rb
benchmark_driver-0.15.10 lib/benchmark_driver/rbenv.rb
benchmark_driver-0.15.9 lib/benchmark_driver/rbenv.rb
benchmark_driver-0.15.8 lib/benchmark_driver/rbenv.rb