Class: MCollective::PluginPackager::ModulepackagePackager

Inherits:
Object
  • Object
show all
Defined in:
lib/mcollective/pluginpackager/modulepackage_packager.rb

Instance Method Summary collapse

Constructor Details

#initialize(plugin, pluginpath = nil, signature = nil, verbose = false, keep_artifacts = nil, module_template = nil) ⇒ ModulepackagePackager

Returns a new instance of ModulepackagePackager.



6
7
8
9
10
11
12
13
# File 'lib/mcollective/pluginpackager/modulepackage_packager.rb', line 6

def initialize(plugin, pluginpath = nil, signature = nil, verbose = false, keep_artifacts = nil, module_template = nil)
  assert_new_enough_puppet
  @plugin = plugin
  @package_name = "#{@plugin.mcname}_#{@plugin.[:name]}".gsub(/-/, '_')
  @verbose = verbose
  @keep_artifacts = keep_artifacts
  @module_template = module_template || File.join(File.dirname(__FILE__), 'templates', 'module')
end

Instance Method Details

#create_packagesObject

Build Process :

  • create module directory

  • run ‘puppet module build’

  • move generated package back to cwd



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/mcollective/pluginpackager/modulepackage_packager.rb', line 19

def create_packages
  begin
    puts "Building module for #{@package_name} plugin."

    @tmpdir = Dir.mktmpdir('mcollective_packager')
    make_module
    run_build
    move_package

    puts "Completed building module for #{@package_name} plugin."
  ensure
    if @keep_artifacts
      puts 'Keeping build artifacts'
      puts "Build artifacts saved - #{@tmpdir}"
    else
      cleanup_tmpdirs
    end
  end
end