Sha256: 2fb661aca08238d9469f45f25fcd9dbe4de48dd410a4558b16b258655d7ce22c

Contents?: true

Size: 770 Bytes

Versions: 1

Compression:

Stored size: 770 Bytes

Contents

module LicenseFinder
  class Configuration
    def self.with_optional_saved_config(primary_config, project_path = Pathname.new('.'))
      config_file = project_path.join('config', 'license_finder.yml')
      saved_config = config_file.exist? ? YAML.load(config_file.read) : {}
      new(primary_config, saved_config)
    end

    def initialize(primary_config, saved_config)
      @primary_config = primary_config
      @saved_config = saved_config
    end

    def gradle_command
      get(:gradle_command) || "gradle"
    end

    def decisions_file
      file_name = get(:decisions_file) || "doc/dependency_decisions.yml"
      Pathname(file_name)
    end

    private

    def get(key)
      @primary_config[key.to_sym] || @saved_config[key.to_s]
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
license_finder-2.0.0.rc2 lib/license_finder/configuration.rb