lib/librarian/puppet/dsl.rb in librarian-puppet-4.0.1 vs lib/librarian/puppet/dsl.rb in librarian-puppet-5.0.0
- old
+ new
@@ -76,47 +76,24 @@
@working_path = specfile.kind_of?(Pathname) ? specfile.parent : Pathname.new(Dir.pwd)
@specfile = specfile
super
end
- # implement the 'modulefile' syntax for Puppetfile
- def modulefile
- f = modulefile_path
- raise Error, "Modulefile file does not exist: #{f}" unless File.exist?(f)
- File.read(f).lines.each do |line|
- regexp = /\s*dependency\s+('|")([^'"]+)\1\s*(?:,\s*('|")([^'"]+)\3)?/
- regexp =~ line && mod($2, $4)
- end
- end
-
# implement the 'metadata' syntax for Puppetfile
def metadata
f = working_path.join('metadata.json')
unless File.exist?(f)
- msg = "Metadata file does not exist: #{f}"
- # try modulefile, in case we don't have a Puppetfile and we are using the default template
- if File.exist?(modulefile_path)
- modulefile
- return
- else
- raise Error, msg
- end
+ 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
-
- private
-
- def modulefile_path
- working_path.join('Modulefile')
end
end
end
end
end