]> git.donarmstrong.com Git - dsa-puppet.git/blob - 3rdparty/modules/stdlib/spec/lib/puppet_spec/modules.rb
upgrade to stdlib 4.6.1
[dsa-puppet.git] / 3rdparty / modules / stdlib / spec / lib / puppet_spec / modules.rb
1 #! /usr/bin/env ruby -S rspec
2 module PuppetSpec::Modules
3   class << self
4     def create(name, dir, options = {})
5       module_dir = File.join(dir, name)
6       FileUtils.mkdir_p(module_dir)
7
8       environment = options[:environment]
9
10       if metadata = options[:metadata]
11         metadata[:source]  ||= 'github'
12         metadata[:author]  ||= 'puppetlabs'
13         metadata[:version] ||= '9.9.9'
14         metadata[:license] ||= 'to kill'
15         metadata[:dependencies] ||= []
16
17         metadata[:name] = "#{metadata[:author]}/#{name}"
18
19         File.open(File.join(module_dir, 'metadata.json'), 'w') do |f|
20           f.write(metadata.to_pson)
21         end
22       end
23
24       Puppet::Module.new(name, module_dir, environment)
25     end
26   end
27 end