forked from vmware-archive/vmware-vcenter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
39 lines (33 loc) · 1 KB
/
Rakefile
1
2
3
4
5
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
require 'rubygems'
require 'puppetlabs_spec_helper/rake_tasks'
def io_popen(command)
IO.popen(command) do |io|
io.each do |line|
print line
yield line if block_given?
end
end
end
# Customize lint option
task :lint do
PuppetLint.configuration.send("disable_80chars")
PuppetLint.configuration.send("disable_class_parameter_defaults")
end
# Initialize vagrant instance for testing
desc "Powers on Vagrant VMs with specific manifests"
task :vagrant, :manifest do |t, args|
Rake::Task["spec_prep"].execute
prefix = "VAGRANT_MANIFEST='#{args[:manifest]||'init.pp'}'"
puts args[:manifest]
provision = false
io_popen("export #{prefix}; vagrant up --provider=vmware_fusion") do |line|
provision = true if line =~ /Machine is already running./
end
io_popen("export #{prefix}; vagrant provision") if provision
end
# Cleanup vagrant environment
desc "Destroys Vagrant VMs and cleanup spec directory"
task :vagrant_clean do
`vagrant destroy -f`
Rake::Task["spec_clean"].execute
end