Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add testing and Travis CI setup

  • Loading branch information...
commit 1d06a11ada132f3de4a0e825b44cda4fc359599b 1 parent f18d9ea
@phlipper authored
View
9 .travis.yml
@@ -0,0 +1,9 @@
+language: ruby
+gemfile:
+ - test/support/Gemfile
+rvm:
+ - 1.9.2
+ - 1.9.3
+script:
+ - bundle exec rake knife
+ - bundle exec rake foodcritic
View
31 Rakefile
@@ -0,0 +1,31 @@
+#!/usr/bin/env rake
+
+task default: :foodcritic
+
+desc "Runs foodcritic linter"
+task :foodcritic do
+ Rake::Task[:prepare_sandbox].execute
+
+ sh "bundle exec foodcritic -f any #{sandbox_path}"
+end
+
+desc "Runs knife cookbook test"
+task :knife do
+ Rake::Task[:prepare_sandbox].execute
+
+ sh "bundle exec knife cookbook test cookbook -c test/.chef/knife.rb -o #{sandbox_path}/../"
+end
+
+task :prepare_sandbox do
+ files = %w{*.md *.rb attributes definitions libraries files 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 cookbook])
+end
View
2  test/.chef/knife.rb
@@ -0,0 +1,2 @@
+cache_type "BasicFile"
+cache_options(:path => "#{ENV["HOME"]}/.chef/checksums")
View
5 test/support/Gemfile
@@ -0,0 +1,5 @@
+source "https://rubygems.org"
+
+gem "rake"
+gem "foodcritic"
+gem "chef", ">= 10.12.0"
Please sign in to comment.
Something went wrong with that request. Please try again.