Class: Pulsar::RunBundleInstall

Inherits:
Object
  • Object
show all
Includes:
Interactor, Validator
Defined in:
lib/pulsar/interactors/run_bundle_install.rb

Instance Method Summary collapse

Methods included from Validator

#context_fail!, included, #validable_properties, #validate_context!

Instance Method Details

#callObject



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/pulsar/interactors/run_bundle_install.rb', line 8

def call
  gemfile_env = "BUNDLE_GEMFILE=#{context.config_path}/Gemfile"
  bundle_env  = "BUNDLE_PATH=#{context.bundle_path}"
  cmd_env     = "#{gemfile_env} #{bundle_env}"
  out_redir   = ENV['DRY_RUN'] ? '> /dev/null 2>&1' : nil
  bundle_cmd  = "#{cmd_env} bundle check || #{cmd_env} bundle install"

  Bundler.with_clean_env do
    Rake.sh("#{bundle_cmd}#{out_redir}")
  end
rescue
  context_fail! $!.message
end