Class: Puppet::ModuleTool::LocalTarball Private

Inherits:
SemanticPuppet::Dependency::Source
  • Object
show all
Defined in:
lib/puppet/module_tool/local_tarball.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Defined Under Namespace

Classes: ModuleRelease

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(filename) ⇒ LocalTarball

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of LocalTarball.



13
14
15
16
17
18
19
# File 'lib/puppet/module_tool/local_tarball.rb', line 13

def initialize(filename)
  unpack(filename, tmpdir)
  Puppet.debug "Unpacked local tarball to #{tmpdir}"

  mod = Puppet::Module.new('tarball', tmpdir, nil)
  @release = ModuleRelease.new(self, mod)
end

Instance Attribute Details

#releaseObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



11
12
13
# File 'lib/puppet/module_tool/local_tarball.rb', line 11

def release
  @release
end

Instance Method Details

#fetch(name) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



21
22
23
24
25
26
27
# File 'lib/puppet/module_tool/local_tarball.rb', line 21

def fetch(name)
  if @release.name == name
    [@release]
  else
    []
  end
end

#install(release, dir) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



33
34
35
36
37
38
39
40
41
42
43
# File 'lib/puppet/module_tool/local_tarball.rb', line 33

def install(release, dir)
  staging_dir = release.prepare

  module_dir = dir + release.name[/-(.*)/, 1]
  module_dir.rmtree if module_dir.exist?

  # Make sure unpacked module has the same ownership as the folder we are moving it into.
  Puppet::ModuleTool::Applications::Unpacker.harmonize_ownership(dir, staging_dir)

  FileUtils.mv(staging_dir, module_dir)
end

#prepare(release) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



29
30
31
# File 'lib/puppet/module_tool/local_tarball.rb', line 29

def prepare(release)
  release.mod.path
end