forked from puppetlabs-toy-chest/puppetlabs-dism
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathRakefile
59 lines (51 loc) · 1.28 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
require 'rubygems'
require 'rake'
require 'rspec/core/rake_task'
task :default do
system("rake -T")
end
task :specs => [:spec]
desc "Run all rspec-puppet tests"
RSpec::Core::RakeTask.new(:spec) do |t|
t.rspec_opts = ['--color']
# ignores fixtures directory.
t.pattern = 'spec/{classes,defines,unit}/**/*_spec.rb'
end
desc "Build puppet module package"
task :build do
# This will be deprecated once puppet-module is a face.
begin
Gem::Specification.find_by_name('puppet-module')
rescue Gem::LoadError, NoMethodError
require 'puppet/face'
pmod = Puppet::Face['module', :current]
pmod.build('./')
end
end
desc "Clean the package directory"
task :clean do
FileUtils.rm_rf("pkg/")
end
desc "Check puppet manifests with puppet-lint"
task :lint do
# This requires pull request: https://github.com/rodjek/puppet-lint/pull/81
system("puppet-lint manifests")
system("puppet-lint tests")
end
desc "Testing in virtual system."
task :vm do
require 'vagrant'
env = Vagrant::Environment.new
puts "Bringing up vagrant environment"
env.cli("up")
end
desc "Unit test in virtual system."
task :vm_test do
require 'facter'
unless Facter.value('virtual')
Dir.chdir('tests')
Dir.glob('**/*.pp').each do |f|
system("puppet apply -v #{f}")
end
end
end