Class: Librarian::Puppet::Dsl

Inherits:
Dsl
  • Object
show all
Defined in:
lib/librarian/puppet/dsl.rb

Defined Under Namespace

Classes: Receiver

Instance Method Summary collapse

Instance Method Details

#run(specfile = nil, sources = []) ⇒ Object

copied from Librarian::Dsl to use our own Receiver



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/librarian/puppet/dsl.rb', line 17

def run(specfile = nil, sources = [])
  specfile, sources = nil, specfile if specfile.kind_of?(Array) && sources.empty?

  if specfile.kind_of?(Pathname) and !File.exists?(specfile)
    debug { "Specfile not found, using defaults: #{specfile}" }
    specfile = Proc.new do
      forge "http://forge.puppetlabs.com"
      
    end
  end

  Target.new(self).tap do |target|
    target.precache_sources(sources)
    debug_named_source_cache("Pre-Cached Sources", target)

    specfile ||= Proc.new if block_given?
    receiver = Receiver.new(target)
    receiver.run(specfile)

    debug_named_source_cache("Post-Cached Sources", target)
  end.to_spec
end