Helabs/jumpup-heroku — pull request #24 by fgrehm (2014-02-07 16:49:46+00:00)
Title: Fail `rake integrate` in case the deploy fails

## :warning: WIP :warning:

I took a first stab at fixing GH-21 and it seems to be working, here are the relevant lines:

```
vagrant@raring-base:/vagrant/testing-pah$ rake integrate
--------------------------------------------------------------------------------
Executing jumpup:heroku:add_remote...
--> Adding Heroku git remotes for app testing-pah
--------------------------------------------------------------------------------
Executing jumpup:heroku:check...
--> Checking if there's already someone integrating to testing-pah
--------------------------------------------------------------------------------
Executing jumpup:heroku:lock...
--> Locking Heroku integration for you (Fabio Rehm)
Setting config vars and restarting testing-pah... done, v30
INTEGRATING_BY: Fabio Rehm
--------------------------------------------------------------------------------
Executing jumpup:start...
git pull --rebase
Current branch master is up to date.
--------------------------------------------------------------------------------
Executing jumpup:bundle_install...
bundle install --quiet
--------------------------------------------------------------------------------
Executing db:migrate...
--------------------------------------------------------------------------------
Executing spec...
...........
Coverage report generated for RSpec to /vagrant/testing-pah/coverage. 1 / 1 LOC (100.0%) covered.
--------------------------------------------------------------------------------
Executing jumpup:coverage_verify...
ruby /usr/local/rvm/gems/ruby-2.1.0@testing-pah/bundler/gems/jumpup-c790d9a61710/test/coverage_test.rb

....

Congratulations! Your coverage is 100%!
Finished tests in 0.010070s, 99.3097 tests/s, 99.3097 assertions/s.
1 tests, 1 assertions, 0 failures, 0 errors, 0 skips

ruby -v: ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-linux]
--------------------------------------------------------------------------------
Executing jumpup:finish...
git push

.....

Everything up-to-date
--------------------------------------------------------------------------------
Executing jumpup:heroku:deploy...
--> [testing-pah] Backing up database

HEROKU_POSTGRESQL_PINK_URL (DATABASE_URL) ----backup---> b006

Capturing... done
Storing... done

--> [testing-pah] Pushing to heroku.com
Fetching repository, done.
Counting objects: 7, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 432 bytes, done.
Total 4 (delta 3), reused 0 (delta 0)

-----> Ruby app detected
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-2.1.0
-----> Installing dependencies using 1.5.2
Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
The path `/tmp/jumpup-heroku` does not exist.
Bundler Output: The path `/tmp/jumpup-heroku` does not exist.
!
! Failed to install gems via Bundler.
!

! Push rejected, failed to compile Ruby app

To git@heroku.com:testing-pah.git
! [remote rejected] HEAD -> master (pre-receive hook declined)
error: failed to push some refs to 'git@heroku.com:testing-pah.git'
rake aborted!
Error while running git push git@heroku.com:testing-pah.git HEAD:master
false
/vagrant/jumpup-heroku/lib/jumpup/heroku/integrate.rb:114:in `block in run_with_clean_env'
/usr/local/rvm/gems/ruby-2.1.0@global/gems/bundler-1.5.2/lib/bundler.rb:229:in `block in with_clean_env'
/usr/local/rvm/gems/ruby-2.1.0@global/gems/bundler-1.5.2/lib/bundler.rb:216:in `with_original_env'
/usr/local/rvm/gems/ruby-2.1.0@global/gems/bundler-1.5.2/lib/bundler.rb:222:in `with_clean_env'
/vagrant/jumpup-heroku/lib/jumpup/heroku/integrate.rb:102:in `run_with_clean_env'
/vagrant/jumpup-heroku/lib/jumpup/heroku/integrate.rb:155:in `push'
/vagrant/jumpup-heroku/lib/jumpup/heroku/integrate.rb:44:in `deploy'
/vagrant/jumpup-heroku/lib/jumpup/heroku/integrate.rb:7:in `deploy'
/vagrant/jumpup-heroku/lib/tasks/integrate.rake:29:in `block (3 levels) in '
/usr/local/rvm/gems/ruby-2.1.0@testing-pah/bundler/gems/jumpup-c790d9a61710/lib/tasks/integrate.rake:77:in `block (3 levels) in '
/usr/local/rvm/gems/ruby-2.1.0@testing-pah/bundler/gems/jumpup-c790d9a61710/lib/tasks/integrate.rake:8:in `p80'
/usr/local/rvm/gems/ruby-2.1.0@testing-pah/bundler/gems/jumpup-c790d9a61710/lib/tasks/integrate.rake:75:in `block (2 levels) in '
/usr/local/rvm/gems/ruby-2.1.0@testing-pah/bundler/gems/jumpup-c790d9a61710/lib/tasks/integrate.rake:74:in `each'
/usr/local/rvm/gems/ruby-2.1.0@testing-pah/bundler/gems/jumpup-c790d9a61710/lib/tasks/integrate.rake:74:in `block in '
/usr/local/rvm/gems/ruby-2.1.0@testing-pah/bin/ruby_executable_hooks:15:in `eval'
/usr/local/rvm/gems/ruby-2.1.0@testing-pah/bin/ruby_executable_hooks:15:in `

'
Tasks: TOP => jumpup:heroku:deploy
(See full trace by running task with --trace)

vagrant@raring-base:/vagrant/testing-pah$ echo $?
1
```

I'll now do a bit of a cleanup on the mess I created :smile: