-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
59 lines (43 loc) · 1.14 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
require 'rake'
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec) do |t|
t.pattern = 'spec/*/*_spec.rb'
end
task :default => :spec
task :modspec do
FileList["static-modules/**/Rakefile"].each do |project|
Rake::Task.clear
load project
dir = project.pathmap("%d")
Dir.chdir(dir) do
spec_task = Rake::Task[:spec]
spec_task.invoke()
end
end
end
require 'puppet-lint/tasks/puppet-lint'
# see https://github.com/rodjek/puppet-lint/issues/331
Rake::Task[:lint].clear
PuppetLint::RakeTask.new :lint do |config|
config.pattern = 'static-modules/**/*.pp'
config.ignore_paths = ['modules']
config.disable_checks = ['80chars']
config.with_context = true
end
desc "Run serverspec to all hosts"
task :spec => 'serverspec:all'
class ServerspecTask < RSpec::Core::RakeTask
attr_accessor :target
def spec_command
cmd = super
"env TARGET_HOST=#{target} #{cmd}"
end
end
namespace :serverspec do
%w(osquery).each do |profile|
ServerspecTask.new(profile.to_sym) do |t|
t.target = profile
t.pattern = "spec/#{profile}/*_spec.rb"
end
end
end