overcommit 0.1.2 → 0.1.3

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: e133359ae61ef154b91a8194178ee5a89af7c5da
4
- data.tar.gz: 6c9f6191fea07ac695999e4ea0a7ff48b1858010
3
+ metadata.gz: f8d7eb3f46bb777b61a7691c1eef669daf7993b5
4
+ data.tar.gz: cf0dc9b2c995254856a82ddf449d271a1d886d8c
5
5
  SHA512:
6
- metadata.gz: 426352f6c848e421e356761aff3d729c264f1dea63b6e411061eaed03f698eae30cad5fc9716765386dd32324c756ecf9d460cfa3030ad110d217e566f98ab4d
7
- data.tar.gz: 099133f6f3f22074fea07a299ba94e73bef8e5a8cf2052656b10df81833d22f770282bc2e9931bb02ad5b92725348f3cd38fbfee711fc1e3e7143b41c105f94f
6
+ metadata.gz: f0fa19bb49c780b3d0a89d3488458339ed81bd20a2d26dc1e9a85f8f26dd3e6c315a75c3e9e1eafd627f09725062450b8a5da0b29ab07e6567b78bd1772a54aa
7
+ data.tar.gz: ffbbb87fadc8db06a91fbf052954a13e7d68063935225ff6480b834599ef3a70945f80903dbf6a5d7756170eb559db0c74d296b13c9502380b209dfdaade2add
@@ -22,16 +22,12 @@ module Overcommit
22
22
  # Given the current configuration, return a set of paths which should be
23
23
  # loaded as plugins (`require`d)
24
24
  def desired_plugins
25
- excludes = repo_settings['excludes']
26
- skip_checks = ENV.fetch('SKIP_CHECKS', '').split(/[:, ]/)
27
-
28
- return [] if skip_checks.include? 'all'
25
+ excludes = repo_settings['excludes']
29
26
 
30
27
  plugin_directories.map do |dir|
31
28
  Dir[File.join(dir, Utils.hook_name, '*.rb')].map do |plugin|
32
29
  basename = File.basename(plugin, '.rb')
33
- if !skip_checks.include?(basename) &&
34
- !(excludes[Utils.hook_name] || []).include?(basename)
30
+ if !(excludes[Utils.hook_name] || []).include?(basename)
35
31
  plugin
36
32
  end
37
33
  end.compact
@@ -15,7 +15,7 @@ module Overcommit
15
15
  def run(*args)
16
16
  # Support 'bare' installation where we don't have any hooks yet.
17
17
  # Silently pass.
18
- exit unless (checks = HookRegistry.checks) && checks.any?
18
+ exit unless (checks = registered_checks) && checks.any?
19
19
 
20
20
  exit if requires_modified_files? && Utils.modified_files.empty?
21
21
 
@@ -41,6 +41,23 @@ module Overcommit
41
41
 
42
42
  private
43
43
 
44
+ # Return all loaded plugins, skipping those that are skippable and have
45
+ # been asked to be skipped by the environment variable SKIP_CHECKS.
46
+ #
47
+ # Note that required checks are not skipped even if
48
+ # `ENV['SKIP_CHECKS'] == 'all'`
49
+ def registered_checks
50
+ @registered_checks ||= begin
51
+ skip_checks = ENV.fetch('SKIP_CHECKS', '').split(/[:, ]/)
52
+ skip_all = skip_checks.include? 'all'
53
+ HookRegistry.checks.reject do |check|
54
+ hook_name = Utils.underscorize check.name
55
+
56
+ check.skippable? && (skip_all || skip_checks.include?(hook_name))
57
+ end
58
+ end
59
+ end
60
+
44
61
  # If true, only run this check when there are modified files.
45
62
  def requires_modified_files?
46
63
  false
@@ -4,6 +4,7 @@ module Overcommit
4
4
  @checks = []
5
5
  class << self
6
6
  attr_reader :checks
7
+
7
8
  def included(base)
8
9
  @checks << base
9
10
  end
@@ -12,12 +13,21 @@ module Overcommit
12
13
 
13
14
  class HookSpecificCheck
14
15
  class << self
15
- attr_accessor :filetype
16
- attr_accessor :stealth
16
+ attr_accessor :filetype, :stealth, :required
17
17
 
18
18
  def stealth!
19
19
  self.stealth = true
20
20
  end
21
+
22
+ def required!
23
+ self.required = true
24
+ end
25
+
26
+ # Can the check be skipped by environment variables? This can always be
27
+ # overriden with `--no-verify`.
28
+ def skippable?
29
+ !required
30
+ end
21
31
  end
22
32
 
23
33
  def initialize(*args)
@@ -3,6 +3,7 @@ module Overcommit::GitHook
3
3
  include HookRegistry
4
4
 
5
5
  stealth! # Not really a 'check', but we need it to run
6
+ required! # Not skipped when ENV['SKIP_CHECKS'] == 'all'
6
7
 
7
8
  SCRIPT_LOCATION = Overcommit::Utils.script_path 'gerrit-change-id'
8
9
 
@@ -1,3 +1,3 @@
1
1
  module Overcommit
