heroku/heroku-buildpack-ruby — pull request #34 by gabrielg (2012-08-30 21:26:33+00:00)
Title: Improves detection of whether a Rake task is defined or not

We ran into this earlier today. A Rails 3 application with a `Rakefile` that isn't broken gives the following output during a push:

```
...
Cleaning up the bundler cache.
-----> Writing config/database.yml to read from DATABASE_URL
-----> Preparing app for Rails asset pipeline
Running: rake assets:precompile
Asset precompilation completed (14.48s)
-----> Rails plugin injection
Injecting rails_log_stdout
...
```

However, a Rails 3 app with a `Rakefile` that raises an exception on load causes the asset precompilation to silently fail:

```
...
Cleaning up the bundler cache.
-----> Writing config/database.yml to read from DATABASE_URL
-----> Rails plugin injection
Injecting rails_log_stdout
...
```

I've patched the buildpack to check for defined Rake tasks in a different manner. If checking for a Rake task fails because of an exception, and not because the task is undefined, the push is aborted (I raised "Bad Rakefile" in this instance):

```

Cleaning up the bundler cache.
-----> Writing config/database.yml to read from DATABASE_URL
!
! rake aborted!
! Bad Rakefile
!
! (See full trace by running task with --trace)
!
! Heroku push rejected, failed to compile Ruby/rails app
```