Class: Librarian::Puppet::Lockfile::Parser

Inherits:
Lockfile::Parser
  • Object
show all
Includes:
Util
Defined in:
lib/librarian/puppet/lockfile.rb

Overview

Extend the parser to normalize module names in old .lock files, converting / to -

Instance Method Summary collapse

Methods included from Util

#clean_uri, #cp_r, #debug, #info, #module_name, #normalize_name, #rsync?, #warn

Instance Method Details

#extract_and_parse_dependencies(lines, manifests_index) ⇒ Object



21
22
23
24
25
26
27
28
29
# File 'lib/librarian/puppet/lockfile.rb', line 21

def extract_and_parse_dependencies(lines, manifests_index)
  # when looking up in manifests_index normalize the name beforehand
  class << manifests_index
    include Librarian::Puppet::Util
    alias_method :old_lookup, :[]
    define_method(:[]) { |k| self.old_lookup(normalize_name(k)) }
  end
  super(lines, manifests_index)
end

#extract_and_parse_sources(lines) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'lib/librarian/puppet/lockfile.rb', line 11

def extract_and_parse_sources(lines)
  sources = super
  sources.each do |source|
    source[:manifests] = Hash[source[:manifests].map do |name,manifest|
      [normalize_name(name), manifest]
    end]
  end
  sources
end