Sha256: 710602ea36656be215872ad1a8ab4bb68c789a0ce34f547088caaf8e81ef0992

Contents?: true

Size: 932 Bytes

Versions: 10

Compression:

Stored size: 932 Bytes

Contents

require 'pathname'
require 'puppet/module_tool'

module Puppet::ModuleTool

  # = Skeleton
  #
  # This class provides methods for finding templates for the 'generate' action.
  class Skeleton

    # TODO Review whether the 'freeze' feature should be fixed or deleted.
    # def freeze!
    #   FileUtils.rm_fr custom_path rescue nil
    #   FileUtils.cp_r default_path, custom_path
    # end

    # Return Pathname with 'generate' templates.
    def path
      paths.detect { |path| path.directory? }
    end

    # Return Pathnames to look for 'generate' templates.
    def paths
      @paths ||= [ custom_path, default_path ]
    end

    # Return Pathname of custom templates directory.
    def custom_path
      Pathname(Puppet.settings[:module_skeleton_dir])
    end

    # Return Pathname of default template directory.
    def default_path
      Pathname(__FILE__).dirname + 'skeleton/templates/generator'
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
puppet-3.5.1 lib/puppet/module_tool/skeleton.rb
puppet-3.5.1-x86-mingw32 lib/puppet/module_tool/skeleton.rb
puppet-3.5.1.rc1 lib/puppet/module_tool/skeleton.rb
puppet-3.5.1.rc1-x86-mingw32 lib/puppet/module_tool/skeleton.rb
puppet-3.5.0.rc3 lib/puppet/module_tool/skeleton.rb
puppet-3.5.0.rc3-x86-mingw32 lib/puppet/module_tool/skeleton.rb
puppet-3.5.0.rc2 lib/puppet/module_tool/skeleton.rb
puppet-3.5.0.rc2-x86-mingw32 lib/puppet/module_tool/skeleton.rb
puppet-3.5.0.rc1 lib/puppet/module_tool/skeleton.rb
puppet-3.5.0.rc1-x86-mingw32 lib/puppet/module_tool/skeleton.rb