diff --git a/lib/puppet/module_tool/applications/generator.rb b/lib/puppet/module_tool/applications/generator.rb index 699fe246d..9f932dddb 100644 --- a/lib/puppet/module_tool/applications/generator.rb +++ b/lib/puppet/module_tool/applications/generator.rb @@ -1,141 +1,144 @@ require 'pathname' require 'fileutils' require 'erb' module Puppet::Module::Tool module Applications class Generator < Application def initialize(full_module_name, options = {}) begin @metadata = Metadata.new(:full_module_name => full_module_name) rescue ArgumentError raise "Could not generate directory #{full_module_name.inspect}, you must specify a dash-separated username and module name." end super(options) end def skeleton @skeleton ||= Skeleton.new end def get_binding binding end def run if destination.directory? raise ArgumentError, "#{destination} already exists." end Puppet.notice "Generating module at #{Dir.pwd}/#{@metadata.dashed_name}" files_created = [] skeleton.path.find do |path| if path == skeleton destination.mkpath else node = Node.on(path, self) if node node.install! files_created << node.target else Puppet.notice "Could not generate from #{path}" end end end # Return an array of Pathname objects representing file paths of files # and directories just generated. This return value is used by the # module_tool face generate action, and displayed on the console. # # Example return value: # # [ # #, # #, # #, # #, # #, # #, # #, # #, # #, # #, # #