6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
# File 'lib/rspec-puppet/setup.rb', line 6
def self.run(module_name=nil)
unless is_module_dir?
$stderr.puts "Does not appear to be a Puppet module. Aborting"
return false
end
if module_name.nil?
module_name = get_module_name
if module_name.nil?
$stderr.puts "Unable to determine module name. Aborting"
return false
end
end
[
'spec',
'spec/classes',
'spec/defines',
'spec/functions',
'spec/hosts',
'spec/fixtures',
'spec/fixtures/manifests',
'spec/fixtures/modules',
"spec/fixtures/modules/#{module_name}",
].each { |dir| safe_mkdir(dir) }
safe_touch('spec/fixtures/manifests/site.pp')
['manifests','lib','files','templates'].each do |dir|
if File.exist? dir
safe_make_symlink("../../../../#{dir}", "spec/fixtures/modules/#{module_name}/#{dir}")
end
end
safe_create_spec_helper
safe_create_rakefile
end
|