overcommit 0.6.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/overcommit/configuration.rb +24 -9
- data/lib/overcommit/hook_context.rb +2 -1
- data/lib/overcommit/hook_runner.rb +1 -1
- data/lib/overcommit/version.rb +2 -1
- data/template-dir/hooks/commit-msg +2 -7
- data/template-dir/hooks/overcommit-hook +2 -7
- data/template-dir/hooks/post-checkout +2 -7
- data/template-dir/hooks/pre-commit +2 -7
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c3cf160d0c937fd468fe3b7324ab79f9c567c2d
|
4
|
+
data.tar.gz: 9e149912787db4bf6e259e7517f688fce95f14c6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 16a6eaf4ea1ce8f03bcdfd7bf7b331c2e5a8b2c6c2c896aa10bbae88864a588741806325aa1a4a60c29a3021ef41db7d1a0573bb9c5fa9f76db10e05bea349a8
|
7
|
+
data.tar.gz: acf3efe320ede57d9d933f47b187e61c03a5e35646884da3f3fcfbc1f932dc3079d992b6016ba15128af301e27dd379c6aeae5f98829abd119f895902420eb88
|
@@ -19,10 +19,11 @@ module Overcommit
|
|
19
19
|
end
|
20
20
|
|
21
21
|
# Returns the built-in hooks that have been enabled for a hook type.
|
22
|
-
def enabled_builtin_hooks(
|
23
|
-
@hash[
|
22
|
+
def enabled_builtin_hooks(hook_context)
|
23
|
+
@hash[hook_context.hook_class_name].keys.
|
24
24
|
select { |hook_name| hook_name != 'ALL' }.
|
25
|
-
select { |hook_name|
|
25
|
+
select { |hook_name| built_in_hook?(hook_context, hook_name) }.
|
26
|
+
select { |hook_name| hook_enabled?(hook_context, hook_name) }
|
26
27
|
end
|
27
28
|
|
28
29
|
# Returns a non-modifiable configuration for a hook.
|
@@ -46,13 +47,14 @@ module Overcommit
|
|
46
47
|
|
47
48
|
# Applies additional configuration settings based on the provided
|
48
49
|
# environment variables.
|
49
|
-
def apply_environment!(
|
50
|
+
def apply_environment!(hook_context, env)
|
50
51
|
skipped_hooks = "#{env['SKIP']} #{env['SKIP_CHECKS']} #{env['SKIP_HOOKS']}".split(/[:, ]/)
|
52
|
+
hook_type = hook_context.hook_class_name
|
51
53
|
|
52
54
|
if skipped_hooks.include?('all') || skipped_hooks.include?('ALL')
|
53
55
|
@hash[hook_type]['ALL']['skip'] = true
|
54
56
|
else
|
55
|
-
skipped_hooks.select { |hook_name| hook_exists?(
|
57
|
+
skipped_hooks.select { |hook_name| hook_exists?(hook_context, hook_name) }.
|
56
58
|
map { |hook_name| Overcommit::Utils.camel_case(hook_name) }.
|
57
59
|
each do |hook_name|
|
58
60
|
@hash[hook_type][hook_name] ||= {}
|
@@ -67,15 +69,28 @@ module Overcommit
|
|
67
69
|
|
68
70
|
private
|
69
71
|
|
70
|
-
def
|
72
|
+
def built_in_hook?(hook_context, hook_name)
|
71
73
|
hook_name = Overcommit::Utils.snake_case(hook_name)
|
72
|
-
underscored_hook_type = Overcommit::Utils.snake_case(hook_type)
|
73
74
|
|
74
75
|
File.exist?(File.join(OVERCOMMIT_HOME, 'lib', 'overcommit', 'hook',
|
75
|
-
|
76
|
+
hook_context.hook_type_name, "#{hook_name}.rb"))
|
76
77
|
end
|
77
78
|
|
78
|
-
def
|
79
|
+
def plugin_hook?(hook_context, hook_name)
|
80
|
+
hook_name = Overcommit::Utils.snake_case(hook_name)
|
81
|
+
|
82
|
+
File.exist?(File.join(plugin_directory,
|
83
|
+
hook_context.hook_type_name,
|
84
|
+
"#{hook_name}.rb"))
|
85
|
+
end
|
86
|
+
|
87
|
+
def hook_exists?(hook_context, hook_name)
|
88
|
+
built_in_hook?(hook_context, hook_name) ||
|
89
|
+
plugin_hook?(hook_context, hook_name)
|
90
|
+
end
|
91
|
+
|
92
|
+
def hook_enabled?(hook_context, hook_name)
|
93
|
+
hook_type = hook_context.hook_class_name
|
79
94
|
individual_enabled = @hash[hook_type][hook_name]['enabled']
|
80
95
|
return individual_enabled unless individual_enabled.nil?
|
81
96
|
|
@@ -1,11 +1,12 @@
|
|
1
1
|
# Utility module which manages the creation of {HookContext}s.
|
2
2
|
module Overcommit::HookContext
|
3
3
|
def self.create(hook_type, config, args, input)
|
4
|
+
hook_type_class = Overcommit::Utils.camel_case(hook_type)
|
4
5
|
underscored_hook_type = Overcommit::Utils.snake_case(hook_type)
|
5
6
|
|
6
7
|
require "overcommit/hook_context/#{underscored_hook_type}"
|
7
8
|
|
8
|
-
Overcommit::HookContext.const_get(
|
9
|
+
Overcommit::HookContext.const_get(hook_type_class).new(config, args, input)
|
9
10
|
rescue LoadError, NameError => error
|
10
11
|
# Could happen when a symlink was created for a hook type Overcommit does
|
11
12
|
# not yet support.
|
@@ -116,7 +116,7 @@ module Overcommit
|
|
116
116
|
# Load hooks that ship with Overcommit, ignoring ones that are excluded from
|
117
117
|
# the repository's configuration.
|
118
118
|
def load_builtin_hooks
|
119
|
-
@config.enabled_builtin_hooks(@context
|
119
|
+
@config.enabled_builtin_hooks(@context).each do |hook_name|
|
120
120
|
underscored_hook_name = Overcommit::Utils.snake_case(hook_name)
|
121
121
|
require "overcommit/hook/#{@context.hook_type_name}/#{underscored_hook_name}"
|
122
122
|
@hooks << create_hook(hook_name)
|
data/lib/overcommit/version.rb
CHANGED
@@ -49,16 +49,11 @@ if Gem::Version.new(Overcommit::VERSION) < Gem::Version.new('0.6.0')
|
|
49
49
|
end
|
50
50
|
|
51
51
|
begin
|
52
|
-
hook_type_class = Overcommit::Utils.camel_case(hook_type)
|
53
|
-
|
54
52
|
config = Overcommit::ConfigurationLoader.load_repo_config
|
55
|
-
config.apply_environment!(hook_type_class, ENV)
|
56
53
|
|
57
|
-
|
58
|
-
|
59
|
-
run(Overcommit::Utils.repo_root, :action => :install)
|
54
|
+
context = Overcommit::HookContext.create(hook_type, config, ARGV, STDIN)
|
55
|
+
config.apply_environment!(context, ENV)
|
60
56
|
|
61
|
-
context = Overcommit::HookContext.create(hook_type_class, config, ARGV, STDIN)
|
62
57
|
logger = Overcommit::Logger.new(STDOUT)
|
63
58
|
runner = Overcommit::HookRunner.new(config, logger, context)
|
64
59
|
|
@@ -49,16 +49,11 @@ if Gem::Version.new(Overcommit::VERSION) < Gem::Version.new('0.6.0')
|
|
49
49
|
end
|
50
50
|
|
51
51
|
begin
|
52
|
-
hook_type_class = Overcommit::Utils.camel_case(hook_type)
|
53
|
-
|
54
52
|
config = Overcommit::ConfigurationLoader.load_repo_config
|
55
|
-
config.apply_environment!(hook_type_class, ENV)
|
56
53
|
|
57
|
-
|
58
|
-
|
59
|
-
run(Overcommit::Utils.repo_root, :action => :install)
|
54
|
+
context = Overcommit::HookContext.create(hook_type, config, ARGV, STDIN)
|
55
|
+
config.apply_environment!(context, ENV)
|
60
56
|
|
61
|
-
context = Overcommit::HookContext.create(hook_type_class, config, ARGV, STDIN)
|
62
57
|
logger = Overcommit::Logger.new(STDOUT)
|
63
58
|
runner = Overcommit::HookRunner.new(config, logger, context)
|
64
59
|
|
@@ -49,16 +49,11 @@ if Gem::Version.new(Overcommit::VERSION) < Gem::Version.new('0.6.0')
|
|
49
49
|
end
|
50
50
|
|
51
51
|
begin
|
52
|
-
hook_type_class = Overcommit::Utils.camel_case(hook_type)
|
53
|
-
|
54
52
|
config = Overcommit::ConfigurationLoader.load_repo_config
|
55
|
-
config.apply_environment!(hook_type_class, ENV)
|
56
53
|
|
57
|
-
|
58
|
-
|
59
|
-
run(Overcommit::Utils.repo_root, :action => :install)
|
54
|
+
context = Overcommit::HookContext.create(hook_type, config, ARGV, STDIN)
|
55
|
+
config.apply_environment!(context, ENV)
|
60
56
|
|
61
|
-
context = Overcommit::HookContext.create(hook_type_class, config, ARGV, STDIN)
|
62
57
|
logger = Overcommit::Logger.new(STDOUT)
|
63
58
|
runner = Overcommit::HookRunner.new(config, logger, context)
|
64
59
|
|
@@ -49,16 +49,11 @@ if Gem::Version.new(Overcommit::VERSION) < Gem::Version.new('0.6.0')
|
|
49
49
|
end
|
50
50
|
|
51
51
|
begin
|
52
|
-
hook_type_class = Overcommit::Utils.camel_case(hook_type)
|
53
|
-
|
54
52
|
config = Overcommit::ConfigurationLoader.load_repo_config
|
55
|
-
config.apply_environment!(hook_type_class, ENV)
|
56
53
|
|
57
|
-
|
58
|
-
|
59
|
-
run(Overcommit::Utils.repo_root, :action => :install)
|
54
|
+
context = Overcommit::HookContext.create(hook_type, config, ARGV, STDIN)
|
55
|
+
config.apply_environment!(context, ENV)
|
60
56
|
|
61
|
-
context = Overcommit::HookContext.create(hook_type_class, config, ARGV, STDIN)
|
62
57
|
logger = Overcommit::Logger.new(STDOUT)
|
63
58
|
runner = Overcommit::HookRunner.new(config, logger, context)
|
64
59
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: overcommit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Causes Engineering
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-02-
|
12
|
+
date: 2014-02-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: wopen3
|