Sha256: 6c2432bcf4798967b95ddaa75338c028b8ac59df22b441ded90f3ab590d0767f

Contents?: true

Size: 1008 Bytes

Versions: 150

Compression:

Stored size: 1008 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

    def generate_files(name, dir, options = {})
      module_dir = File.join(dir, name)
      FileUtils.mkdir_p(module_dir)

      if metadata = options[:metadata]
        File.open(File.join(module_dir, 'metadata.json'), 'w') do |f|
          f.write(metadata.to_pson)
        end
      end
    end
  end
end

Version data entries

150 entries across 150 versions & 1 rubygems

Version Path
puppet-4.10.12 spec/lib/puppet_spec/modules.rb
puppet-4.10.12-x86-mingw32 spec/lib/puppet_spec/modules.rb
puppet-4.10.12-x64-mingw32 spec/lib/puppet_spec/modules.rb
puppet-4.10.12-universal-darwin spec/lib/puppet_spec/modules.rb
puppet-4.10.11 spec/lib/puppet_spec/modules.rb
puppet-4.10.11-x86-mingw32 spec/lib/puppet_spec/modules.rb
puppet-4.10.11-x64-mingw32 spec/lib/puppet_spec/modules.rb
puppet-4.10.11-universal-darwin spec/lib/puppet_spec/modules.rb
puppet-4.10.10 spec/lib/puppet_spec/modules.rb
puppet-4.10.10-x86-mingw32 spec/lib/puppet_spec/modules.rb
puppet-4.10.10-x64-mingw32 spec/lib/puppet_spec/modules.rb
puppet-4.10.10-universal-darwin spec/lib/puppet_spec/modules.rb
puppet-4.10.9 spec/lib/puppet_spec/modules.rb
puppet-4.10.9-x86-mingw32 spec/lib/puppet_spec/modules.rb
puppet-4.10.9-x64-mingw32 spec/lib/puppet_spec/modules.rb
puppet-4.10.9-universal-darwin spec/lib/puppet_spec/modules.rb
puppet-4.10.8 spec/lib/puppet_spec/modules.rb
puppet-4.10.8-x86-mingw32 spec/lib/puppet_spec/modules.rb
puppet-4.10.8-x64-mingw32 spec/lib/puppet_spec/modules.rb
puppet-4.10.8-universal-darwin spec/lib/puppet_spec/modules.rb