-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathRakefile
More file actions
36 lines (27 loc) · 956 Bytes
/
Rakefile
File metadata and controls
36 lines (27 loc) · 956 Bytes
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
#!/usr/bin/env rake
task :default => 'foodcritic'
desc "Runs foodcritic linter"
task :foodcritic do
Rake::Task[:prepare_sandbox].execute
if Gem::Version.new("1.9.2") <= Gem::Version.new(RUBY_VERSION.dup)
sh "foodcritic -t correctness #{sandbox_path}/cookbooks/walletserver/"
sh "foodcritic -t correctness #{sandbox_path}/cookbooks/coins/"
else
puts "WARN: foodcritic run is skipped as Ruby #{RUBY_VERSION} is < 1.9.2."
end
end
desc "Runs knife walletserver/coins cookbook test"
task :knife do
Rake::Task[:prepare_sandbox].execute
sh "bundle exec knife cookbook test walletserver -c test/.chef/knife.rb -o #{sandbox_path}/cookbooks/"
sh "bundle exec knife cookbook test coins -c test/.chef/knife.rb -o #{sandbox_path}/cookbooks/"
end
task :prepare_sandbox do
rm_rf sandbox_path
mkdir_p sandbox_path
cp_r Dir.glob("cookbooks"), sandbox_path
end
private
def sandbox_path
File.join(File.dirname(__FILE__), "tmp")
end