Sha256: d6065da0a61abe12c3405e228f61b47faf14ce2c19298cc63d558c211f9f2379

Contents?: true

Size: 671 Bytes

Versions: 4

Compression:

Stored size: 671 Bytes

Contents

module Pronto
  class Config
    def initialize(config_hash = ConfigFile.new.to_h)
      @config_hash = config_hash
    end

    %w(github gitlab).each do |service|
      ConfigFile::EMPTY[service].each do |key, _|
        name = "#{service}_#{key}"
        define_method(name) { ENV[name.upcase] || @config_hash[service][key] }
      end
    end

    def excluded_files
      @excluded_files ||= Array(exclude)
        .flat_map { |path| Dir[path.to_s] }
        .map { |path| File.expand_path(path) }
    end

    def github_hostname
      URI.parse(github_web_endpoint).host
    end

    private

    def exclude
      @config_hash['all']['exclude']
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
pronto-0.5.3 lib/pronto/config.rb
pronto-0.5.2 lib/pronto/config.rb
pronto-0.5.1 lib/pronto/config.rb
pronto-0.5.0 lib/pronto/config.rb