module Librarian::Ansible::ManifestReader

Public Instance Methods

check_manifest(name, manifest_path) click to toggle source
# 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) click to toggle source
# File lib/librarian/ansible/manifest_reader.rb, line 25
def manifest?(name, path)
  path = Pathname.new(path)
  !!manifest_path(path)
end
manifest_path(path) click to toggle source
# File lib/librarian/ansible/manifest_reader.rb, line 11
def manifest_path(path)
  path.join("meta/main.yml")
end
read_manifest(name, manifest_path) click to toggle source
# 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

Private Instance Methods

binread(path) click to toggle source
# File lib/librarian/ansible/manifest_reader.rb, line 38
def binread(path)
  File.binread(path)
end