Class: Puppet::ModuleTool::Applications::Unpacker

Inherits:
Application show all
Defined in:
lib/vendor/puppet/module_tool/applications/unpacker.rb

Constant Summary

Constants inherited from Application

Application::DOCPATTERN

Constants included from Util

Util::AbsolutePathPosix, Util::AbsolutePathWindows

Instance Attribute Summary

Attributes inherited from Application

#command_line, #options

Instance Method Summary collapse

Methods inherited from Application

[], banner, clear!, clear?, #configure_indirector_routes, controlled_run, exit, find, #handlearg, #help, interrupted?, #main, #name, option, option_parser_commands, #parse_options, #preinit, restart!, restart_requested?, #run_command, run_mode, #set_run_mode, #setup, #setup_logs, should_not_parse_config, should_parse_config, #should_parse_config?, should_parse_config?, stop!, stop_requested?

Methods included from Util

absolute_path?, activerecord_version, benchmark, binread, chuser, classproxy, #execfail, #execpipe, execute, execute_posix, execute_windows, logmethods, memory, path_to_uri, proxy, replace_file, safe_posix_fork, symbolize, symbolizehash, symbolizehash!, synchronize_on, thinmark, #threadlock, uri_to_path, wait_for_output, which, withumask

Methods included from Util::POSIX

#get_posix_field, #gid, #idfield, #methodbyid, #methodbyname, #search_posix_field, #uid

Constructor Details

#initialize(filename, options = {}) ⇒ Unpacker

Returns a new instance of Unpacker.



8
9
10
11
12
13
# File 'lib/vendor/puppet/module_tool/applications/unpacker.rb', line 8

def initialize(filename, options = {})
  @filename = Pathname.new(filename)
  parsed = parse_filename(filename)
  super(options)
  @module_dir = Pathname.new(options[:target_dir]) + parsed[:dir_name]
end

Instance Method Details

#build_dirPathname

Obtain a suitable temporary path for building and unpacking tarballs

Returns:

  • (Pathname)

    path to temporary build location



27
28
29
# File 'lib/vendor/puppet/module_tool/applications/unpacker.rb', line 27

def build_dir
  Puppet::Forge::Cache.base_path + "tmp-unpacker-#{Digest::SHA1.hexdigest(@filename.basename.to_s)}"
end

#runObject



15
16
17
18
19
20
21
22
# File 'lib/vendor/puppet/module_tool/applications/unpacker.rb', line 15

def run
  extract_module_to_install_dir

  # Return the Pathname object representing the directory where the
  # module release archive was unpacked the to, and the module release
  # name.
  @module_dir
end