class R10K::ModuleLoader::Puppetfile::DSL

Private Class Methods

new(librarian, metadata_only: false) click to toggle source

A barebones implementation of the Puppetfile DSL

@api private

# File lib/r10k/module_loader/puppetfile/dsl.rb, line 9
def initialize(librarian, metadata_only: false)
  @librarian     = librarian
  @metadata_only = metadata_only
end

Private Instance Methods

forge(location) click to toggle source
# File lib/r10k/module_loader/puppetfile/dsl.rb, line 28
def forge(location)
  @librarian.set_forge(location)
end
method_missing(method, *args) click to toggle source
# File lib/r10k/module_loader/puppetfile/dsl.rb, line 36
def method_missing(method, *args)
  raise NoMethodError, _("unrecognized declaration '%{method}'") % {method: method}
end
mod(name, args = nil) click to toggle source
# File lib/r10k/module_loader/puppetfile/dsl.rb, line 14
def mod(name, args = nil)
  if args.is_a?(Hash)
    opts = args
  else
    opts = { type: 'forge', version: args }
  end

  if @metadata_only
    @librarian.add_module_metadata(name, opts)
  else
    @librarian.add_module(name, opts)
  end
end
moduledir(location) click to toggle source
# File lib/r10k/module_loader/puppetfile/dsl.rb, line 32
def moduledir(location)
  @librarian.set_moduledir(location)
end