seattlerb/rake-remote_task — pull request #21 by jleo3 (2013-02-10 15:49:06+00:00)
Title: :domain_prefix option added for Vagrant integration

The basis for this change is discussed in greater detail in Vlad Issued #37.

This change adds a :domain_prefix option which will allow a Vagrant user to execute commands through RRT by way of Vlad. To my knowledge the only way to execute a command to a Vagrant VM is the following:

vagrant ssh -c ''

That "-c" part is what looks to be a non-starter with RRT in it's current state. With this change, a Vlad user wishing to deploy to Vagrant machines could set their configuration this way:

set :domain, "vagrant_vm"
set :ssh_cmd, %w[vagrant ssh]
set :domain_prefix, "-c"

I kept the :domain_prefix as generic as possible should there be any other use cases out there. I initially tried wiring :domain_prefix up as an array so that multiple commands could be passed in. But as of now there are no additional commands a Vagrant user can pass before executing a remote command.

You'll notice that in the last line of my test case I hacked a teardown. A way to reset :domain_prefix to nil without making ancillary changes to either the test file or the production code was not immediately obvious to me. I'm open to a better way to do this.