This repository has been archived by the owner on Apr 16, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit cb69f71
Showing
8 changed files
with
146 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
*.gem | ||
.bundle | ||
Gemfile.lock | ||
pkg/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
source "http://rubygems.org" | ||
|
||
gemspec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Thor FoodCritic | ||
|
||
FoodCritic Thor tasks for your Cookbook projects | ||
|
||
# Installation | ||
|
||
gem install thor-foodcritic | ||
|
||
# Usage | ||
|
||
To add the FoodCritic tasks to any Thorfile just require this gem | ||
|
||
require 'thor/foodcritic' | ||
|
||
And then get a list of your thor tasks | ||
|
||
$ thor list | ||
|
||
foodcritic | ||
---------- | ||
thor foodcritic:lint # Run a lint test against the Cookbook in your current working directory. | ||
|
||
Run the lint task to get a review | ||
|
||
$ thor foodcritic:lint | ||
|
||
FC002: Avoid string interpolation where not required: ... | ||
FC003: Check whether you are running with chef server before using server-specific features: ... | ||
FC011: Missing README in markdown format: ... | ||
|
||
If any epic failure tags are specified with the `-f` flag, Thor will exit with a status code of `100`. | ||
|
||
# License and Author | ||
|
||
Author:: Jamie Winsor (<jamie@vialstudios.com>) | ||
|
||
Copyright 2012, Jamie Winsor | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# encoding: utf-8 | ||
$:.push File.expand_path("../lib", __FILE__) | ||
|
||
require 'bundler' | ||
require 'bundler/setup' | ||
require 'thor/rake_compat' | ||
|
||
class Default < Thor | ||
include Thor::RakeCompat | ||
Bundler::GemHelper.install_tasks | ||
|
||
desc "build", "Build berkshelf-#{ThorFoodCritic::VERSION}.gem into the pkg directory" | ||
def build | ||
Rake::Task["build"].execute | ||
end | ||
|
||
desc "install", "Build and install berkshelf-#{ThorFoodCritic::VERSION}.gem into system gems" | ||
def install | ||
Rake::Task["install"].execute | ||
end | ||
|
||
desc "release", "Create tag v#{ThorFoodCritic::VERSION} and build and push berkshelf-#{ThorFoodCritic::VERSION}.gem to Rubygems" | ||
def release | ||
Rake::Task["release"].execute | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
require 'thor-foodcritic/version' | ||
require 'foodcritic' | ||
|
||
module ThorFoodCritic | ||
class Tasks < Thor | ||
namespace "foodcritic" | ||
|
||
method_option :tags, | ||
type: :array, | ||
aliases: "-t", | ||
desc: "Only check against rules with the specified tags.", | ||
default: ["~FC001"] | ||
method_option :include_rules, | ||
type: :array, | ||
aliases: "-I", | ||
desc: "Additional rule file path(s) to load.", | ||
default: Array.new | ||
method_option :fail_tags, | ||
type: :array, | ||
aliases: "-f", | ||
desc: "Fail the build if any of the specified tags are matched.", | ||
default: Array.new | ||
method_option :exclude_paths, | ||
type: :array, | ||
aliases: "-e", | ||
desc: "Paths to exclude when running tests.", | ||
default: ['test/**/*', 'spec/**/*', 'features/**/*'] | ||
desc "lint", "Run a lint test against the Cookbook in your current working directory." | ||
def lint | ||
review = ::FoodCritic::Linter.new.check(Dir.pwd, options) | ||
say(review, :red) | ||
exit_with_review(review) | ||
end | ||
|
||
private | ||
|
||
def exit_with_review(review) | ||
review.failed? ? exit(100) : exit(0) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module ThorFoodCritic | ||
VERSION = "0.1.0" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
require 'thor-foodcritic' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# -*- encoding: utf-8 -*- | ||
$:.push File.expand_path("../lib", __FILE__) | ||
require "thor-foodcritic/version" | ||
|
||
Gem::Specification.new do |s| | ||
s.name = "thor-foodcritic" | ||
s.version = ThorFoodCritic::VERSION | ||
s.authors = ["Jamie Winsor"] | ||
s.email = ["jamie@vialstudios.com"] | ||
s.homepage = "https://github.com/reset/thor-foodcritic" | ||
s.description = %q{FoodCritic Thor tasks for your Cookbook projects} | ||
s.summary = s.description | ||
s.files = `git ls-files`.split("\n") | ||
s.require_paths = ["lib"] | ||
s.required_ruby_version = ">= 1.9.1" | ||
|
||
s.add_runtime_dependency 'thor' | ||
s.add_runtime_dependency 'foodcritic' | ||
end |