Merge pull request #43 from Youscribe/travis

Add basic travis support
This commit is contained in:
Alexandre Marangone 2013-09-09 09:18:54 -07:00
commit 57ee2f6810
4 changed files with 43 additions and 0 deletions

9
.travis.yml Normal file
View File

@ -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

27
Rakefile Normal file
View File

@ -0,0 +1,27 @@
#!/usr/bin/env rake
require 'foodcritic'
task :default => [:foodcritic]
FoodCritic::Rake::LintTask.new
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 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 cookbook))
end

2
test/.chef/knife.rb Normal file
View File

@ -0,0 +1,2 @@
cache_type 'BasicFile'
cache_options(:path => "#{ENV['HOME']}/.chef/checksums")

5
test/support/Gemfile Normal file
View File

@ -0,0 +1,5 @@
source "https://rubygems.org"
gem 'rake'
gem 'foodcritic'
gem 'chef', '>= 10.12.0'