Class: Librarian::Puppet::Dsl::Receiver
- Inherits:
-
Dsl::Receiver
- Object
- Dsl::Receiver
- Librarian::Puppet::Dsl::Receiver
- Defined in:
- lib/librarian/puppet/dsl.rb
Instance Attribute Summary collapse
-
#specfile ⇒ Object
readonly
Returns the value of attribute specfile.
-
#working_path ⇒ Object
readonly
Returns the value of attribute working_path.
Instance Method Summary collapse
-
#metadata ⇒ Object
implement the ‘metadata’ syntax for Puppetfile.
-
#run(specfile = nil) ⇒ Object
save the specfile and call librarian.
Instance Attribute Details
#specfile ⇒ Object (readonly)
Returns the value of attribute specfile.
72 73 74 |
# File 'lib/librarian/puppet/dsl.rb', line 72 def specfile @specfile end |
#working_path ⇒ Object (readonly)
Returns the value of attribute working_path.
72 73 74 |
# File 'lib/librarian/puppet/dsl.rb', line 72 def working_path @working_path end |
Instance Method Details
#metadata ⇒ Object
implement the ‘metadata’ syntax for Puppetfile
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/librarian/puppet/dsl.rb', line 82 def f = working_path.join('metadata.json') unless File.exist?(f) raise Error, "Metadata file does not exist: #{f}" end begin json = JSON.parse(File.read(f)) rescue JSON::ParserError => e raise Error, "Unable to parse json file #{f}: #{e}" end dependencyList = json['dependencies'] dependencyList.each do |d| mod(d['name'], d['version_requirement']) end end |
#run(specfile = nil) ⇒ Object
save the specfile and call librarian
75 76 77 78 79 |
# File 'lib/librarian/puppet/dsl.rb', line 75 def run(specfile = nil) @working_path = specfile.kind_of?(Pathname) ? specfile.parent : Pathname.new(Dir.pwd) @specfile = specfile super end |