Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add foodcritic and travisci

  • Loading branch information...
commit 1292e64ca6236de44b390c65c2a1738bc9794684 1 parent 07cfa91
Nathen Harvey nathenharvey authored
Showing with 38 additions and 0 deletions.
  1. +7 −0 .travis.yml
  2. +27 −0 Rakefile
  3. +4 −0 test/support/Gemfile
7 .travis.yml
View
@@ -0,0 +1,7 @@
+language: ruby
+gemfile:
+ - test/support/Gemfile
+rvm:
+ - 1.9.2
+ - 1.9.3
+script: BUNDLE_GEMFILE=test/support/Gemfile bundle exec rake foodcritic
27 Rakefile
View
@@ -0,0 +1,27 @@
+#!/usr/bin/env rake
+
+desc "Runs foodcritic 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
4 test/support/Gemfile
View
@@ -0,0 +1,4 @@
+source "https://rubygems.org"
+
+gem 'rake'
+gem 'foodcritic'
Please sign in to comment.
Something went wrong with that request. Please try again.