Load capistrano-rvm only in staging environment
- Dominant language
- Ruby
- Stars
- 140
- Forks
- 44
- PR merge metrics
- No merged PRs in 30d
Description
Due to historic reasons i use rbenv in production and rvm in staging environment.
The problem is now, that I cannot load capistrano-rvm in the staging.rb cap file:
```
bundle exec cap staging console
cap aborted!
NoMethodError: undefined method `each' for nil:NilClass
/Users/user/.rvm/gems/ruby-1.9.3-p448/gems/capistrano-rvm-0.1.1/lib/capistrano/tasks/rvm.rake:38:in `block (2 levels) in '
/Users/user/.rvm/gems/ruby-1.9.3-p448/gems/capistrano-3.2.1/lib/capistrano/dsl/task_enhancements.rb:12:in `block in after'
/Users/user/.rvm/gems/ruby-1.9.3-p448/gems/capistrano-3.2.1/lib/capistrano/application.rb:15:in `run'
/Users/user/.rvm/gems/ruby-1.9.3-p448/gems/capistrano-3.2.1/bin/cap:3:in `'
/Users/user/.rvm/gems/ruby-1.9.3-p448/bin/cap:23:in `load'
/Users/user/.rvm/gems/ruby-1.9.3-p448/bin/cap:23:in `'
/Users/user/.rvm/gems/ruby-1.9.3-p448/bin/ruby_executable_hooks:15:in `eval'
/Users/user/.rvm/gems/ruby-1.9.3-p448/bin/ruby_executable_hooks:15:in `'
Tasks: TOP => rvm:hook
(See full trace by running task with --trace)
```
But if I move the "require 'capistrano/rvm'" it in the Capfile, it also gets loaded in the production environment:
```
bundle exec cap production console
DEBUG [3ee05cd7] Running /usr/bin/env [ -d ~/.rvm ] on mywebsite.com
DEBUG [3ee05cd7] Command: [ -d ~/.rvm ]
DEBUG [3ee05cd7] Finished in 1.284 seconds with exit status 1 (failed).
DEBUG [c3bf6f47] Running /usr/bin/env [ -d /usr/local/rvm ] on mywebsite.com
DEBUG [c3bf6f47] Command: [ -d /usr/local/rvm ]
DEBUG [c3bf6f47] Finished in 0.083 seconds with exit status 1 (failed).
DEBUG [dbe7a15a] Running ~/.rvm/bin/rvm version on mywebsite.com
DEBUG [dbe7a15a] Command: ~/.rvm/bin/rvm version
cap aborted!
SSHKit::Command::Failed: rvm exit status: 127
rvm stdout: Nothing written
rvm stderr: Nothing written
/Users/user/.rvm/gems/ruby-1.9.3-p448/gems/sshkit-1.4.0/lib/sshkit/command.rb:98:in `exit_status='
/Users/user/.rvm/gems/ruby-1.9.3-p448/gems/sshkit-1.4.0/lib/sshkit/backends/netssh.rb:142:in `block (4 levels) in _execute'
/Users/user/.rvm/gems/ruby-1.9.3-p448/gems/net-ssh-2.8.0/lib/net/ssh/connection/channel.rb:551:in `call'
/Users/user/.rvm/gems/ruby-1.9.3-p448/gems/net-ssh-2.8.0/lib/net/ssh/connection/channel.rb:551:in `do_request'
/Users/user/.rvm/gems/ruby-1.9.3-p448/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:561:in `channel_request'
/Users/user/.rvm/gems/ruby-1.9.3-p448/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:465:in `dispatch_incoming_packets'
/Users/user/.rvm/gems/ruby-1.9.3-p448/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:221:in `preprocess'
/Users/user/.rvm/gems/ruby-1.9.3-p448/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:205:in `process'
/Users/user/.rvm/gems/ruby-1.9.3-p448/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:169:in `block in loop'
/Users/user/.rvm/gems/ruby-1.9.3-p448/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:169:in `loop'
/Users/user/.rvm/gems/ruby-1.9.3-p448/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:169:in `loop'
/Users/user/.rvm/gems/ruby-1.9.3-p448/gems/net-ssh-2.8.0/lib/net/ssh/connection/channel.rb:269:in `wait'
/Users/user/.rvm/gems/ruby-1.9.3-p448/gems/sshkit-1.4.0/lib/sshkit/backends/netssh.rb:164:in `block (2 levels) in _execute'
/Users/user/.rvm/gems/ruby-1.9.3-p448/gems/net-ssh-2.8.0/lib/net/ssh/connection/channel.rb:514:in `call'
/Users/user/.rvm/gems/ruby-1.9.3-p448/gems/net-ssh-2.8.0/lib/net/ssh/connection/channel.rb:514:in `do_open_confirmation'
/Users/user/.rvm/gems/ruby-1.9.3-p448/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:545:in `channel_open_confirmation'
/Users/user/.rvm/gems/ruby-1.9.3-p448/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:465:in `dispatch_incoming_packets'
/Users/user/.rvm/gems/ruby-1.9.3-p448/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:221:in `preprocess'
/Users/user/.rvm/gems/ruby-1.9.3-p448/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:205:in `process'
/Users/user/.rvm/gems/ruby-1.9.3-p448/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:169:in `block in loop'
/Users/user/.rvm/gems/ruby-1.9.3-p448/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:169:in `loop'
/Users/user/.rvm/gems/ruby-1.9.3-p448/gems/net-ssh-2.8.0/lib/net/ssh/connection/session.rb:169:in `loop'
/Users/user/.rvm/gems/ruby-1.9.3-p448/gems/sshkit-1.4.0/lib/sshkit/backends/netssh.rb:166:in `block in _execute'
/Users/user/.rvm/gems/ruby-1.9.3-p448/gems/sshkit-1.4.0/lib/sshkit/backends/netssh.rb:123:in `tap'
/Users/user/.rvm/gems/ruby-1.9.3-p448/gems/sshkit-1.4.0/lib/sshkit/backends/netssh.rb:123:in `_execute'
/Users/user/.rvm/gems/ruby-1.9.3-p448/gems/sshkit-1.4.0/lib/sshkit/backends/netssh.rb:76:in `capture'
/Users/user/.rvm/gems/ruby-1.9.3-p448/gems/capistrano-rvm-0.1.1/lib/capistrano/tasks/rvm.rake:8:in `block (3 levels) in '
/Users/user/.rvm/gems/ruby-1.9.3-p448/gems/sshkit-1.4.0/lib/sshkit/backends/netssh.rb:54:in `instance_exec'
/Users/user/.rvm/gems/ruby-1.9.3-p448/gems/sshkit-1.4.0/lib/sshkit/backends/netssh.rb:54:in `run'
/Users/user/.rvm/gems/ruby-1.9.3-p448/gems/sshkit-1.4.0/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute'
Tasks: TOP => rvm:check
(See full trace by running task with --trace)
```
How do I load capistrano-rvm only in staging?
Thanks!
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.