Permalink
Browse files

TravisCI!!!! <3 <3 <3

  • Loading branch information...
1 parent ca2f677 commit 5dec026fe6a1f55046e27a13bff73bd645f643a8 @fnichol fnichol committed May 4, 2012
Showing with 39 additions and 0 deletions.
  1. +2 −0 .gitignore
  2. +6 −0 .travis.yml
  3. +27 −0 Rakefile
  4. +4 −0 test/support/Gemfile
View
@@ -0,0 +1,2 @@
+Gemfile.lock
+tmp/
View
@@ -0,0 +1,6 @@
+language: ruby
+gemfile:
+ - test/support/Gemfile
+rvm:
+ - 1.9.3
+script: BUNDLE_GEMFILE=test/support/Gemfile bundle exec rake foodcritic
View
@@ -0,0 +1,27 @@
+#!/usr/bin/env rake
+
+desc "Runs foodcritc 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)
+
+ sh "foodcritic --epic-fail any #{File.dirname(sandbox)}"
+ else
+ puts "WARN: foodcritic run is skipped as Ruby #{RUBY_VERSION} is < 1.9.2."
+ end
+end
+
+task :default => 'foodcritic'
+
+private
+
+def prepare_foodcritic_sandbox(sandbox)
+ 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"
+end
View
@@ -0,0 +1,4 @@
+source "https://rubygems.org"
+
+gem 'rake'
+gem 'foodcritic', :platforms => :ruby_19

0 comments on commit 5dec026

Please sign in to comment.