Browse files

Adding to TravisCI builds

  • Loading branch information...
1 parent 03b9446 commit 64ded8f84cb6a80bb3b38f821316d0fbb259f8ca @nathenharvey nathenharvey committed Jul 7, 2012
Showing with 26 additions and 14 deletions.
  1. +2 −0 .chef/knife.rb
  2. +3 −1 .travis.yml
  3. +20 −13 Rakefile
  4. +1 −0 test/support/Gemfile
View
2 .chef/knife.rb
@@ -0,0 +1,2 @@
+cache_type 'BasicFile'
+cache_options(:path => "#{ENV['HOME']}/.chef/checksums")
View
4 .travis.yml
@@ -4,4 +4,6 @@ gemfile:
rvm:
- 1.9.2
- 1.9.3
-script: bundle exec rake foodcritic
+script:
+ - bundle exec rake knife
+ - bundle exec rake foodcritic
View
33 Rakefile
@@ -1,27 +1,34 @@
#!/usr/bin/env rake
+task :default => 'foodcritic'
+
desc "Runs foodcritic linter"
task :foodcritic do
- if Gem::Version.new("1.9.2") <= Gem::Version.new(RUBY_VERSION.dup)
- sandbox = File.join(File.dirname(__FILE__), %w{tmp foodcritic cookbook})
- prepare_foodcritic_sandbox(sandbox)
+ Rake::Task[:prepare_sandbox].execute
- sh "foodcritic --epic-fail any #{File.dirname(sandbox)}"
+ if Gem::Version.new("1.9.2") <= Gem::Version.new(RUBY_VERSION.dup)
+ sh "foodcritic -f any #{sandbox_path}"
else
puts "WARN: foodcritic run is skipped as Ruby #{RUBY_VERSION} is < 1.9.2."
end
end
-task :default => 'foodcritic'
+desc "Runs knife cookbook test"
+task :knife do
+ Rake::Task[:prepare_sandbox].execute
-private
+ sh "bundle exec knife cookbook test cookbook -o #{sandbox_path}/../"
+end
-def prepare_foodcritic_sandbox(sandbox)
- files = %w{*.md *.rb attributes definitions files providers
-recipes resources templates}
+task :prepare_sandbox do
+ files = %w{*.md *.rb attributes definitions files providers recipes resources templates}
- rm_rf sandbox
- mkdir_p sandbox
- cp_r Dir.glob("{#{files.join(',')}}"), sandbox
- puts "\n\n"
+ 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 cookbook))
end
View
1 test/support/Gemfile
@@ -2,3 +2,4 @@ source "https://rubygems.org"
gem 'rake'
gem 'foodcritic'
+gem 'chef'

0 comments on commit 64ded8f

Please sign in to comment.