Sha256: bb14e12f72d03b8aa788bab60754b935f277e0d48399efda40f1148f8480243c

Contents?: true

Size: 873 Bytes

Versions: 2

Compression:

Stored size: 873 Bytes

Contents

class Gitmine
  class Config
    HOME_CONFIG_FILE = "#{ENV['HOME']}/.gitmine.yml"
    CONFIG_FILE = './.gitmine.yml'

    class << self
      def config
        @@config ||= new
      end

      def redmine_host
        config['host']
      end

      def redmine_api_key
        config['api_key']
      end

      def github
        config['github']
      end

      def statuses
        config['statuses']
      end

      def status_reviewed
        config['statuses']['reviewed']
      end
    end

    def initialize
      # Read from the home .gitmine.yml file first, then merge the local file on top of it to provide proper overrides
      home_config = File.exists?(HOME_CONFIG_FILE) ? YAML.load_file(HOME_CONFIG_FILE) : {}
      @config = home_config.merge(YAML.load_file(CONFIG_FILE))
    end

    def [](key)
      @config[key]
    end

  end # Class Config
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gitmine-0.2.1 lib/gitmine/config.rb
gitmine-0.2.0 lib/gitmine/config.rb