Undefined method `on' for main:Object when using SSHKit 1.9 with Capistrano 3.1.0
Hello.
After accidently upgrading to sshkit-1.9.0 I've found out that my deployment process is broken:
NoMethodError: undefined method `on' for main:Object
/Users/amikhailov/.rvm/gems/ruby-2.3.0/gems/capistrano-rbenv-2.0.4/lib/capistrano/tasks/rbenv.rake:3:in `block (2 levels) in <top (required)>'
/Users/amikhailov/.rvm/gems/ruby-2.3.0/gems/airbrussh-1.0.0/lib/airbrussh/rake/context.rb:55:in `execute'
/Users/amikhailov/.rvm/gems/ruby-2.3.0/gems/capistrano-3.1.0/lib/capistrano/dsl/task_enhancements.rb:12:in `block in after'
/Users/amikhailov/.rvm/gems/ruby-2.3.0/gems/capistrano-3.1.0/lib/capistrano/application.rb:15:in `run'
/Users/amikhailov/.rvm/gems/ruby-2.3.0/gems/capistrano-3.1.0/bin/cap:3:in `<top (required)>'
/Users/amikhailov/.rvm/gems/ruby-2.3.0/bin/cap:23:in `load'
/Users/amikhailov/.rvm/gems/ruby-2.3.0/bin/cap:23:in `<main>'
/Users/amikhailov/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `eval'
/Users/amikhailov/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => rbenv:validate
After digging into this I've found out that b76a86c5 has broken compatibility with existing code (we use capistrano 3.1.0). The reason is removed line from lib/sshkit/dsl.rb.
As a workaround I'll set dependency from sshkit prior to 1.9.0, but I think you should know about that incompatibility issue.
Good catch. This was noted as a potentially breaking change in the 1.9.0 release notes. The latest Capistrano is not affected, but other software could be (like Capistrano 3.1.0, as you found).
Have you tried adding include SSHKit::DSL to your Capfile as a workaround to be able to use 1.9.0, as suggested by the release notes?
Also, is there a particular bug or change that makes you wary about upgrading to the current version of Capistrano? Just curious if there is anything we can do to help there.
I was just coming back to the issue to report that adding include SSHKit::DSL to the Capfile fixes it, but you beat me to it :)
Since there is a confirmed workaround (thanks @DejaAugustine) and documentation in the CHANGELOG, I'll mark this as closed.
Thanks for the workaround, I'll use it