Capistrano change command when executed on localhost

78 views Asked by At

I'm new to Capistrano and Ruby/Rake as well.

Since I work locally in Windows, I'm having quite a hard time now and then.. I'm running capistrano-wpcli to push and pull my Wordpress database.

The script do use gunzip in the process, which works fine in Unix, but not in Windows. I found that I can configure the SSHkit by adding this line:

SSHKit.config.command_map[:gunzip] = "gzip -d"

That works fine if I only pull the database, but when I'm pushing, I still want gunzip to be executed on the remote host.

Can I somehow hook into cap wpcli:db:pull to set the config only if that command is run, or if the command is being executed on localhost?

1

There are 1 answers

1
will_in_wi On

This is untested, but you might be able to either override the task by copy/pasting https://github.com/lavmeiker/capistrano-wpcli/blob/master/lib/capistrano/tasks/wpdb.rake#L40

A probably better option (if it works) is to try and create a before action and after action which set and unset the SSHKit command_map.