class R10K::Module::Definition

Attributes

version[R]

Public Class Methods

new(name, dirname:, args:, implementation:, environment: nil) click to toggle source
Calls superclass method R10K::Module::Base::new
# File lib/r10k/module/definition.rb, line 7
def initialize(name, dirname:, args:, implementation:, environment: nil)
  @original_name  = name
  @original_args  = args.dup
  @implementation = implementation
  @version        = implementation.statically_defined_version(name, args)

  super(name, dirname, args, environment)
end

Public Instance Methods

properties() click to toggle source
# File lib/r10k/module/definition.rb, line 36
def properties
  type = nil

  if @args[:type]
    type = @args[:type]
  elsif @args[:ref] || @args[:commit] || @args[:branch] || @args[:tag]
    type = 'git'
  elsif @args[:svn]
    # This logic is clear and included for completeness sake, though at
    # this time module definitions do not support SVN versions.
    type = 'svn'
  else
    type = 'forge'
  end

  {
    expected: version,
    # We can't get the value for `actual` here because that requires the
    # implementation (and potentially expensive operations by the
    # implementation). Some consumers will check this value, if it exists
    # and if not, fall back to the expected version. That is the correct
    # behavior when assuming modules are unchanged, and why `actual` is set
    # to `nil` here.
    actual: nil,
    type: type
  }
end
status() click to toggle source
# File lib/r10k/module/definition.rb, line 32
def status
  :insync
end
sync(args = {}) click to toggle source

syncing is a noop for module definitions Returns false to inidicate the module was not updated

# File lib/r10k/module/definition.rb, line 27
def sync(args = {})
  logger.debug1(_("Not updating module %{name}, assuming content unchanged") % {name: name})
  false
end
to_implementation() click to toggle source
# File lib/r10k/module/definition.rb, line 16
def to_implementation
  mod = @implementation.new(@title, @dirname, @original_args, @environment)

  mod.origin = origin
  mod.spec_deletable = spec_deletable

  mod
end