Class: Puppet::ModuleTool::LocalTarball
- Inherits:
-
SemanticPuppet::Dependency::Source
- Object
- SemanticPuppet::Dependency::Source
- Puppet::ModuleTool::LocalTarball
- Defined in:
- lib/puppet/module_tool/local_tarball.rb
Defined Under Namespace
Classes: ModuleRelease
Instance Attribute Summary collapse
-
#release ⇒ Object
Returns the value of attribute release.
Instance Method Summary collapse
- #fetch(name) ⇒ Object
-
#initialize(filename, strict_semver = true) ⇒ LocalTarball
constructor
A new instance of LocalTarball.
- #install(release, dir) ⇒ Object
- #prepare(release) ⇒ Object
Methods inherited from SemanticPuppet::Dependency::Source
#create_release, #priority, priority
Constructor Details
#initialize(filename, strict_semver = true) ⇒ LocalTarball
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, strict_semver = true) unpack(filename, tmpdir) Puppet.debug "Unpacked local tarball to #{tmpdir}" mod = Puppet::Module.new('tarball', tmpdir, nil, strict_semver) @release = ModuleRelease.new(self, mod) end |
Instance Attribute Details
#release ⇒ Object
Returns the value of attribute release.
9 10 11 |
# File 'lib/puppet/module_tool/local_tarball.rb', line 9 def release @release end |
Instance Method Details
#fetch(name) ⇒ Object
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
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
27 28 29 |
# File 'lib/puppet/module_tool/local_tarball.rb', line 27 def prepare(release) release.mod.path end |