Sha256: 50b8d2ab12606eab794355d3a7bdcc3a8ee83c18582afc43755698bed1c6f8f5

Contents?: true

Size: 707 Bytes

Versions: 57

Compression:

Stored size: 707 Bytes

Contents

module PuppetSpec::Modules
  class << self
    def create(name, dir, options = {})
      module_dir = File.join(dir, name)
      FileUtils.mkdir_p(module_dir)

      environment = options[:environment]

      if metadata = options[:metadata]
        metadata[:source]  ||= 'github'
        metadata[:author]  ||= 'puppetlabs'
        metadata[:version] ||= '9.9.9'
        metadata[:license] ||= 'to kill'
        metadata[:dependencies] ||= []

        metadata[:name] = "#{metadata[:author]}/#{name}"

        File.open(File.join(module_dir, 'metadata.json'), 'w') do |f|
          f.write(metadata.to_pson)
        end
      end

      Puppet::Module.new(name, module_dir, environment)
    end
  end
end

Version data entries

57 entries across 57 versions & 1 rubygems

Version Path
puppet-3.8.7 spec/lib/puppet_spec/modules.rb
puppet-3.8.7-x86-mingw32 spec/lib/puppet_spec/modules.rb
puppet-3.8.7-x64-mingw32 spec/lib/puppet_spec/modules.rb
puppet-3.8.6 spec/lib/puppet_spec/modules.rb
puppet-3.8.6-x86-mingw32 spec/lib/puppet_spec/modules.rb
puppet-3.8.6-x64-mingw32 spec/lib/puppet_spec/modules.rb
puppet-3.8.5 spec/lib/puppet_spec/modules.rb
puppet-3.8.5-x86-mingw32 spec/lib/puppet_spec/modules.rb
puppet-3.8.5-x64-mingw32 spec/lib/puppet_spec/modules.rb
puppet-3.8.4 spec/lib/puppet_spec/modules.rb
puppet-3.8.4-x86-mingw32 spec/lib/puppet_spec/modules.rb
puppet-3.8.4-x64-mingw32 spec/lib/puppet_spec/modules.rb
puppet-3.8.3 spec/lib/puppet_spec/modules.rb
puppet-3.8.3-x86-mingw32 spec/lib/puppet_spec/modules.rb
puppet-3.8.3-x64-mingw32 spec/lib/puppet_spec/modules.rb
puppet-3.8.2 spec/lib/puppet_spec/modules.rb
puppet-3.8.2-x86-mingw32 spec/lib/puppet_spec/modules.rb
puppet-3.8.2-x64-mingw32 spec/lib/puppet_spec/modules.rb
puppet-3.8.1 spec/lib/puppet_spec/modules.rb
puppet-3.8.1-x86-mingw32 spec/lib/puppet_spec/modules.rb