Sha256: 847a026a9e2f40535f5cbe0414cb17912f6382e0d268b26ae5190ba0c7ce016a

Contents?: true

Size: 979 Bytes

Versions: 2

Compression:

Stored size: 979 Bytes

Contents

module SimpleDeploy
  class Config

    attr_accessor :config, :logger

    def initialize
      load_config_file
    end

    def load_config_file
      config_file = "#{ENV['HOME']}/.simple_deploy.yml"
      self.config = YAML::load( File.open( config_file ) )
    end

    def artifacts
      config['deploy']['artifacts']
    end

    def keys
      config['deploy']['keys'] ||= "#{env_home}/.ssh/id_rsa"
    end

    def gateway
      config['deploy']['gateway']
    end

    def user
      config['deploy']['user'] ||= "#{env_user}"
    end

    def deploy_script
      config['deploy']['script']
    end

    def environments
      config['environments']
    end

    def environment(name)
      environments[name]
    end

    def region(name)
      environment(name)['region']
    end

    def artifact_repository
      config['artifact_repository']
    end

    private

    def env_home
      ENV['HOME']
    end

    def env_user
      ENV['USER']
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
simple_deploy-0.2.3 lib/simple_deploy/config.rb
simple_deploy-0.2.2 lib/simple_deploy/config.rb