Sha256: 97a5ee9a3ba8f6968355d724c01d33c0ddf67b7e7aacff032d937cb7de8c86e8

Contents?: true

Size: 1.14 KB

Versions: 3

Compression:

Stored size: 1.14 KB

Contents

require 'fig/package_descriptor'
require 'fig/statement'

module Fig; end

# Overrides one package version dependency with another.
#
#   config whatever
#     override somedependency/3.2.6
#   end
#
# indicates that, regardless of which version of somedependency the blah
# package says it needs, the blah package will actually use v3.2.6.
class Fig::Statement::Override < Fig::Statement
  attr_reader :package_name, :version

  # Centralized definition of requirements for descriptors for override
  # statements.
  def self.parse_descriptor(raw_string, options = {})
    filled_in_options = {}
    filled_in_options.merge!(options)
    filled_in_options[:name]    = :required
    filled_in_options[:version] = :required
    filled_in_options[:config]  = :forbidden

    return Fig::PackageDescriptor.parse(raw_string, filled_in_options)
  end

  def initialize(line_column, source_description, package_name, version)
    super(line_column, source_description)

    @package_name = package_name
    @version = version
  end

  def unparse_as_version(unparser)
    return unparser.override(self)
  end

  def minimum_grammar_version_required()
    return 0
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fig-0.1.77 lib/fig/statement/override.rb
fig-0.1.76 lib/fig/statement/override.rb
fig-0.1.75 lib/fig/statement/override.rb