-
Notifications
You must be signed in to change notification settings - Fork 49
/
Copy pathRakefile
62 lines (49 loc) · 1.47 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
task(:default) { sh %( rake --tasks ) }
namespace :test do
desc "Run Chef's code-style linter, cookstyle"
task :lint do
sh %( chef exec cookstyle )
end
desc "Run Chef's cookbook linter, foodcritic"
task :critic do
sh %( chef exec foodcritic . )
end
task foodcritic: [:critic]
desc "Run Chef's linter and attempt to auto-correct offenses"
task :lintfix do
sh %( chef exec cookstyle --auto-correct )
end
desc 'Run the unit tests'
task :unit do
sh %( chef exec rspec spec/ )
end
task spec: [:unit]
desc 'Spin up the kitchen instances for integration testing'
task :provision do
sh %( chef exec kitchen create )
end
desc 'Apply the cookbook to the running kitchen instances'
task :deploy do
sh %( chef exec kitchen converge )
end
desc 'Run the integration tests against already running kitchen instances'
task :verify do
sh %( chef exec kitchen verify )
end
desc 'Run the integration tests start to finish'
task :integration do
sh %( chef exec kitchen test )
end
desc 'Cleanup various artificats like lockfiles and running kitchen instances'
task :cleanup do
rm_rf ['Berksfile.lock', 'Gemfile.lock']
sh %( chef exec kitchen destroy )
rm_rf '.kitchen'
end
desc 'Run all tests in the following order: Lint => Critic => Unit => Integration'
task all: %i(lint critic unit integration)
desc 'Start `guard` for continuous testing'
task :guard do
sh %( bundle exec guard start )
end
end