capistrano / rvm

MIT License
140 stars 47 forks source link

rvm check gets called before all cap commands #45

Open benflex opened 10 years ago

benflex commented 10 years ago

Hello, I'm not sure this is intended or not, but I'm using the capistrano/rvm integration on a multistage setup and any cap command will trigger a rvm:check.

example :

cap staging deploy:cleanup DEBUG [1f658325] Running /usr/local/rvm/bin/rvm version on example.com DEBUG [1f658325] Command: /usr/local/rvm/bin/rvm version DEBUG [1f658325] DEBUG [1f658325] rvm 1.21.15 (master) by Wayne E. Seguin wayneeseguin@gmail.com, Michal Papis mpapis@gmail.com [https://rvm.io/] DEBUG [1f658325] DEBUG [1f658325] Finished in 0.947 seconds with exit status 0 (successful). rvm 1.21.15 (master) by Wayne E. Seguin wayneeseguin@gmail.com, Michal Papis mpapis@gmail.com [https://rvm.io/] DEBUG [a4467073] Running /usr/local/rvm/bin/rvm current on example.com DEBUG [a4467073] Command: /usr/local/rvm/bin/rvm current DEBUG [a4467073] ruby-1.9.3-p327@gemset DEBUG [a4467073] Finished in 0.233 seconds with exit status 0 (successful). ruby-1.9.3-p327@gemset DEBUG [ae0e8890] Running /usr/local/rvm/bin/rvm 1.9.3-p327 do ruby --version on example.com DEBUG [ae0e8890] Command: /usr/local/rvm/bin/rvm 1.9.3-p327 do ruby --version DEBUG [ae0e8890] ruby 1.9.3p327 (2012-11-10 revision 37606) [x86_64-linux] DEBUG [ae0e8890] Finished in 0.364 seconds with exit status 0 (successful). ruby 1.9.3p327 (2012-11-10 revision 37606) [x86_64-linux] DEBUG [2ecdf08f] Running /usr/bin/env ls -x /path/to/releases on example.com DEBUG [2ecdf08f] Command: /usr/bin/env ls -x /path/to/releases DEBUG [2ecdf08f] 20140304092652 20140304135645 20140304140120 20140304140829 20140304141608 DEBUG [2ecdf08f] 20140304142530 20140304152653 DEBUG [2ecdf08f] Finished in 0.116 seconds with exit status 0 (successful). INFO Keeping 7 of 7 deployed releases on example.com INFO No old releases (keeping newest 7) on example.com

Commenting out this line will prevent this : https://github.com/capistrano/rvm/blob/e8c3b810ab181dc3528351cf1a73b071e3b9c570/lib/capistrano/tasks/rvm.rake#L46

Is the rvm:check supposed to be always called ?

Thanks

kirs commented 10 years ago

It is, because any of your tasks can contain execute :ruby, 'something-that-needs-rvm'. We cannot execute it lazily and I made decision to call before each run.

synth commented 9 years ago

We have many tasks that "run_locally" and connect to the server unnecessarily because of this. It would be useful if there were a mechanism where we could define tasks to call or not call this.

jesenko commented 9 years ago

@synth We had the same issue with rvm. As a workaround, I added option of skipping rvm tasks on specified top-level capistrano tasks (see #64). Example:

# deploy.rb
# ...
set :skip_rvm_for_tasks, ['local_tasks:exact_match', /misc/]
# ...

will skip rvm tasks on

cap stage local_tasks:exact_match and any task, containing 'misc', e.g. cap stage some_misc_task