Class: KapostDeploy::Heroku::Shell
- Inherits:
-
Object
- Object
- KapostDeploy::Heroku::Shell
- Defined in:
- lib/kapost_deploy/heroku/shell.rb
Overview
Wraps the heroku shell environment Derived from github.com/fastestforward/heroku_san
Instance Method Summary collapse
-
#initialize(app) ⇒ Shell
constructor
A new instance of Shell.
- #run(command) ⇒ Object
- #sh(command) ⇒ Object
Constructor Details
#initialize(app) ⇒ Shell
Returns a new instance of Shell.
11 12 13 |
# File 'lib/kapost_deploy/heroku/shell.rb', line 11 def initialize(app) self.app = app end |
Instance Method Details
#run(command) ⇒ Object
15 16 17 |
# File 'lib/kapost_deploy/heroku/shell.rb', line 15 def run(command) sh("run " + command) end |
#sh(command) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/kapost_deploy/heroku/shell.rb', line 19 def sh(command) preflight_check_for_cli cmd = command.split(" ") cmd += ["--app", app] cmd << "--exit-code" if command =~ /^run/ show_command = cmd.join(" ") ok = ::Bundler.with_clean_env { system "heroku", *cmd } ok or fail "Command failed with status (#{$CHILD_STATUS.exitstatus}): [heroku #{show_command}]" end |