2
- VERSION = '0.1.2'
2
+ VERSION = '0.1.3'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: overcommit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Causes Engineering
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-05-24 00:00:00.000000000 Z
11
+ date: 2013-05-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -31,49 +31,49 @@ executables:
31
31
  extensions: []
32
32
  extra_rdoc_files: []
33
33
  files:
34
- - lib/overcommit.rb
35
- - lib/overcommit/utils.rb
36
- - lib/overcommit/errors.rb
34
+ - lib/overcommit/cli.rb
35
+ - lib/overcommit/configuration.rb
37
36
  - lib/overcommit/console_methods.rb
38
- - lib/overcommit/plugins/pre_commit/scss_lint.rb
37
+ - lib/overcommit/errors.rb
38
+ - lib/overcommit/git_hook.rb
39
+ - lib/overcommit/hook_specific_check.rb
40
+ - lib/overcommit/hooks/commit_msg.rb
41
+ - lib/overcommit/hooks/pre_commit.rb
42
+ - lib/overcommit/installer.rb
43
+ - lib/overcommit/plugins/commit_msg/change_id.rb
44
+ - lib/overcommit/plugins/commit_msg/release_note.rb
45
+ - lib/overcommit/plugins/commit_msg/russian_novel.rb
46
+ - lib/overcommit/plugins/commit_msg/text_width.rb
47
+ - lib/overcommit/plugins/commit_msg/trailing_period.rb
48
+ - lib/overcommit/plugins/pre_commit/author_name.rb
39
49
  - lib/overcommit/plugins/pre_commit/causes_email.rb
40
- - lib/overcommit/plugins/pre_commit/ruby_syntax.rb
50
+ - lib/overcommit/plugins/pre_commit/css_linter.rb
51
+ - lib/overcommit/plugins/pre_commit/erb_syntax.rb
41
52
  - lib/overcommit/plugins/pre_commit/haml_syntax.rb
42
- - lib/overcommit/plugins/pre_commit/test_history.rb
43
- - lib/overcommit/plugins/pre_commit/yaml_syntax.rb
44
- - lib/overcommit/plugins/pre_commit/restricted_paths.rb
45
53
  - lib/overcommit/plugins/pre_commit/js_console_log.rb
46
54
  - lib/overcommit/plugins/pre_commit/js_syntax.rb
47
- - lib/overcommit/plugins/pre_commit/author_name.rb
55
+ - lib/overcommit/plugins/pre_commit/restricted_paths.rb
56
+ - lib/overcommit/plugins/pre_commit/ruby_syntax.rb
57
+ - lib/overcommit/plugins/pre_commit/scss_lint.rb
58
+ - lib/overcommit/plugins/pre_commit/test_history.rb
48
59
  - lib/overcommit/plugins/pre_commit/whitespace.rb
49
- - lib/overcommit/plugins/pre_commit/css_linter.rb
50
- - lib/overcommit/plugins/pre_commit/erb_syntax.rb
51
- - lib/overcommit/plugins/commit_msg/text_width.rb
52
- - lib/overcommit/plugins/commit_msg/trailing_period.rb
53
- - lib/overcommit/plugins/commit_msg/release_note.rb
54
- - lib/overcommit/plugins/commit_msg/russian_novel.rb
55
- - lib/overcommit/plugins/commit_msg/change_id.rb
60
+ - lib/overcommit/plugins/pre_commit/yaml_syntax.rb
56
61
  - lib/overcommit/reporter.rb
57
- - lib/overcommit/git_hook.rb
58
- - lib/overcommit/hook_specific_check.rb
59
- - lib/overcommit/hooks/commit_msg.rb
60
- - lib/overcommit/hooks/pre_commit.rb
61
- - lib/overcommit/configuration.rb
62
- - lib/overcommit/installer.rb
63
- - lib/overcommit/cli.rb
62
+ - lib/overcommit/utils.rb
64
63
  - lib/overcommit/version.rb
65
- - bin/scripts/jshint.js
66
- - bin/scripts/gerrit-change-id
67
- - bin/scripts/jshint_runner.js
68
- - bin/scripts/index-tags
69
- - bin/scripts/csslint-rhino.js
70
- - bin/hooks/pre-commit
64
+ - lib/overcommit.rb
71
65
  - bin/hooks/commit-msg
72
- - bin/hooks/prepare-commit-msg
73
66
  - bin/hooks/post-checkout
74
67
  - bin/hooks/post-merge
68
+ - bin/hooks/pre-commit
69
+ - bin/hooks/prepare-commit-msg
75
70
  - bin/overcommit
76
71
  - bin/run-hook
72
+ - bin/scripts/csslint-rhino.js
73
+ - bin/scripts/gerrit-change-id
74
+ - bin/scripts/index-tags
75
+ - bin/scripts/jshint.js
76
+ - bin/scripts/jshint_runner.js
77
77
  - config/templates.yml
78
78
  homepage: http://github.com/causes/overcommit
79
79
  licenses:
@@ -100,4 +100,3 @@ signing_key:
100
100
  specification_version: 4
101
101
  summary: Opinionated Git hook manager
102
102
  test_files: []
103
- has_rdoc: