-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Capistrano-locally with Capistrano Whenever - undefined method `roles_array' for SSHKit #2
Comments
Hello @OlivierGrimard , thanks for your reporting.
Very unfortunately, I have no idea expect for such a dirty monkey patch: 😫 module SSHKit
# https://github.com/capistrano/sshkit/blob/e06d6b8424979a6a3a2974f375490d2aa15c2ac4/lib/sshkit/backends/local.rb#L9-L12
class Backend::Local
def initialize(cap_server, &block)
@host = SSHKit::Host.new(:local) # just for logging
@block = block
@host.properties[:server] = cap_server
end
end
class Host
extend Forwardable
def_delegators :'properties[:server]', :roles_array
end
end |
I have the same problem |
how to use them?
thanks |
I used the whenever, I can use it after deleting. |
Hello, Split it into two parts: module GemExtensions
module SSHKit
module Backend
module Local
def self.included(base)
base.class_eval do
define_method(:initialize) do |*args, &block|
@host = ::SSHKit::Host.new(:local) # just for logging
@block = block
@host.properties[:server] = args.first
end
end
end
end
end
end
end and module GemExtensions
module SSHKit
module Host
def self.included(base)
base.class_eval do
base.extend Forwardable
base.def_delegators :'properties[:server]', :roles_array
end
end
end
end
end Another file will apply the patches to the SSHKit library. if defined?(SSHKit)
require_relative 'sshkit/backend/local'
require_relative 'sshkit/host'
SSHKit::Backend::Local.include GemExtensions::SSHKit::Backend::Local
SSHKit::Host.include GemExtensions::SSHKit::Host
end Now, in Capfile, require the last file after the ...
require 'capistrano/locally'
require_relative 'lib/gem_extensions/sshkit'
... The line This was tested for the following combination of gem versions: |
Hi,
I want to use Capistrano without SSH access. Capistrano-locally looks great but when I add plugin whenever, I have an error with the SSHKit.
Capfile:
require "whenever/capistrano"
cap production deploy
....
(Backtrace restricted to imported tasks)
cap aborted!
NoMethodError: undefined method `roles_array' for #SSHKit::Host:0x00000003760b30
Tasks: TOP => whenever:update_crontab
(See full trace by running task with --trace)
The deploy has failed with an error: undefined method `roles_array' for #SSHKit::Host:0x00000003760b30
Any idea why?
The text was updated successfully, but these errors were encountered: