class MCollective::PluginPackager::ModulepackagePackager

Public Class Methods

new(plugin, pluginpath = nil, signature = nil, verbose = false, keep_artifacts = nil, module_template = nil) click to toggle source
   # File lib/mcollective/pluginpackager/modulepackage_packager.rb
 6 def initialize(plugin, pluginpath = nil, signature = nil, verbose = false, keep_artifacts = nil, module_template = nil)
 7   assert_new_enough_puppet
 8   @plugin = plugin
 9   @package_name = "#{@plugin.mcname}_#{@plugin.metadata[:name]}".gsub(/-/, '_')
10   @verbose = verbose
11   @keep_artifacts = keep_artifacts
12   @module_template = module_template || File.join(File.dirname(__FILE__), 'templates', 'module')
13 end

Public Instance Methods

create_packages() click to toggle source

Build Process :

  • create module directory

  • run 'puppet module build'

  • move generated package back to cwd

   # File lib/mcollective/pluginpackager/modulepackage_packager.rb
19 def create_packages
20   begin
21     puts "Building module for #{@package_name} plugin."
22 
23     @tmpdir = Dir.mktmpdir('mcollective_packager')
24     make_module
25     run_build
26     move_package
27 
28     puts "Completed building module for #{@package_name} plugin."
29   ensure
30     if @keep_artifacts
31       puts 'Keeping build artifacts'
32       puts "Build artifacts saved - #{@tmpdir}"
33     else
34       cleanup_tmpdirs
35     end
36   end
37 end