-
Notifications
You must be signed in to change notification settings - Fork 4
/
Rakefile
executable file
·37 lines (29 loc) · 918 Bytes
/
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
#!/usr/bin/env rake
require 'stove/rake_task'
Stove::RakeTask.new
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec)
require 'rubocop/rake_task'
RuboCop::RakeTask.new
desc 'Run rspec, foodcritic, and rubocop'
task default: [:spec, :foodcritic, :rubocop]
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 -f any -X spec test #{sandbox_path}"
else
puts "WARN: foodcritic run is skipped as Ruby #{RUBY_VERSION} is < 1.9.2."
end
end
task :prepare_sandbox do
files = %w( *.md *.rb attributes definitions files libraries providers
recipes resources templates )
rm_rf sandbox_path
mkdir_p sandbox_path
cp_r Dir.glob("{#{files.join(',')}}"), sandbox_path
end
private
def sandbox_path
File.join(File.dirname(__FILE__), %w(tmp cookbooks stow))
end