Class: Puppet::ModuleTool::Applications::Builder

Inherits:
Application show all
Defined in:
lib/vendor/puppet/module_tool/applications/builder.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(path, options = {}) ⇒ Builder

Returns a new instance of Builder.



7
8
9
10
11
# File 'lib/vendor/puppet/module_tool/applications/builder.rb', line 7

def initialize(path, options = {})
  @path = File.expand_path(Puppet::ModuleTool.find_module_root(path))
  @pkg_path = File.join(@path, 'pkg')
  super(options)
end

Instance Method Details

#runObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/vendor/puppet/module_tool/applications/builder.rb', line 13

def run
  load_modulefile!
  create_directory
  copy_contents
  
  Puppet.notice "Building #{@path} for release"
  tar
  gzip
  relative = Pathname.new(File.join(@pkg_path, filename('tar.gz'))).relative_path_from(Pathname.new(Dir.pwd))

  # Return the Pathname object representing the path to the release
  # archive just created. This return value is used by the module_tool
  # face build action, and displayed to on the console using the to_s
  # method.
  #
  # Example return value:
  #
  #   <Pathname:puppetlabs-apache/pkg/puppetlabs-apache-0.0.1.tar.gz>
  #
  relative
end