Sha256: c5c1ec0b185e07ed2e5a353b78d4e8741f73055c0574d5d3f8b75a140ef3c29a

Contents?: true

Size: 737 Bytes

Versions: 6

Compression:

Stored size: 737 Bytes

Contents

#! /usr/bin/env ruby -S rspec
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

6 entries across 6 versions & 1 rubygems

Version Path
puppet-retrospec-0.12.1 spec/fixtures/modules/stdlib/spec/lib/puppet_spec/modules.rb
puppet-retrospec-0.12.0 spec/fixtures/modules/stdlib/spec/lib/puppet_spec/modules.rb
puppet-retrospec-0.11.0 spec/fixtures/modules/stdlib/spec/lib/puppet_spec/modules.rb
puppet-retrospec-0.10.0 spec/fixtures/modules/stdlib/spec/lib/puppet_spec/modules.rb
puppet-retrospec-0.9.1 spec/fixtures/modules/stdlib/spec/lib/puppet_spec/modules.rb
puppet-retrospec-0.9.0 spec/fixtures/modules/stdlib/spec/lib/puppet_spec/modules.rb