Module: ORS::Helpers::PrepareHelpers

Included in:
ORS::Helpers
Defined in:
lib/ors/helpers.rb

Overview

Helpers for preparing to run a command on a server

Instance Method Summary collapse

Instance Method Details

#prepare_environmentObject



26
27
28
# File 'lib/ors/helpers.rb', line 26

def prepare_environment
  [%({ cd #{ORS.config[:deploy_directory]} > /dev/null; })]
end

#prepare_environment_with_rvmObject



30
31
32
# File 'lib/ors/helpers.rb', line 30

def prepare_environment_with_rvm
  [%(source ~/.rvm/scripts/rvm)] + prepare_environment
end

#prepare_initial_environmentObject



34
35
36
37
38
39
40
41
42
43
# File 'lib/ors/helpers.rb', line 34

def prepare_initial_environment
  # We do a source and a git checkout here because the master
  # branch may not always contain the proper rvmrc/Gemfile
  # we need when setting up the rest of the deploy
  prepare_environment_with_rvm + [
                                  %(git checkout -q -f #{ORS.config[:remote]}/#{ORS.config[:branch]}),
                                  %(git reset --hard),
                                  %(source .rvmrc)
                                 ]
end