Method: Puppet::Forge::ModuleRelease#install

Defined in:
lib/puppet/forge.rb

#install(dir) ⇒ Object



150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
# File 'lib/puppet/forge.rb', line 150

def install(dir)
  staging_dir = self.prepare

  module_dir = dir + 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)
  @install_dir = dir

  # Return the Pathname object representing the directory where the
  # module release archive was unpacked the to.
  return module_dir
ensure
  staging_dir.rmtree if staging_dir.exist?
end