Class: Puppetfiler::Metadata

Inherits:
Object
  • Object
show all
Defined in:
lib/puppetfiler/metadata.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(target) ⇒ Metadata

Returns a new instance of Metadata.



9
10
11
12
13
# File 'lib/puppetfiler/metadata.rb', line 9

def initialize(target)
    @dependencies = {}

    parse target
end

Instance Attribute Details

#dependenciesObject (readonly)

Returns the value of attribute dependencies.



7
8
9
# File 'lib/puppetfiler/metadata.rb', line 7

def dependencies
  @dependencies
end

#pathObject (readonly)

Returns the value of attribute path.



8
9
10
# File 'lib/puppetfiler/metadata.rb', line 8

def path
  @path
end

Instance Method Details

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/puppetfiler/metadata.rb', line 19

def eql?(other)
    @dependencies.eql?(other.dependencies)
end

#fixture(modifiers = {}) ⇒ Object



15
16
17
# File 'lib/puppetfiler/metadata.rb', line 15

def fixture(modifiers = {})
    Puppetfiler::Fixture.fixture(@dependencies, {}, modifiers)
end

#updatesObject



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/puppetfiler/metadata.rb', line 23

def updates
    require 'concurrent'

    updates = {}

    deps = @dependencies.map do |name, dep|
        Concurrent::Future.execute do
            latest = dep.latest

            if not dep.range.cover?(latest)
                updates[name] = {
                    :range  => dep.range,
                    :newest => latest,
                }
            end
        end
    end

    deps.each { |f| f.wait_or_cancel(300) }

    return updates
end