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

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

Instance Method Summary collapse

Instance Method Details

#fetch_dependencies(name, version, extra) ⇒ Object



36
37
38
# File 'lib/librarian/puppet/source/local.rb', line 36

def fetch_dependencies(name, version, extra)
  {}
end

#fetch_version(name, extra) ⇒ Object



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

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

#install!(manifest) ⇒ Object

Raises:

  • (Error)


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

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?

  if name.include? '/'
    new_name = name.split('/').last
    debug { "Invalid module name '#{name}', guessing you meant '#{new_name}'" }
    name = new_name
  end

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

  install_perform_step_copy!(found_path, install_path)
end