Class: Rundock::Builder::DefaultSshBuilder
- Defined in:
- lib/rundock/builder/default_ssh_builder.rb
Constant Summary collapse
- RUNDOCK_PACKAGE_PATH =
Gem::Specification.find_by_path('rundock')
- PRESET_SSH_OPTIONS_DEFAULT_ROOT =
RUNDOCK_PACKAGE_PATH.nil? ? '.' : RUNDOCK_PACKAGE_PATH.full_gem_path
- PRESET_SSH_OPTIONS_DEFAULT_FILE_PATH =
"#{PRESET_SSH_OPTIONS_DEFAULT_ROOT}/default_ssh.yml"- HOME_SSH_OPTIONS_DEFAULT_FILE_PATH =
"#{Dir.home}/default_ssh.yml"
Constants inherited from Base
Base::BuilderNotImplementedError
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(options) ⇒ DefaultSshBuilder
constructor
A new instance of DefaultSshBuilder.
Constructor Details
#initialize(options) ⇒ DefaultSshBuilder
Returns a new instance of DefaultSshBuilder.
11 12 13 |
# File 'lib/rundock/builder/default_ssh_builder.rb', line 11 def initialize() super() end |
Instance Method Details
#build ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/rundock/builder/default_ssh_builder.rb', line 15 def build opts = {} def_ssh_file = if [:default_ssh_opts] && FileTest.exist?([:default_ssh_opts]) [:default_ssh_opts] elsif FileTest.exist?(HOME_SSH_OPTIONS_DEFAULT_FILE_PATH) HOME_SSH_OPTIONS_DEFAULT_FILE_PATH else PRESET_SSH_OPTIONS_DEFAULT_FILE_PATH end File.open(def_ssh_file) do |f| YAML.load_documents(f) do |y| y.each do |k, v| opts["#{k}_ssh_default".to_sym] = v end end end opts end |