Sha256: 8363338690baf1fe4bb2c4c73855e543e683049f5998432687d22cf43298b647

Contents?: true

Size: 703 Bytes

Versions: 19

Compression:

Stored size: 703 Bytes

Contents

require 'gem/release/config/env'
require 'gem/release/config/files'
require 'gem/release/helper/hash'

module Gem
  module Release
    class Config
      include Helper::Hash

      attr_reader :opts

      SOURCES = [Env, Files]

      def initialize
        @opts = load
      end

      def [](key)
        opts[key]
      end

      def for(key)
        common.merge(self[key] || {})
      end

      def common
        opts.reject { |_, value| value.is_a?(Hash) }
      end

      private

        def load
          opts = sources.map(&:load)
          opts.inject { |one, other| deep_merge(one, other) }
        end

        def sources
          SOURCES.map(&:new)
        end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
gem-release-2.2.3.alpha2 lib/gem/release/config.rb
gem-release-2.2.3.alpha1 lib/gem/release/config.rb
gem-release-2.2.2 lib/gem/release/config.rb
gem-release-2.2.1 lib/gem/release/config.rb
gem-release-2.2.0 lib/gem/release/config.rb
gem-release-2.1.1 lib/gem/release/config.rb
gem-release-2.1.0 lib/gem/release/config.rb
gem-release-2.0.4 lib/gem/release/config.rb
gem-release-2.0.3 lib/gem/release/config.rb
gem-release-2.0.2 lib/gem/release/config.rb
gem-release-2.0.1 lib/gem/release/config.rb
gem-release-2.0.0.rc.3 lib/gem/release/config.rb
gem-release-2.0.0.rc.2 lib/gem/release/config.rb
gem-release-2.0.0.rc.1 lib/gem/release/config.rb
gem-release-2.0.0.dev.5 lib/gem/release/config.rb
gem-release-2.0.0.dev.4 lib/gem/release/config.rb
gem-release-2.0.0.dev.3 lib/gem/release/config.rb
gem-release-2.0.0.dev.2 lib/gem/release/config.rb
gem-release-2.0.0.dev.1 lib/gem/release/config.rb