Class: Puppet::ModuleTool::LocalTarball Private

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

Overview

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.

API:

  • private

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.

API:

  • private



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

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.

API:

  • private



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

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.

API:

  • private



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

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.

API:

  • private



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

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.

API:

  • private



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

def prepare(release)
  release.mod.path
end