class Sshster::Config
Attributes
config_path[RW]
options[RW]
Public Class Methods
new(config_path = nil)
click to toggle source
# File lib/sshster/config.rb, line 5 def initialize(config_path = nil) @config_path = config_path || default_file_path @options = default_options end
Public Instance Methods
merge()
click to toggle source
# File lib/sshster/config.rb, line 10 def merge merge_config(config_path) end
Private Instance Methods
default_file_path()
click to toggle source
# File lib/sshster/config.rb, line 36 def default_file_path ENV['HOME'] + '/.ssh/sshster.yml' end
default_options()
click to toggle source
# File lib/sshster/config.rb, line 26 def default_options { 'forward_agent' => true, 'user' => 'deploy', 'request_tty' => true, 'screen_session' => 'deploy', 'ssh_config' => default_ssh_config_path, } end
default_ssh_config_path()
click to toggle source
# File lib/sshster/config.rb, line 40 def default_ssh_config_path ENV['HOME'] + '/.ssh' end
merge_config(config_path)
click to toggle source
# File lib/sshster/config.rb, line 20 def merge_config(config_path) return @options unless File.exist?(config_path) @options.merge!(parse_config(config_path)) end
parse_config(config_path)
click to toggle source
# File lib/sshster/config.rb, line 16 def parse_config(config_path) YAML.safe_load(File.read(config_path)) || {} end