checking the dry-run flag from within a task

56 views
Skip to first unread message

Pharrisee

unread,
Dec 15, 2009, 2:27:46 PM12/15/09
to Capistrano
Lo,

I've got a highly customised set of tasks that have both local and
remote parts to them, when I use the dry-run flag the remote tasks
honour the flag, but, obviously, the local tasks don't honour it. I
understand why it is but I would like to do something to change this.

I've created a normal ruby method which runs all my local stuff:

def local(cmd_to_run)
puts %x[cmd_to_run)
end

called like this:

local("rm -rf #{workdir}/wps_expanded")

Simple enough stuff which works exactly how I need it to.

My question is: Is there any way of telling when capistrano is running
under the dry-run flag?

Thanks in advance.

Lee Hambley

unread,
Dec 15, 2009, 4:32:56 PM12/15/09
to capis...@googlegroups.com
I'm not sure it ever came up that anyone asked about the "local" thing for use with dry-run, I honestly have never used it, I always make my calls with pure ruby. Even then I'm not sure whether or not it honors it.

The FileUtils class should provide the behavior you need, maybe in this way you can have cap honor the dry run flag, either way - let us know how you fair. (maybe we need a patch)

Also, the dry-run thing doesn't work, almost at all - because of dependencies on variables only set at runtime; but no one has heart, or feature request to take it out :)

-- Lee Hambley

Twitter: @leehambley | @capistranorb
Reply all
Reply to author
Forward
0 new messages