Sha256: 4e27fd0d660dd35db3dc8afe5322e66d80847d0c66bd3912cc7c97c8ee02db32

Contents?: true

Size: 787 Bytes

Versions: 1

Compression:

Stored size: 787 Bytes

Contents

require 'yaml'

module Rundock
  module Builder
    class DefaultSshBuilder < Base
      PRESET_SSH_OPTIONS_DEFAULT_FILE_PATH = "#{Gem::Specification.find_by_path('rundock').full_gem_path}/default_ssh.yml"

      def initialize(options)
        super(options)
      end

      def build
        opts = {}

        if @options['default_ssh_opts_yaml'] && FileTest.exist?(@options['default_ssh_opts_yaml'])
          def_ssh_file = @options['default_ssh_opts_yaml']
        else
          def_ssh_file = 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"] = v
            end
          end
        end

        opts
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rundock-0.2.0 lib/rundock/builder/default_ssh_builder.rb