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

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

Constant Summary

Constants inherited from Application

Application::DOCPATTERN, Application::SHOULD_PARSE_CONFIG_DEPRECATION_MSG

Constants included from Util

Util::AbsolutePathPosix, Util::AbsolutePathWindows, Util::DEFAULT_POSIX_MODE, Util::DEFAULT_WINDOWS_MODE

Constants included from Util::POSIX

Util::POSIX::LOCALE_ENV_VARS, Util::POSIX::USER_ENV_VARS

Constants included from Util::SymbolicFileMode

Util::SymbolicFileMode::SetGIDBit, Util::SymbolicFileMode::SetUIDBit, Util::SymbolicFileMode::StickyBit, Util::SymbolicFileMode::SymbolicMode, Util::SymbolicFileMode::SymbolicSpecialToBit

Instance Attribute Summary

Attributes inherited from Application

#command_line, #options

Instance Method Summary collapse

Methods inherited from Application

[], #app_defaults, available_application_names, banner, clear!, clear?, clear_everything_for_tests, #configure_indirector_routes, controlled_run, exit, find, #handle_logdest_arg, #handlearg, #help, #initialize_app_defaults, interrupted?, #main, #name, option, option_parser_commands, #parse_options, #preinit, restart!, restart_requested?, #run_command, run_mode, #set_log_level, #setup, #setup_logs, should_not_parse_config, should_parse_config, should_parse_config?, stop!, stop_requested?, try_load_class

Methods included from Util

absolute_path?, activerecord_version, benchmark, binread, chuser, classproxy, deterministic_rand, execfail, execpipe, execute, exit_on_fail, logmethods, memory, path_to_uri, pretty_backtrace, proxy, replace_file, safe_posix_fork, symbolizehash, thinmark, uri_to_path, which, withenv, withumask

Methods included from Util::POSIX

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

Methods included from Util::SymbolicFileMode

#normalize_symbolic_mode, #symbolic_mode_to_int, #valid_symbolic_mode?

Constructor Details

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

Returns a new instance of Unpacker.



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

def initialize(filename, options = {})
  @filename = Pathname.new(filename)
  parsed = parse_filename(filename)
  @module_name = parsed[:module_name]
  super(options)
  @module_path = Pathname(options[:target_dir])
  @module_dir = @module_path + 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



29
30
31
# File 'lib/puppet/module_tool/applications/unpacker.rb', line 29

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

#runObject



17
18
19
20
21
22
23
24
# File 'lib/puppet/module_tool/applications/unpacker.rb', line 17

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