Sha256: 11be63340bea70ce67c9f814dbcff9de9349de9c7dc1b90c3011fe1a238b588d

Contents?: true

Size: 763 Bytes

Versions: 17

Compression:

Stored size: 763 Bytes

Contents

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

      environment = Puppet::Node::Environment.new(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, :environment => environment, :path => module_dir)
    end
  end
end

Version data entries

17 entries across 17 versions & 2 rubygems

Version Path
puppet-2.7.26 spec/lib/puppet_spec/modules.rb
puppet-2.7.25 spec/lib/puppet_spec/modules.rb
puppet-2.7.24 spec/lib/puppet_spec/modules.rb
puppet-2.7.23 spec/lib/puppet_spec/modules.rb
puppet-2.7.22 spec/lib/puppet_spec/modules.rb
puppet-2.7.21 spec/lib/puppet_spec/modules.rb
puppet-2.7.20 spec/lib/puppet_spec/modules.rb
puppet-2.7.20.rc1 spec/lib/puppet_spec/modules.rb
librarian-puppet-0.9.4 vendor/gems/ruby/1.8/gems/puppet-2.7.18/spec/lib/puppet_spec/modules.rb
puppet-2.7.19 spec/lib/puppet_spec/modules.rb
librarian-puppet-0.9.3 vendor/gems/ruby/1.8/gems/puppet-2.7.18/spec/lib/puppet_spec/modules.rb
puppet-2.7.18 spec/lib/puppet_spec/modules.rb
puppet-2.7.17 spec/lib/puppet_spec/modules.rb
puppet-2.7.16 spec/lib/puppet_spec/modules.rb
puppet-2.7.14 spec/lib/puppet_spec/modules.rb
puppet-2.7.13 spec/lib/puppet_spec/modules.rb
puppet-2.7.12 spec/lib/puppet_spec/modules.rb