forked from engineyard/eycap
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
49 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
Capistrano::Configuration.instance(:must_exist).load do | ||
|
||
def reformat_code(code) | ||
code.split("\n").map(&:strip).join("; ") | ||
end | ||
|
||
# Allow parallel execution of rvm and non rvm commands | ||
def run_rvm_or(command_rvm, command_else = "true") | ||
parallel do |session| | ||
command_else = reformat_code(command_else) | ||
rvm_role = fetch(:rvm_require_role) | ||
if Capistrano.const_defined?(:RvmMethods) | ||
# command_with_shell is defined in RvmMethods so rvm/capistrano has to be required first | ||
command_rvm = command_with_shell(reformat_code(command_rvm), fetch(:rvm_shell)) | ||
if rvm_role # mixed | ||
session.when "in?(:#{rvm_role})", command_rvm | ||
session.else command_else | ||
else # only rvm | ||
session.else command_rvm | ||
end | ||
else # no rvm | ||
session.else command_else | ||
end | ||
end | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters