rvm / rvm1-capistrano3

RVM 1.x Capistrano 3.x integration gem
73 stars 35 forks source link

rvm1:hook is run even when only executing a local command #46

Closed rhomeister closed 10 years ago

rhomeister commented 10 years ago

I'm running into the following problem. When I want to run a local command using run_locally, Capistrano connects to my servers to setup the rvm1-capistrano3 scripts. However, I want to run a local command before my servers are provisioned, so this local command is failing. Is there a workaround for this?

mpapis commented 10 years ago

run the command locally, @leehambley mentioned in some tickets that run_locally is a mistake, try something like:

output = `code for local server 2>&1`
status = $?.to_i

you can find more ways to run local commands here: http://tech.natemurray.com/2007/03/ruby-shell-commands.html

rhomeister commented 10 years ago

Thanks for your suggestion. Much better. Closing...

rhomeister commented 10 years ago

Sorry, spoke too soon. Even with a task that uses a local command, rvm1:hook is still executing.

mpapis commented 10 years ago

this are limitations of sshkit, there is no way to set command_map per host/role and to make dependent task execution on it ... you could do a trick to define extra :rvm role and:

set :rvm1_roles, :rvm

in your deploy.rb - the task would be called but the code gets executed only when there is matching servers in the command line via stages ... but then there is https://github.com/rvm/rvm1-capistrano3/blob/master/lib/rvm1/tasks/capistrano3.rake#L47-L49 which makes rvm1:hook execute, let me know if that trick works

mpapis commented 10 years ago

no feedback in over two weeks - closing the issue, please let me know if you still need help and I will reopen