thor-foodcritic 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "http://rubygems.org"
2
+
3
+ gemspec
@@ -0,0 +1,49 @@
1
+ # Thor FoodCritic
2
+
3
+ FoodCritic Thor tasks for your Cookbook projects
4
+
5
+ # Installation
6
+
7
+ gem install thor-foodcritic
8
+
9
+ # Usage
10
+
11
+ To add the FoodCritic tasks to any Thorfile just require this gem
12
+
13
+ require 'thor/foodcritic'
14
+
15
+ And then get a list of your thor tasks
16
+
17
+ $ thor list
18
+
19
+ foodcritic
20
+ ----------
21
+ thor foodcritic:lint # Run a lint test against the Cookbook in your current working directory.
22
+
23
+ Run the lint task to get a review
24
+
25
+ $ thor foodcritic:lint
26
+
27
+ FC002: Avoid string interpolation where not required: ...
28
+ FC003: Check whether you are running with chef server before using server-specific features: ...
29
+ FC011: Missing README in markdown format: ...
30
+
31
+ If any epic failure tags are specified with the `-f` flag, Thor will exit with a status code of `100`.
32
+
33
+ # License and Author
34
+
35
+ Author:: Jamie Winsor (<jamie@vialstudios.com>)
36
+
37
+ Copyright 2012, Jamie Winsor
38
+
39
+ Licensed under the Apache License, Version 2.0 (the "License");
40
+ you may not use this file except in compliance with the License.
41
+ You may obtain a copy of the License at
42
+
43
+ http://www.apache.org/licenses/LICENSE-2.0
44
+
45
+ Unless required by applicable law or agreed to in writing, software
46
+ distributed under the License is distributed on an "AS IS" BASIS,
47
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
48
+ See the License for the specific language governing permissions and
49
+ limitations under the License.
@@ -0,0 +1,26 @@
1
+ # encoding: utf-8
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+
4
+ require 'bundler'
5
+ require 'bundler/setup'
6
+ require 'thor/rake_compat'
7
+
8
+ class Default < Thor
9
+ include Thor::RakeCompat
10
+ Bundler::GemHelper.install_tasks
11
+
12
+ desc "build", "Build berkshelf-#{ThorFoodCritic::VERSION}.gem into the pkg directory"
13
+ def build
14
+ Rake::Task["build"].execute
15
+ end
16
+
17
+ desc "install", "Build and install berkshelf-#{ThorFoodCritic::VERSION}.gem into system gems"
18
+ def install
19
+ Rake::Task["install"].execute
20
+ end
21
+
22
+ desc "release", "Create tag v#{ThorFoodCritic::VERSION} and build and push berkshelf-#{ThorFoodCritic::VERSION}.gem to Rubygems"
23
+ def release
24
+ Rake::Task["release"].execute
25
+ end
26
+ end
@@ -0,0 +1,46 @@
1
+ require 'thor-foodcritic/version'
2
+ require 'foodcritic'
3
+
4
+ module ThorFoodCritic
5
+ class Tasks < Thor
6
+ namespace "foodcritic"
7
+
8
+ method_option :tags,
9
+ type: :array,
10
+ aliases: "-t",
11
+ desc: "Only check against rules with the specified tags.",
12
+ default: ["~FC001"]
13
+ method_option :include,
14
+ type: :array,
15
+ aliases: "-I",
16
+ desc: "Additional rule file path(s) to load.",
17
+ default: Array.new
18
+ method_option :epic_fail,
19
+ type: :array,
20
+ aliases: "-f",
21
+ desc: "Fail the build if any of the specified tags are matched.",
22
+ default: Array.new
23
+ method_option :exclude_paths,
24
+ type: :array,
25
+ aliases: "-e",
26
+ desc: "Paths to exclude when running tests.",
27
+ default: ['test/**/*', 'spec/**/*', 'features/**/*']
28
+ desc "lint", "Run a lint test against the Cookbook in your current working directory."
29
+ def lint
30
+ review = ::FoodCritic::Linter.new.check(Dir.pwd,
31
+ tags: options[:tags],
32
+ include_rules: options[:include],
33
+ fail_tags: options[:epic_fail],
34
+ exclude_paths: options[:exclude_paths]
35
+ )
36
+ say(review, :red)
37
+ exit_with_review(review)
38
+ end
39
+
40
+ private
41
+
42
+ def exit_with_review(review)
43
+ review.failed? ? exit(100) : exit(0)
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,3 @@
1
+ module ThorFoodCritic
2
+ VERSION = "0.1.1"
3
+ end
@@ -0,0 +1 @@
1
+ require 'thor-foodcritic'
@@ -0,0 +1,19 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "thor-foodcritic/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "thor-foodcritic"
7
+ s.version = ThorFoodCritic::VERSION
8
+ s.authors = ["Jamie Winsor"]
9
+ s.email = ["jamie@vialstudios.com"]
10
+ s.homepage = "https://github.com/reset/thor-foodcritic"
11
+ s.description = %q{FoodCritic Thor tasks for your Cookbook projects}
12
+ s.summary = s.description
13
+ s.files = `git ls-files`.split("\n")
14
+ s.require_paths = ["lib"]
15
+ s.required_ruby_version = ">= 1.9.1"
16
+
17
+ s.add_runtime_dependency 'thor'
18
+ s.add_runtime_dependency 'foodcritic'
19
+ end
metadata ADDED
@@ -0,0 +1,79 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: thor-foodcritic
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Jamie Winsor
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-06-23 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: thor
16
+ requirement: &70202747026440 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *70202747026440
25
+ - !ruby/object:Gem::Dependency
26
+ name: foodcritic
27
+ requirement: &70202746708320 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *70202746708320
36
+ description: FoodCritic Thor tasks for your Cookbook projects
37
+ email:
38
+ - jamie@vialstudios.com
39
+ executables: []
40
+ extensions: []
41
+ extra_rdoc_files: []
42
+ files:
43
+ - .gitignore
44
+ - Gemfile
45
+ - README.md
46
+ - Thorfile
47
+ - lib/thor-foodcritic.rb
48
+ - lib/thor-foodcritic/version.rb
49
+ - lib/thor/foodcritic.rb
50
+ - thor-foodcritic.gemspec
51
+ homepage: https://github.com/reset/thor-foodcritic
52
+ licenses: []
53
+ post_install_message:
54
+ rdoc_options: []
55
+ require_paths:
56
+ - lib
57
+ required_ruby_version: !ruby/object:Gem::Requirement
58
+ none: false
59
+ requirements:
60
+ - - ! '>='
61
+ - !ruby/object:Gem::Version
62
+ version: 1.9.1
63
+ required_rubygems_version: !ruby/object:Gem::Requirement
64
+ none: false
65
+ requirements:
66
+ - - ! '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ segments:
70
+ - 0
71
+ hash: -2483980677222153578
72
+ requirements: []
73
+ rubyforge_project:
74
+ rubygems_version: 1.8.11
75
+ signing_key:
76
+ specification_version: 3
77
+ summary: FoodCritic Thor tasks for your Cookbook projects
78
+ test_files: []
79
+ has_rdoc: