Class: Pulsar::RunCapistrano

Inherits:
Object
  • Object
show all
Includes:
Interactor, Validator
Defined in:
lib/pulsar/interactors/run_capistrano.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_capistrano.rb', line 8

def call
  Dir.chdir(context.cap_path) do
    gemfile_env = "BUNDLE_GEMFILE=#{context.config_path}/Gemfile"
    bundle_env  = "BUNDLE_PATH=#{context.bundle_path}"
    cap_opts    = ENV['DRY_RUN'] ? '--dry-run ' : nil
    out_redir   = ENV['DRY_RUN'] ? '> /dev/null 2>&1' : nil
    cap_cmd     = "bundle exec cap #{cap_opts}#{context.environment} #{context.task}"

    Rake.sh("#{gemfile_env} #{bundle_env} #{cap_cmd}#{out_redir}")
  end
rescue
  context_fail! $!.message
end