rubyist / guard-rake

guard-rake runs a rake task when files change
MIT License
94 stars 32 forks source link

Recover from exceptions #12

Closed nanodeath closed 11 years ago

nanodeath commented 12 years ago

Guard::Rake works pretty well, but it chokes on exceptions. Some of the actions in my Rakefile include shelling out to the LESS compiler (for example) and throwing an exception if there's an error compiling the file. This is necessary to fail the regular non-Guarded build. However, Guard (and/or Guard::Rake) doesn't like unhandled exceptions and basically dies. Ideally, I would just get the error/warning in the console, make the fix and save, and things would just go again. Instead, I have to not throw exceptions (or catch them instead, myself), push messages into a buffer, and then check in my main target to see if any exceptions occurred, and exit if not in Guard mode. Pretty hacky. So I guess what I'm looking for is a code change in guard-rake to swallow exceptions (if possible) and/or guidance on how I should write my Rakefile to deal with the aforementioned scenario.

Thanks!

joergschiller commented 12 years ago

Hi,

i tried to fix that for me: https://github.com/joergschiller/guard-rake/commit/b641e6283805e428cbe58fa96402e7570fccb9b7

Greetings Joerg

muellerj commented 11 years ago

I can reproduce the same behaviour. Any exception (a failing test for example) is enough to cause guard-rake to be kicked off the list of active guards.

@joergschiller: Your patched version works well for me. Would you mind creating a pull request for the official repo?

rubyist commented 11 years ago

This should be fixed now in v0.0.8