Class: Librarian::Puppet::Dsl::Receiver

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#specfileObject (readonly)

Returns the value of attribute specfile.



33
34
35
# File 'lib/librarian/puppet/dsl.rb', line 33

def specfile
  @specfile
end

Instance Method Details

#modulefileObject

implement the ‘modulefile’ syntax for Puppetfile



42
43
44
45
46
47
# File 'lib/librarian/puppet/dsl.rb', line 42

def modulefile
  File.read(Pathname.new(specfile).parent.join('Modulefile')).lines.each do |line|
    regexp = /\s*dependency\s+('|")([^'"]+)\1\s*(?:,\s*('|")([^'"]+)\3)?/
    regexp =~ line && mod($2, $4)
  end
end

#run(specfile = nil) ⇒ Object

save the specfile and call librarian



36
37
38
39
# File 'lib/librarian/puppet/dsl.rb', line 36

def run(specfile = nil)
  @specfile = specfile
  super
end