Sha256: 954313ca46996783598e73942f108d5b87dfa12447619f3d77eaa26cad56266b
Contents?: true
Size: 1.11 KB
Versions: 3
Compression:
Stored size: 1.11 KB
Contents
module BundlerHelpers extend self def install_bundle(dir) Dir.chdir(dir) do command = "bundle install --gemfile=#{Dir.pwd}/Gemfile --path=#{Dir.pwd}/.bundle" Bundler.with_clean_env do system(command) end $?.exitstatus end end def ensure_installed(dir) gemfile_lock = dir + "/Gemfile.lock" gemfile = dir + "/Gemfile" bundle_environment = dir + "/.bundle/environment.rb" case when File.exist?(gemfile_lock) && File.mtime(gemfile) > File.mtime(gemfile_lock) puts "Gemfile #{gemfile} has changed since it was locked. Re-locking..." FileUtils.rm(gemfile_lock) FileUtils.rm_rf(dir + "/.bundle") when ! File.exist?(bundle_environment) puts "Installing bundle #{gemfile}..." when File.mtime(bundle_environment) < File.mtime(gemfile_lock) puts "#{gemfile_lock} is newer than #{bundle_environment}. Reinstalling" else return false end install_bundle(dir) end def set_gemfile(gemfile) gemfile = File.expand_path(gemfile) ensure_installed(File.dirname(gemfile)) ENV["BUNDLE_GEMFILE"] = gemfile.to_s end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
spork-1.0.0rc4 | features/support/bundler_helpers.rb |
spork-1.0.0rc4-x86-mswin32 | features/support/bundler_helpers.rb |
spork-1.0.0rc4-x86-mingw32 | features/support/bundler_helpers.rb |