pre-commit 0.26.0 → 0.27.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0f3bf3d955e63aa83b8cdb6a79e0c4ee19ef3559
4
- data.tar.gz: c1860927a7b3a4c8f808ec2d6a92af69d4097085
3
+ metadata.gz: 4b71bf7fef97fbbe46f7ce5d530295579db2c825
4
+ data.tar.gz: 1a7846252f99ef257f3b5e8e7e0355b392e221d8
5
5
  SHA512:
6
- metadata.gz: 95ad7f66ff5294168ea8e1b708e3b42a0c9841057616e68d5728f78a46ea8e73271c5bf36db0af64fd4a908e83c2b93123241168cefa083d8c56c19c04bf7d1a
7
- data.tar.gz: 1ab80793c09ec5bb920e24bd507d06e88789c07e2ccacd9c361ef0ad578caec91c3ebb058c92e3dc6214c9886b375cb63a4b478cfa7bc7eacfea012b4b62c8a1
6
+ metadata.gz: dc98b3bcc180f96d98d941e7a3429d0678b33101ac21157b0ede2173df8b72807acbadb4473173c0e11b7af36e2ddca13b453275ae96c6c3f6b4d6a314563e1f
7
+ data.tar.gz: a38b6635bd2c57783d7e13b7bdaf0dd6a7f304fad1cf09a0039219c59c08b932e0d72db3bf78b74998b7b4fc78144240c4dda558cdf302fc8bc495abaf51bcf3
data/README.md CHANGED
@@ -5,7 +5,7 @@ A better pre-commit hook for git.
5
5
  [![Coverage Status](https://img.shields.io/coveralls/jish/pre-commit/master.svg)](https://coveralls.io/r/jish/pre-commit?branch=master)
6
6
  [![Build status](https://travis-ci.org/jish/pre-commit.svg?branch=master)](https://travis-ci.org/jish/pre-commit)
7
7
  [![Dependency Status](https://gemnasium.com/jish/pre-commit.png)](https://gemnasium.com/jish/pre-commit)
8
- [![Documentation](https://img.shields.io/badge/yard-docs-blue.svg)](http://rubydoc.info/gems/pre-commit/frames)
8
+ [![Documentation](https://img.shields.io/badge/yard-docs-blue.svg)](http://www.rubydoc.info/gems/pre-commit/frames)
9
9
 
10
10
  ## Installation
11
11
 
@@ -28,7 +28,8 @@ If you are using rvm you need to install pre-commit into the ```default``` gemse
28
28
 
29
29
  Alternatively you can configure pre-commit to use the ```current``` rvm gemset
30
30
 
31
- $ git config pre-commit.ruby "rvm `rvm current` do ruby"
31
+ $ git config pre-commit.ruby "rvm `rvm current` do ruby" # OR:
32
+ $ git config pre-commit.ruby `rvm wrapper current show ruby` # available in RVM 1.26.12
32
33
 
33
34
  ## Available checks
34
35
 
@@ -41,7 +42,6 @@ These are the available checks:
41
42
  * tabs
42
43
  * jshint
43
44
  * js_lint
44
- * closure\_syntax\_check
45
45
  * php (Runs php -l on all staged files)
46
46
  * rspec_focus (Will check if you are about to check in a :focus in a spec file)
47
47
  * ruby_symbol_hashrockets (1.9 syntax. BAD :foo => "bar". GOOD foo: "bar")
@@ -52,8 +52,9 @@ These are the available checks:
52
52
  * rubocop (Check ruby code style using the rubocop gem. Rubocop must be installed)
53
53
  * before_all (Check your RSpec tests for the use of `before(:all)`)
54
54
  * coffeelint (Check your coffeescript files using the [coffeelint gem.](https://github.com/clutchski/coffeelint))
55
- * go (Runs go fmt on a go source file and fail if formatting is incorrect, then runs go build and fails if can't compile)
56
- * scss_lint (Check your SCSS files using the [scss-lint gem](https://github.com/causes/scss-lint))
55
+ * gobuild (Runs go build and fails if can't compile)
56
+ * gofmt (Runs go fmt on go source files and fail if formatting is incorrect)
57
+ * scss_lint (Check your SCSS files using the [scss-lint gem](https://github.com/brigade/scss-lint))
57
58
  * yaml (Check that your YAML is parsable)
58
59
  * json (Checks if JSON is parsable)
59
60
 
@@ -65,11 +66,11 @@ Use `pre-commit list` to see the list of default and enabled checks and warnings
65
66
 
66
67
  ### Git configuration
67
68
 
68
- git config pre-commit.checks "whitespace, jshint, debugger"
69
+ git config pre-commit.checks "[whitespace, jshint, debugger]"
69
70
 
70
71
  To disable, simply leave one off the list
71
72
 
72
- git config pre-commit.checks "whitespace, jshint"
73
+ git config pre-commit.checks "[whitespace, jshint]"
73
74
 
74
75
  ### CLI configuration
75
76
 
@@ -125,6 +126,6 @@ the list of git files to check with:
125
126
  1. `.gitignore` - git supported file shared beteen all checkouts
126
127
  2. `.git/info/exclude` - git supported file only for this checkout
127
128
  3. `.pre_commit.ignore` - `pre-commit` specific list can be shared,
128
- [Allowed filters](http://www.ruby-doc.org/core-2.1.3/File.html#method-c-fnmatch)
129
+ [Allowed filters](http://ruby-doc.org/core-2.1.3/File.html#method-c-fnmatch)
129
130
 
130
131
  ## [Contributing](CONTRIBUTING.md)
@@ -4,25 +4,13 @@ module PreCommit
4
4
  module Checks
5
5
  class Go < Plugin
6
6
 
7
- def call(staged_files)
8
- staged_files = staged_files.grep(/\.go$/)
9
- return if staged_files.empty?
10
-
11
- errors = staged_files.map { |file| run_check(file) }.compact
12
- return if errors.empty?
13
-
14
- errors.join("\n")
7
+ def self.includes
8
+ [:gobuild, :gofmt]
15
9
  end
16
10
 
17
- def run_check(file)
18
- cmd = "gofmt -l #{file} 2>&1"
19
- result = %x[ #{cmd} ]
20
- cmd = "go build -o /dev/null #{file} 2>&1"
21
- result << %x[ #{cmd} ]
22
- end
23
11
 
24
12
  def self.description
25
- "Detects bad Go formatting and compiler errors"
13
+ "Plugins for Go code"
26
14
  end
27
15
  end
28
16
  end
@@ -0,0 +1,27 @@
1
+ require 'pre-commit/checks/plugin'
2
+
3
+ module PreCommit
4
+ module Checks
5
+ class GoBuild < Plugin
6
+
7
+ def call(staged_files)
8
+ staged_files = staged_files.grep(/\.go$/)
9
+ return if staged_files.empty?
10
+
11
+ errors = staged_files.map { |file| run_check(file) }.compact
12
+ return if errors.empty?
13
+
14
+ errors.join("\n")
15
+ end
16
+
17
+ def run_check(file)
18
+ cmd = "go build -o /dev/null #{file} 2>&1"
19
+ %x[ #{cmd} ]
20
+ end
21
+
22
+ def self.description
23
+ "Detects Go compiler errors"
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,25 @@
1
+ module PreCommit
2
+ module Checks
3
+ class GoFmt < Plugin
4
+
5
+ def call(staged_files)
6
+ staged_files = staged_files.grep(/\.go$/)
7
+ return if staged_files.empty?
8
+
9
+ errors = staged_files.map { |file| run_check(file) }.compact
10
+ return if errors.empty?
11
+
12
+ errors.join("\n")
13
+ end
14
+
15
+ def run_check(file)
16
+ cmd = "gofmt -l #{file} 2>&1"
17
+ %x[ #{cmd} ]
18
+ end
19
+
20
+ def self.description
21
+ "Detects bad Go formatting"
22
+ end
23
+ end
24
+ end
25
+ end
@@ -9,7 +9,7 @@ module PreCommit
9
9
  end
10
10
 
11
11
  def pattern
12
- "binding\.pry"
12
+ "binding\.(remote_)?pry"
13
13
  end
14
14
 
15
15
  def self.description
@@ -5,10 +5,10 @@ module PreCommit
5
5
  module Checks
6
6
  class Rubocop < Plugin
7
7
 
8
- WHITELIST = [
9
- "\\.gemspec", "\\.jbuilder", "\\.opal", "\\.podspec", "\\.rake", "\\.rb",
10
- "Berksfile", "Capfile", "Cheffile", "Gemfile", "Guardfile", "Podfile",
11
- "Rakefile", "Thorfile", "Vagabondfile", "Vagrantfile"
8
+ WHITELIST = %w[
9
+ \.gemspec \.jbuilder \.opal \.podspec \.rake \.rb config\.ru
10
+ Berksfile Capfile Cheffile Gemfile Guardfile Podfile
11
+ Rakefile Thorfile Vagabondfile Vagrantfile
12
12
  ]
13
13
 
14
14
  def self.aliases
@@ -25,7 +25,7 @@ module PreCommit
25
25
  end
26
26
 
27
27
  def safe_load_file(file)
28
- YAML.safe_load(File.read(file), [], [], true, file)
28
+ YAML.safe_load(File.read(file), [::Symbol], [], true, file)
29
29
 
30
30
  nil
31
31
  rescue Psych::DisallowedClass
@@ -24,5 +24,4 @@ module PreCommit
24
24
  def self.runner
25
25
  @runner ||= PreCommit::Runner.new
26
26
  end
27
-
28
27
  end
@@ -2,6 +2,7 @@ require 'fileutils'
2
2
  require 'pre-commit/configuration'
3
3
  require 'pre-commit/installer'
4
4
  require 'pre-commit/list_evaluator'
5
+ require 'pre-commit/template'
5
6
 
6
7
  module PreCommit
7
8
 
@@ -15,7 +16,7 @@ module PreCommit
15
16
 
16
17
  def execute()
17
18
  action_name = @args.shift or 'help'
18
- action = "execute_#{action_name}".to_sym
19
+ action = :"execute_#{action_name}"
19
20
  if respond_to?(action)
20
21
  then send(action, *@args)
21
22
  else execute_help(action_name, *@args)
@@ -23,10 +24,11 @@ module PreCommit
23
24
  end
24
25
 
25
26
  def execute_help(*args)
26
- warn "Unknown parameters: #{args * " "}" unless args.empty?
27
+ warn "Unknown parameters: #{args.map(&:inspect) * " "}" unless args.empty?
27
28
  warn "Usage: pre-commit install"
28
29
  warn "Usage: pre-commit list"
29
30
  warn "Usage: pre-commit plugins"
31
+ warn "Usage: pre-commit new plugin-name 'Author Name' author@email 'description of the plugin'"
30
32
  warn "Usage: pre-commit <enable|disable> <git|yaml> <checks|warnings> check1 [check2...]"
31
33
  args.empty? # return status, it's ok if user requested help
32
34
  end
@@ -50,6 +52,13 @@ module PreCommit
50
52
  true
51
53
  end
52
54
 
55
+ def execute_new(*args)
56
+ PreCommit::Template.new(*args).save
57
+ rescue ArgumentError => e
58
+ warn e
59
+ warn "Usage: pre-commit new plugin-name 'Author Name' author@email 'description of the plugin'"
60
+ end
61
+
53
62
  def execute_enable(*args)
54
63
  config.enable(*args)
55
64
  rescue ArgumentError
@@ -0,0 +1,83 @@
1
+ require "date"
2
+ require "erb"
3
+ require "fileutils"
4
+
5
+ module PreCommit
6
+ class Template
7
+ TEMPLATE_DIR = File.expand_path("../../../templates/gem", __FILE__)
8
+
9
+ attr_reader :name, :author, :email, :description, :gem_name, :copyright
10
+
11
+ def initialize(*args)
12
+ @name, @author, @email, @description = args
13
+ @gem_name = "pre-commit-#{name}"
14
+ @copyright = "#{Date.today.year} #{author} #{email}"
15
+ validate_params
16
+ end
17
+
18
+ def save
19
+ puts "Generating #{gem_name}"
20
+ all_files.each{|file| parse_and_save(file) }
21
+ initialize_git
22
+ puts <<-STEPS
23
+
24
+ Next steps:
25
+ - write your checks and tests for them
26
+ - push code to github
27
+ - open a ticket to merge your project: https://github.com/jish/pre-commit/issues
28
+ STEPS
29
+ end
30
+
31
+ private
32
+
33
+ def validate_params
34
+ raise ArgumentError, "Missing name" if name.nil? || name.empty?
35
+ raise ArgumentError, "Missing author" if author.nil? || author.empty?
36
+ raise ArgumentError, "Missing email" if email.nil? || email.empty?
37
+ raise ArgumentError, "Missing description" if description.nil? || description.empty?
38
+ raise ArgumentError, "#{gem_name} already exists" if File.directory?(gem_name)
39
+ end
40
+
41
+ def all_files
42
+ Dir.glob("#{TEMPLATE_DIR}/**/*", File::FNM_DOTMATCH).reject{|path| File.directory?(path) }.sort
43
+ end
44
+
45
+ def parse_and_save(file)
46
+ save_file(
47
+ target_path(file),
48
+ parse_template(file),
49
+ )
50
+ end
51
+
52
+ def target_path(file)
53
+ ERB.new(
54
+ file.sub(TEMPLATE_DIR, gem_name)
55
+ ).result(
56
+ binding
57
+ )
58
+ end
59
+
60
+ def save_file(path, content)
61
+ FileUtils.mkdir_p(File.expand_path("..", path))
62
+ File.write(path, content, 0, mode: "w")
63
+ end
64
+
65
+ def parse_template(path)
66
+ ERB.new(
67
+ File.read(path)
68
+ ).result(
69
+ binding
70
+ )
71
+ end
72
+
73
+ def initialize_git
74
+ return if `which git 2>/dev/null`.empty?
75
+
76
+ Dir.chdir gem_name do
77
+ puts `git init`
78
+ puts `git add .`
79
+ puts `git commit -m "created #{gem_name}"`
80
+ end
81
+ end
82
+ end
83
+ end
@@ -0,0 +1,33 @@
1
+ =begin
2
+ Copyright <%= copyright %>
3
+
4
+ See the file LICENSE for copying permission.
5
+ =end
6
+
7
+ # -*- encoding: utf-8 -*-
8
+
9
+ lib = File.expand_path('../lib', __FILE__)
10
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
11
+ require 'pre-commit/<%= name %>/version'
12
+
13
+ Gem::Specification.new do |s|
14
+ s.name = "<%= gem_name %>"
15
+ s.version = PreCommit::<%= name.capitalize %>::VERSION
16
+ s.author = "<%= author %>"
17
+ s.email = "<%= email %>"
18
+ s.homepage = "https://github.com/pre-commit-plugins/<%= gem_name %>"
19
+ s.license = "MIT"
20
+ s.summary = "<%= description %>"
21
+
22
+ s.extra_rdoc_files = ["README.md"]
23
+ s.files = Dir["lib/**/*"]
24
+
25
+ s.add_dependency("pre-commit")
26
+
27
+ s.add_development_dependency("guard", "~> 2.0")
28
+ s.add_development_dependency("guard-minitest", "~> 2.0")
29
+ s.add_development_dependency("minitest", "~> 4.0")
30
+ s.add_development_dependency("minitest-reporters", "~> 0")
31
+ s.add_development_dependency("mocha", "~>1.1")
32
+ s.add_development_dependency("rake", "~> 10.0")
33
+ end
@@ -0,0 +1,16 @@
1
+ =begin
2
+ Copyright <%= copyright %>
3
+
4
+ See the file LICENSE for copying permission.
5
+ =end
6
+
7
+ source "https://rubygems.org"
8
+
9
+ gemspec
10
+
11
+ group :development do
12
+ # statistics only on MRI 2.0 - avoid problems on older rubies
13
+ gem "redcarpet", :platforms => [:mri_20]
14
+ gem "simplecov", :platforms => [:mri_20]
15
+ gem "coveralls", :platforms => [:mri_20]
16
+ end
@@ -0,0 +1,21 @@
1
+ The MIT License
2
+
3
+ Copyright (c) <%= copyright %>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,18 @@
1
+ [![Gem Version](https://badge.fury.io/rb/<%= gem_name %>.png)](https://rubygems.org/gems/<%= gem_name %>)
2
+ [![Build Status](https://secure.travis-ci.org/pre-commit-plugins/<%= gem_name %>.png?branch=master)](https://travis-ci.org/pre-commit-plugins/<%= gem_name %>)
3
+ [![Dependency Status](https://gemnasium.com/pre-commit-plugins/<%= gem_name %>.png)](https://gemnasium.com/pre-commit-plugins/<%= gem_name %>)
4
+ [![Code Climate](https://codeclimate.com/github/pre-commit-plugins/<%= gem_name %>.png)](https://codeclimate.com/github/pre-commit-plugins/<%= gem_name %>)
5
+ [![Coverage Status](https://img.shields.io/coveralls/pre-commit-plugins/<%= gem_name %>.svg)](https://coveralls.io/r/pre-commit-plugins/<%= gem_name %>?branch=master)
6
+ [![Inline docs](http://inch-ci.org/github/pre-commit-plugins/<%= gem_name %>.png)](http://inch-ci.org/github/pre-commit-plugins/<%= gem_name %>)
7
+ [![Yard Docs](http://img.shields.io/badge/yard-docs-blue.svg)](http://rubydoc.info/github/pre-commit-plugins/<%= gem_name %>/master/frames)
8
+ [![Github Code](http://img.shields.io/badge/github-code-blue.svg)](https://github.com/pre-commit-plugins/<%= gem_name %>)
9
+
10
+ # <%= name.capitalize %> for pre-commit gem
11
+
12
+ ### Installation
13
+
14
+ gem install <%= gem_name %>
15
+
16
+ ### Usage
17
+
18
+ pre-commit enable yaml checks <%= name %>
@@ -0,0 +1,20 @@
1
+ =begin
2
+ Copyright <%= copyright %>
3
+
4
+ See the file LICENSE for copying permission.
5
+ =end
6
+
7
+ require "rake/testtask"
8
+
9
+ Rake::TestTask.new do |test|
10
+ test.libs << "test" << "lib"
11
+ test.pattern = "test/**/*_test.rb"
12
+ test.verbose = true
13
+ end
14
+
15
+ namespace :pre_commit do
16
+ task :ci => [:test]
17
+ end
18
+
19
+ task :ci => [:test]
20
+ task :default => [:test]
@@ -0,0 +1,64 @@
1
+ =begin
2
+ Copyright <%= copyright %>
3
+
4
+ See the file LICENSE for copying permission.
5
+ =end
6
+
7
+ require 'pre-commit/error_list'
8
+ require 'pre-commit/checks/plugin'
9
+
10
+ # :nodoc:
11
+ module PreCommit
12
+ # :nodoc:
13
+ module Checks
14
+
15
+ #
16
+ # <%= description %>
17
+ #
18
+ class <%= name.capitalize %> < Plugin
19
+
20
+ #
21
+ # description of the plugin
22
+ #
23
+ def self.description
24
+ "<%= description %>"
25
+ end
26
+
27
+ #
28
+ # Finds files and verify them
29
+ #
30
+ # @param staged_files [Array<String>] list of files to check
31
+ #
32
+ # @return [nil|Array<PreCommit::ErrorList>] nil when no errors,
33
+ # list of errors otherwise
34
+ def call(staged_files)
35
+ errors = staged_files.map { |file| run_check(file) }.compact
36
+ return if errors.empty?
37
+
38
+ errors
39
+ end
40
+
41
+ private
42
+
43
+ #
44
+ # <%= description %>
45
+ #
46
+ # @param file [String] path to file to verify
47
+ #
48
+ # @return [nil|PreCommit::ErrorList] nil when file verified,
49
+ # ErrorList when verification failed
50
+ #
51
+ def run_check(file)
52
+ if
53
+ true # add a check here to verify files
54
+ then
55
+ nil
56
+ else
57
+ PreCommit::ErrorList.new(PreCommit::Line.new("Describe why verification failed", file))
58
+ end
59
+ end
60
+
61
+ end
62
+
63
+ end
64
+ end
@@ -0,0 +1,14 @@
1
+ =begin
2
+ Copyright <%= copyright %>
3
+
4
+ See the file LICENSE for copying permission.
5
+ =end
6
+
7
+ # :nodoc:
8
+ module PreCommit
9
+ # placeholder for gem VERSION
10
+ module <%= name.capitalize %>
11
+ # the gem version, rules of versioning: http://semver.org/
12
+ VERSION = "1.0.0"
13
+ end
14
+ end
@@ -0,0 +1,44 @@
1
+ =begin
2
+ Copyright <%= copyright %>
3
+
4
+ See the file LICENSE for copying permission.
5
+ =end
6
+
7
+ if
8
+ RUBY_VERSION == "2.0.0" # check Gemfile
9
+ then
10
+ require "coveralls"
11
+ require "simplecov"
12
+
13
+ SimpleCov.start do
14
+ formatter SimpleCov::Formatter::MultiFormatter[
15
+ SimpleCov::Formatter::HTMLFormatter,
16
+ Coveralls::SimpleCov::Formatter,
17
+ ]
18
+ command_name "Spesc Tests"
19
+ add_filter "/test/"
20
+ end
21
+
22
+ Coveralls.noisy = true unless ENV['CI']
23
+ end
24
+
25
+ require 'minitest/autorun'
26
+ require "minitest/reporters"
27
+ require "mocha/setup"
28
+ require 'pluginator'
29
+
30
+ module PreCommit; module Helpers
31
+
32
+ def test_files
33
+ File.expand_path("../files", __FILE__)
34
+ end
35
+
36
+ end; end
37
+
38
+ class MiniTest::Unit::TestCase
39
+ include PreCommit::Helpers
40
+ end
41
+
42
+ Dir['lib/**/*.rb'].each { |file| require "./#{file}" } # coverals trick for all files
43
+
44
+ Minitest::Reporters.use!
@@ -0,0 +1,24 @@
1
+ =begin
2
+ Copyright <%= copyright %>
3
+
4
+ See the file LICENSE for copying permission.
5
+ =end
6
+
7
+ require 'minitest_helper'
8
+ require 'plugins/pre_commit/checks/<%= name %>'
9
+
10
+ describe PreCommit::Checks::<%= name.capitalize %> do
11
+ let(:check){ PreCommit::Checks::<%= name.capitalize %>.new(nil, nil, []) }
12
+
13
+ it "does nothing" do
14
+ check.send(:run_check, "rake").must_equal(nil)
15
+ end
16
+
17
+ it "checks files" do
18
+ Dir.chdir(test_files) do
19
+ # TODO: create example files in test/files
20
+ check.send(:run_check, ".keep").must_equal(nil)
21
+ end
22
+ end
23
+
24
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pre-commit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.26.0
4
+ version: 0.27.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shajith Chacko, Josh Lubaway
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-14 00:00:00.000000000 Z
11
+ date: 2016-02-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pluginator
@@ -121,7 +121,6 @@ files:
121
121
  - lib/plugins/pluginator/extensions/find_check.rb
122
122
  - lib/plugins/pre_commit/checks/before_all.rb
123
123
  - lib/plugins/pre_commit/checks/ci.rb
124
- - lib/plugins/pre_commit/checks/closure.rb
125
124
  - lib/plugins/pre_commit/checks/coffeelint.rb
126
125
  - lib/plugins/pre_commit/checks/common.rb
127
126
  - lib/plugins/pre_commit/checks/console_log.rb
@@ -129,6 +128,8 @@ files:
129
128
  - lib/plugins/pre_commit/checks/debugger.rb
130
129
  - lib/plugins/pre_commit/checks/gemfile_path.rb
131
130
  - lib/plugins/pre_commit/checks/go.rb
131
+ - lib/plugins/pre_commit/checks/go_build.rb
132
+ - lib/plugins/pre_commit/checks/go_fmt.rb
132
133
  - lib/plugins/pre_commit/checks/jshint.rb
133
134
  - lib/plugins/pre_commit/checks/jslint.rb
134
135
  - lib/plugins/pre_commit/checks/json.rb
@@ -170,12 +171,21 @@ files:
170
171
  - lib/pre-commit/message.rb
171
172
  - lib/pre-commit/plugins_list.rb
172
173
  - lib/pre-commit/runner.rb
173
- - lib/pre-commit/support/closure/compiler.jar
174
174
  - lib/pre-commit/support/csslint/csslint.js
175
175
  - lib/pre-commit/support/jshint/jshint.js
176
176
  - lib/pre-commit/support/jslint/lint.js
177
+ - lib/pre-commit/template.rb
177
178
  - lib/pre-commit/utils/git_conversions.rb
178
179
  - lib/pre-commit/utils/staged_files.rb
180
+ - templates/gem/<%= gem_name %>.gemspec
181
+ - templates/gem/Gemfile
182
+ - templates/gem/LICENSE
183
+ - templates/gem/README.md
184
+ - templates/gem/Rakefile
185
+ - templates/gem/lib/plugins/pre_commit/checks/<%= name %>.rb
186
+ - templates/gem/lib/pre-commit/<%= name %>/version.rb
187
+ - templates/gem/test/minitest_helper.rb
188
+ - templates/gem/test/plugins/pre_commit/checks/<%= name %>_test.rb
179
189
  - templates/hooks/automatic
180
190
  - templates/hooks/default
181
191
  - templates/hooks/manual
@@ -201,7 +211,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
201
211
  version: '0'
202
212
  requirements: []
203
213
  rubyforge_project:
204
- rubygems_version: 2.2.3
214
+ rubygems_version: 2.4.5.1
205
215
  signing_key:
206
216
  specification_version: 3
207
217
  summary: A slightly better git pre-commit hook
@@ -1,27 +0,0 @@
1
- require 'pre-commit/checks/plugin'
2
-
3
- module PreCommit
4
- module Checks
5
- class Closure < Plugin
6
- #TODO: add pluginator assets support
7
- CLOSURE_PATH = File.expand_path("../../../../pre-commit/support/closure/compiler.jar", __FILE__)
8
-
9
- def self.aliases
10
- [:closure_syntax_check]
11
- end
12
-
13
- def call(staged_files)
14
- return if staged_files.empty?
15
- js_args = staged_files.map {|arg| "--js #{arg}"}.join(' ')
16
- errors = `java -jar #{CLOSURE_PATH} #{js_args} --js_output_file /tmp/jammit.js 2>&1`.strip
17
- return if errors.empty?
18
- errors
19
- end
20
-
21
- def self.description
22
- "Runs closure compiler to detect errors"
23
- end
24
-
25
- end
26
- end
27
- end