forked from sous-chefs/openvpn
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
75 lines (61 loc) · 1.59 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# Encoding: utf-8
namespace :prepare do
desc 'Install ChefDK'
task :chefdk do
begin
gem 'chef-dk', '0.2.1'
rescue Gem::LoadError
puts 'ChefDK not found. Installing it for you...'
sh %(wget -O /tmp/meez_chefdk.deb https://opscode-omnibus-packages.s3.amazonaws.com/ubuntu/12.04/x86_64/chefdk_0.2.1-1_amd64.deb)
sh %(sudo dpkg -i /tmp/meez_chefdk.deb)
end
end
task :bundle do
if ENV['CI']
sh %(chef exec bundle install --path=.bundle --jobs 1 --retry 3 --verbose)
else
sh %(chef exec bundle install --path .bundle)
end
end
task :berks do
sh %(chef exec berks install)
end
end
desc 'Install required Gems and Cookbooks'
task prepare: ['prepare:bundle', 'prepare:berks']
namespace :style do
task :rubocop do
sh %(chef exec rubocop)
end
task :foodcritic do
sh %(chef exec foodcritic .)
end
end
desc 'Run all style checks'
task style: ['style:foodcritic', 'style:rubocop']
namespace :integration do
task :kitchen do
sh %(chef exec kitchen test)
end
end
task integration: ['integration:kitchen']
namespace :unit do
task :chefspec do
sh %(chef exec rspec)
end
end
desc 'Run all unit tests'
task unit: ['unit:chefspec']
task spec: ['unit']
# Run all tests
desc 'Run all tests'
task test: ['style', 'unit', 'integration']
# The default rake task should just run it all
desc 'Install required Gems and Cookbook then run all tests'
task default: ['prepare', 'test']
begin
require 'kitchen/rake_tasks'
Kitchen::RakeTasks.new
rescue LoadError
puts '>>>>> Kitchen gem not loaded, omitting tasks' unless ENV['CI']
end