rails/rails — pull request #12531 by iamvery (2013-10-14 16:45:30+00:00)
Title: Explicitly exit with status "1" for create and drop task failures

* Any exceptions raised during the `create` and `drop` tasks are caught
in order to print a "pretty" message to the user. Unfortunately doing
so prevents rake from aborting with a non-zero exit status to the shell.
* A non-zero exit status allows subsequent shell commands to be chained
together such as: `rake db:reset test:prepare && rspec && cap deploy`
(if you're feeling brave :)

---

## Summary
The idea is that any failing rake task should return a non-zero exit status for easy chain-able shell commands.

## Observation
Before this change, the result of an example chain looks something like https://gist.github.com/iamvery/6978403. Notice, the inability to drop the database doesn't prevent `db:reset` from trying the rest of its sequence. Additionally, the chained `rspec` shell command tries to do its thing (ignore the bundle error).

## Solution
After this change, the chain immediately exits with a status code "1". https://gist.github.com/iamvery/6978411. This not only prevents the task sequence from running its course, it also prevents any chained commands from executing in the shell.

## Additional Information
I was hesitant to submit a PR without tests, but the test suite appears to be unaffected by this change. I believe that is due to them covering "happy paths". If additional work needs to be done, please let me know!

Thank you for entertaining my request! Let me know if I must give it more attention to make it acceptable :smile: