Sha256: 888870eb44567b919e7b7c0ba89b10dd9cb02212a51b14ad2129e9ad48395f0e

Contents?: true

Size: 556 Bytes

Versions: 2

Compression:

Stored size: 556 Bytes

Contents

require 'yaml'

module Stash
  class Config
    def initialize(config_file = "#{ENV['HOME']}/.stashconfig.yml")
      @config_file = config_file

      fail "#{@config_file} does not exist" unless File.exist?(@config_file)
    end

    def server(logger = nil)
      Server.new(host, user, password, logger)
    end

    private

    def host
      config['stash_url']
    end

    def user
      config['username']
    end

    def password
      config['password']
    end

    def config
      @config ||= YAML.load_file(@config_file)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
face_control-1.0.0 lib/stash/config.rb
face_control-0.9.1 lib/stash/config.rb