Class: Librarian::Puppet::Dependency

Inherits:
Dependency
  • Object
show all
Includes:
Util
Defined in:
lib/librarian/puppet/dependency.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Util

#clean_uri, #cp_r, #debug, #info, #module_name, #normalize_name, #rsync?, #warn

Constructor Details

#initialize(name, requirement, source, parent = nil) ⇒ Dependency

Returns a new instance of Dependency.

Raises:

  • (Error)


11
12
13
14
15
16
17
# File 'lib/librarian/puppet/dependency.rb', line 11

def initialize(name, requirement, source, parent = nil)
  # Issue #235 fail if forge source is not defined
  raise Error, "forge entry is not defined in Puppetfile" if source.instance_of?(Array) && source.empty?

  self.parent = parent
  super(normalize_name(name), requirement, source)
end

Instance Attribute Details

#parentObject

Returns the value of attribute parent.



8
9
10
# File 'lib/librarian/puppet/dependency.rb', line 8

def parent
  @parent
end

Instance Method Details

#to_sObject



19
20
21
# File 'lib/librarian/puppet/dependency.rb', line 19

def to_s
  "#{name} (#{requirement}) <#{source}> (from #{parent.nil? ? '<nil>' : parent})"
end