Method: R10K::Module::Forge#initialize

Defined in:
lib/r10k/module/forge.rb

#initialize(title, dirname, opts, environment = nil) ⇒ Forge

Returns a new instance of Forge.



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/r10k/module/forge.rb', line 35

def initialize(title, dirname, opts, environment=nil)
  super

   = R10K::Module::MetadataFile.new(path + 'metadata.json')
   = .read

  setopts(opts, {
    # Standard option interface
    :version => :expected_version,
    :source  => ::R10K::Util::Setopts::Ignore,
    :type    => ::R10K::Util::Setopts::Ignore,
  }, :raise_on_unhandled => false)

  # Validate version and raise on issue. Title is validated by base class.
  unless valid_version?(@expected_version)
    raise ArgumentError, _("Module version %{ver} is not a valid Forge module version") % {ver: @expected_version}
  end

  @expected_version ||= current_version || :latest

  @v3_module = PuppetForge::V3::Module.new(:slug => @title)
end