Rails Application deploys now fail to build when Rake tasks cannot be detected
Change effective on 23 March 2016
When deploying a Ruby application the buildpack determines if a rake task is present in an application before attempting to run that task. Previously due to legacy behavior, if the detection task failed the build would continue even if your application depended on a
$ rake assets:precompile to run. Now Rails applications that raise an error while detecting rake tasks will fail to deploy until that error is fixed. This change helps to prevent accidentally deploying an invalid version of an application that does not contain assets. Behavior is described in Heroku Ruby Support.
A common cause for Rake tasks failing to be detected, is an error in the Rakefile. The most common error is requiring a library that is in the
test group of the Gemfile and therefore not available when deploying to production. One mitigation strategy is to rescue from a
LoadError and ignore the exception in production.
begin require 'minitest/autorun' rescue LoadError => e raise e unless ENV['RAILS_ENV'] == "production" end