Module: Librarian::Ansible::ManifestReader
- Extended by:
- ManifestReader
- Included in:
- ManifestReader
- Defined in:
- lib/librarian/ansible/manifest_reader.rb
Instance Method Summary collapse
- #check_manifest(name, manifest_path) ⇒ Object
- #manifest?(name, path) ⇒ Boolean
- #manifest_path(path) ⇒ Object
- #read_manifest(name, manifest_path) ⇒ Object
Instance Method Details
#check_manifest(name, manifest_path) ⇒ Object
30 31 32 33 |
# File 'lib/librarian/ansible/manifest_reader.rb', line 30 def check_manifest(name, manifest_path) manifest = read_manifest(name, manifest_path) manifest["name"] == name end |
#manifest?(name, path) ⇒ Boolean
25 26 27 28 |
# File 'lib/librarian/ansible/manifest_reader.rb', line 25 def manifest?(name, path) path = Pathname.new(path) !!manifest_path(path) end |
#manifest_path(path) ⇒ Object
11 12 13 |
# File 'lib/librarian/ansible/manifest_reader.rb', line 11 def manifest_path(path) path.join("meta/main.yml") end |
#read_manifest(name, manifest_path) ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/librarian/ansible/manifest_reader.rb', line 15 def read_manifest(name, manifest_path) if [".yml", ".yaml"].include?(manifest_path.extname) YAML.load(binread(manifest_path)).tap do |m| if m.is_a?(Hash) m["dependencies"] = [] end end end end |