File tree Expand file tree Collapse file tree 3 files changed +40
-0
lines changed
Expand file tree Collapse file tree 3 files changed +40
-0
lines changed Original file line number Diff line number Diff line change 1+ #!/usr/bin/env rake
2+
3+ task :default => 'foodcritic'
4+
5+ desc "Runs foodcritic linter"
6+ task :foodcritic do
7+ Rake ::Task [ :prepare_sandbox ] . execute
8+
9+ if Gem ::Version . new ( "1.9.2" ) <= Gem ::Version . new ( RUBY_VERSION . dup )
10+ sh "foodcritic -f any #{ sandbox_path } "
11+ else
12+ puts "WARN: foodcritic run is skipped as Ruby #{ RUBY_VERSION } is < 1.9.2."
13+ end
14+ end
15+
16+ desc "Runs knife cookbook test"
17+ task :knife do
18+ Rake ::Task [ :prepare_sandbox ] . execute
19+
20+ sh "bundle exec knife cookbook test cookbook -c test/.chef/knife.rb -o #{ sandbox_path } /../"
21+ end
22+
23+ task :prepare_sandbox do
24+ files = %w{ *.md *.rb attributes definitions libraries files providers recipes resources templates }
25+
26+ rm_rf sandbox_path
27+ mkdir_p sandbox_path
28+ cp_r Dir . glob ( "{#{ files . join ( ',' ) } }" ) , sandbox_path
29+ end
30+
31+ private
32+ def sandbox_path
33+ File . join ( File . dirname ( __FILE__ ) , %w( tmp cookbooks cookbook ) )
34+ end
Original file line number Diff line number Diff line change 1+ cache_type 'BasicFile'
2+ cache_options ( :path => "#{ ENV [ 'HOME' ] } /.chef/checksums" )
Original file line number Diff line number Diff line change 1+ source 'https://rubygems.org'
2+
3+ gem "chef" , "~> 11.8.2"
4+ gem "foodcritic" , "~> 3.0.3"
You can’t perform that action at this time.
0 commit comments