Module: Librarian::Puppet::Source::Local

Includes:
Util
Included in:
Git, Path
Defined in:
lib/librarian/puppet/source/local.rb

Instance Method Summary collapse

Methods included from Util

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

Instance Method Details

#fetch_dependencies(name, version, extra) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/librarian/puppet/source/local.rb', line 37

def fetch_dependencies(name, version, extra)
  dependencies = Set.new

  if specfile?
    spec = environment.dsl(Pathname(specfile))
    dependencies.merge spec.dependencies
  end

  ['dependencies'].each do |d|
    gem_requirement = Librarian::Dependency::Requirement.new(d['version_requirement']).to_gem_requirement
    new_dependency = Dependency.new(d['name'], gem_requirement, forge_source)
    dependencies << new_dependency
  end

  dependencies
end

#fetch_version(name, extra) ⇒ Object



31
32
33
34
35
# File 'lib/librarian/puppet/source/local.rb', line 31

def fetch_version(name, extra)
  cache!
  found_path = found_path(name)
  module_version
end

#forge_sourceObject



54
55
56
# File 'lib/librarian/puppet/source/local.rb', line 54

def forge_source
  Forge.default
end

#install!(manifest) ⇒ Object

Raises:

  • (Error)


9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/librarian/puppet/source/local.rb', line 9

def install!(manifest)
  manifest.source == self or raise ArgumentError

  debug { "Installing #{manifest}" }

  name, version = manifest.name, manifest.version
  found_path = found_path(name)
  raise Error, "Path for #{name} doesn't contain a puppet module" if found_path.nil?

  unless name.include? '/' or name.include? '-'
    warn { "Invalid module name '#{name}', you should qualify it with 'ORGANIZATION-#{name}' for resolution to work correctly" }
  end

  install_path = environment.install_path.join(module_name(name))
  if install_path.exist? && rsync? != true
    debug { "Deleting #{relative_path_to(install_path)}" }
    install_path.rmtree
  end

  install_perform_step_copy!(found_path, install_path)
end