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.


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

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.


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

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.


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

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.


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

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.


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

def prepare(release)
  release.mod.path
end