Switch to a Commander base to allow lazy loading config
This commit is contained in:
@@ -3,26 +3,4 @@ require "sshkit/dsl"
|
||||
|
||||
include SSHKit::DSL
|
||||
|
||||
if (config_file = Rails.root.join("config/deploy.yml")).exist?
|
||||
MRSK_CONFIG = Mrsk::Configuration.load_file(config_file)
|
||||
|
||||
SSHKit::Backend::Netssh.configure { |ssh| ssh.ssh_options = MRSK_CONFIG.ssh_options }
|
||||
|
||||
# No need to use /usr/bin/env, just clogs up the logs
|
||||
SSHKit.config.command_map[:docker] = "docker"
|
||||
else
|
||||
# MRSK is missing config/deploy.yml – run 'rake mrsk:init'
|
||||
MRSK_CONFIG = Mrsk::Configuration.new({}, validate: false)
|
||||
end
|
||||
|
||||
# Allow easy full verbosity mode
|
||||
SSHKit.config.output_verbosity = :debug if ENV["VERBOSE"]
|
||||
|
||||
# Set a different verbosity level for the duration of the yield
|
||||
def verbosity(level)
|
||||
old_level = SSHKit.config.output_verbosity
|
||||
SSHKit.config.output_verbosity = level
|
||||
yield
|
||||
ensure
|
||||
SSHKit.config.output_verbosity = old_level
|
||||
end
|
||||
MRSK = Mrsk::Commander.new config_file: Rails.root.join("config/deploy.yml"), verbose: ENV["VERBOSE"]
|
||||
|
||||
Reference in New Issue
Block a user