xing / cap_gun

Super simple capistrano deployment notifications. Forked from relevance/cap_gun.
MIT License
3 stars 3 forks source link

Make cap_gun:email recipe respect capistrano's dry_run option #4

Closed edennis closed 11 years ago

edennis commented 11 years ago

I've adapted the cap_gun:email recipe to respect capistrano's dry_run option (cap -n) so that no mail is sent went testing a deploy.

boosty commented 11 years ago

Hey, this is a good idea!

However, it does fail when calling cap --dry-run cap_gun:email directly:

$ be cap --dry-run cap_gun:email
    triggering start callbacks for `cap_gun:email'
  * 2013-08-08 10:36:07 executing `multistage:ensure'
*** Defaulting to `edge'
  * 2013-08-08 10:36:07 executing `edge'
    triggering after callbacks for `multistage:ensure'
  * 2013-08-08 10:36:07 executing `cap_gun:email'
  * executing "ls -x /virtual/activities/releases"
  * executing "cat /virtual/activities/current/REVISION"
fatal: bad flag '--pretty=format:%h:%s' used after filename

This must be caused by the necessary revision variables not being set on a dry run: https://github.com/xing/cap_gun/blob/master/lib/cap_gun/presenter.rb#L60

Could you investigate? Maybe just checking for dry_run at an earlier point is a pragmatic solution.

edennis commented 11 years ago

Ok, I've redone the PR. Please try this one out: https://github.com/xing/cap_gun/pull/5