Module: Benchmark::Driver::BundleInstaller

Defined in:
lib/benchmark/driver/bundle_installer.rb

Overview

TODO: Support Windows… This depends on availability of which(1)

Class Method Summary collapse

Class Method Details

.bundle_install_for(executable) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/benchmark/driver/bundle_installer.rb', line 7

def bundle_install_for(executable)
  ruby_path = IO.popen(['which', executable.command.first], &:read).rstrip
  unless $?.success?
    abort "#{executable.command.first.dump} command was not found to execute `bundle install`"
  end

  bundler_path = Pathname.new(ruby_path).dirname.join('bundle')
  unless bundler_path.executable?
    abort "#{bundler_path.to_s.dump} was not a bundler executable, whose path was guessed from #{ruby_path.dump}"
  end
  bundle = bundler_path.to_s

  Bundler.with_clean_env do
    bundle_check(bundle, ruby: executable.name) || bundle_install(bundle)
  end
end