Sha256: 68c028c89fefd3b72636b07b7dab284aba9a118ed57569c4000c1a17240d1f0b

Contents?: true

Size: 1.27 KB

Versions: 15

Compression:

Stored size: 1.27 KB

Contents

# coding: utf-8

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 statement_type()
    return 'override'
  end

  def deparse_as_version(deparser)
    return deparser.override(self)
  end

  def minimum_grammar_for_emitting_input()
    return [0]
  end

  def minimum_grammar_for_publishing()
    return [0]
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
fig-1.27.10 lib/fig/statement/override.rb
fig-1.27.8 lib/fig/statement/override.rb
fig-1.27.5 lib/fig/statement/override.rb
fig-1.27.4 lib/fig/statement/override.rb
fig-1.27.3 lib/fig/statement/override.rb
fig-1.27.0 lib/fig/statement/override.rb
fig-1.26.1.beta.1 lib/fig/statement/override.rb
fig-1.26.0 lib/fig/statement/override.rb
fig-1.25.1.beta.1 lib/fig/statement/override.rb
fig-1.25.0 lib/fig/statement/override.rb
fig-1.24.1.beta.3 lib/fig/statement/override.rb
fig-1.24.1.beta.2 lib/fig/statement/override.rb
fig-1.24.1.beta.1 lib/fig/statement/override.rb
fig-1.24.0 lib/fig/statement/override.rb
fig-1.23.1.beta.1 lib/fig/statement/override.rb