Class: PuppetLibrary::Util::Dependency

Inherits:
Gem::Dependency
  • Object
show all
Defined in:
lib/puppet_library/util/dependency.rb

Instance Method Summary collapse

Constructor Details

#initialize(name, spec) ⇒ Dependency

Returns a new instance of Dependency.



20
21
22
23
24
25
26
27
28
29
30
# File 'lib/puppet_library/util/dependency.rb', line 20

def initialize(name, spec)
    super(name, spec.to_s.gsub("-", ".pre."))
rescue ArgumentError
    # If it starts with numbers, use those
    if spec =~ /^([~><= ]+)?\d+(\.\d+)*/
        super(name, spec[/^([~><= ]+)?\d+(\.\d+)*/])
    # Somebody's really made a mess of this version number
    else
        super(name, ">= 0")
    end
end