]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-cookbooks.git/commitdiff
Add basic travis support 43/head
authorGuilhem Lettron <guilhem@lettron.fr>
Mon, 8 Jul 2013 09:47:45 +0000 (11:47 +0200)
committerGuilhem Lettron <guilhem@lettron.fr>
Tue, 9 Jul 2013 15:36:33 +0000 (17:36 +0200)
.travis.yml [new file with mode: 0644]
Rakefile [new file with mode: 0644]
test/.chef/knife.rb [new file with mode: 0644]
test/support/Gemfile [new file with mode: 0644]

diff --git a/.travis.yml b/.travis.yml
new file mode 100644 (file)
index 0000000..ba955a4
--- /dev/null
@@ -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
diff --git a/Rakefile b/Rakefile
new file mode 100644 (file)
index 0000000..9039b24
--- /dev/null
+++ b/Rakefile
@@ -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
diff --git a/test/.chef/knife.rb b/test/.chef/knife.rb
new file mode 100644 (file)
index 0000000..9125df1
--- /dev/null
@@ -0,0 +1,2 @@
+cache_type 'BasicFile'
+cache_options(:path => "#{ENV['HOME']}/.chef/checksums")
diff --git a/test/support/Gemfile b/test/support/Gemfile
new file mode 100644 (file)
index 0000000..371cfdf
--- /dev/null
@@ -0,0 +1,5 @@
+source "https://rubygems.org"
+
+gem 'rake'
+gem 'foodcritic'
+gem 'chef', '>= 10.12.0'