Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add TravisCI support for Foodcritic (let the shame begin).

  • Loading branch information...
commit dd4fd6f2280929ad7d0f9ecc9b6a33f446a8d045 1 parent fad6d09
@fnichol authored
Showing with 41 additions and 0 deletions.
  1. +2 −0  .gitignore
  2. +6 −0 .travis.yml
  3. +29 −0 Rakefile
  4. +4 −0 test/support/Gemfile
View
2  .gitignore
@@ -0,0 +1,2 @@
+Gemfile.lock
+tmp/
View
6 .travis.yml
@@ -0,0 +1,6 @@
+language: ruby
+gemfile:
+ - test/support/Gemfile
+rvm:
+ - 1.9.3
+script: BUNDLE_GEMFILE=test/support/Gemfile bundle exec rake test foodcritic
View
29 Rakefile
@@ -0,0 +1,29 @@
+#!/usr/bin/env rake
+
+@cookbook = "rvm_passenger"
+
+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
4 test/support/Gemfile
@@ -0,0 +1,4 @@
+source "https://rubygems.org"
+
+gem 'rake'
+gem 'foodcritic', :platforms => :ruby_19
Please sign in to comment.
Something went wrong with that request. Please try again.