rabbitt-githooks 1.3.2 → 1.4.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/CONTRIBUTORS.txt +2 -0
- data/Gemfile.lock +3 -3
- data/bin/githooks +2 -4
- data/bin/githooks-runner +9 -13
- data/lib/githooks/action.rb +21 -10
- data/lib/githooks/{commands → cli}/config.rb +4 -4
- data/lib/githooks/cli.rb +18 -9
- data/lib/githooks/core_ext/array/extract_options.rb +18 -0
- data/lib/githooks/core_ext/array/select_with_index.rb +18 -0
- data/lib/githooks/core_ext/array.rb +18 -0
- data/lib/githooks/core_ext/numbers.rb +18 -0
- data/lib/githooks/core_ext/object.rb +18 -0
- data/lib/githooks/core_ext/ostruct.rb +44 -0
- data/lib/githooks/core_ext/pathname.rb +28 -0
- data/lib/githooks/core_ext/rainbow.rb +40 -0
- data/lib/githooks/core_ext/string/git_option_path_split.rb +18 -0
- data/lib/githooks/core_ext/string/inflections.rb +18 -0
- data/lib/githooks/core_ext/string/sanitize.rb +18 -0
- data/lib/githooks/core_ext/string.rb +18 -0
- data/lib/githooks/core_ext.rb +2 -1
- data/lib/githooks/hook.rb +36 -13
- data/lib/githooks/repository/config.rb +1 -1
- data/lib/githooks/repository/diff_index_entry.rb +2 -2
- data/lib/githooks/repository.rb +10 -5
- data/lib/githooks/runner.rb +100 -94
- data/lib/githooks/section.rb +34 -8
- data/lib/githooks/system_utils.rb +36 -19
- data/lib/githooks/version.rb +1 -1
- data/lib/githooks.rb +5 -6
- data/rabbitt-githooks.gemspec +34 -33
- metadata +10 -8
- data/lib/githooks/core_ext/colorize.rb +0 -30
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4f5a527f752152557546b7e9b09af917a80d2ac5
|
4
|
+
data.tar.gz: 83fde6252879d9215bab34d6d35f8269b471c43c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cb9e232c8acb6960027b60d9802e77b4242755440cec278a24f137dff0b9f77508aabf003ca222da849600fb05db8bf80408b3e4f820f7bc9a9de20445213521
|
7
|
+
data.tar.gz: 4fbbcb4f21183799a1daddbed62c1a2b63bafd1d3fff591d18a168b5e8bba71d83852aedadf4d57685a236bade4569566d09db146a672a717b7e157709671aa3
|
data/CONTRIBUTORS.txt
ADDED
data/Gemfile.lock
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rabbitt-githooks (1.
|
5
|
-
|
4
|
+
rabbitt-githooks (1.4.1)
|
5
|
+
rainbow (~> 2.0.0)
|
6
6
|
thor (~> 0.18)
|
7
7
|
|
8
8
|
GEM
|
@@ -11,7 +11,6 @@ GEM
|
|
11
11
|
ast (2.0.0)
|
12
12
|
astrolabe (1.3.0)
|
13
13
|
parser (>= 2.2.0.pre.3, < 3.0)
|
14
|
-
colorize (0.7.5)
|
15
14
|
diff-lcs (1.2.5)
|
16
15
|
docile (1.1.5)
|
17
16
|
multi_json (1.10.1)
|
@@ -48,6 +47,7 @@ GEM
|
|
48
47
|
yard (0.8.7.6)
|
49
48
|
|
50
49
|
PLATFORMS
|
50
|
+
java
|
51
51
|
ruby
|
52
52
|
|
53
53
|
DEPENDENCIES
|
data/bin/githooks
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
if ENV
|
4
|
-
|
5
|
-
$:.unshift Pathname.new(__FILE__).dirname.parent.join('lib').realpath.to_s
|
3
|
+
if ENV.include? 'GITHOOKS_DEV'
|
4
|
+
$:.unshift File.expand_path('../../lib', __FILE__)
|
6
5
|
end
|
7
6
|
require 'githooks'
|
8
7
|
|
@@ -12,5 +11,4 @@ rescue GitHooks::Error => e
|
|
12
11
|
puts e.message
|
13
12
|
exit 1
|
14
13
|
end
|
15
|
-
|
16
14
|
exit 0
|
data/bin/githooks-runner
CHANGED
@@ -1,26 +1,22 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# rubocop:disable FileName
|
3
3
|
|
4
|
-
if ENV
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
else
|
11
|
-
path.parent
|
12
|
-
end.join('lib').realpath.to_s
|
13
|
-
)
|
4
|
+
if ENV.include? 'GITHOOKS_DEV'
|
5
|
+
if __FILE__.include? '.git/hooks'
|
6
|
+
$:.unshift File.expand_path('../../../lib', __FILE__)
|
7
|
+
else
|
8
|
+
$:.unshift File.expand_path('../../lib', __FILE__)
|
9
|
+
end
|
14
10
|
end
|
15
11
|
require 'githooks'
|
16
12
|
|
17
13
|
begin
|
18
|
-
GitHooks::Runner.
|
14
|
+
result = GitHooks::Runner.new(
|
19
15
|
'args' => ARGV,
|
20
16
|
'hook' => ENV['GITHOOKS_HOOK']
|
21
|
-
)
|
17
|
+
).run
|
22
18
|
rescue GitHooks::Error => e
|
23
19
|
puts e.message
|
24
20
|
exit 1
|
25
21
|
end
|
26
|
-
exit
|
22
|
+
exit result.to_i
|
data/lib/githooks/action.rb
CHANGED
@@ -19,7 +19,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|
19
19
|
|
20
20
|
require 'set'
|
21
21
|
require 'stringio'
|
22
|
-
require 'colorize'
|
23
22
|
require_relative 'repository'
|
24
23
|
|
25
24
|
module GitHooks
|
@@ -35,7 +34,7 @@ module GitHooks
|
|
35
34
|
@title = title
|
36
35
|
@section = section
|
37
36
|
@on = nil
|
38
|
-
@limiters =
|
37
|
+
@limiters = section.limiters
|
39
38
|
@success = true
|
40
39
|
@errors = []
|
41
40
|
@warnings = []
|
@@ -118,8 +117,7 @@ module GitHooks
|
|
118
117
|
end
|
119
118
|
|
120
119
|
def respond_to_missing?(method, include_private = false)
|
121
|
-
|
122
|
-
true
|
120
|
+
section.hook.find_command(method) || super
|
123
121
|
end
|
124
122
|
|
125
123
|
def method_missing(method, *args, &block)
|
@@ -130,10 +128,27 @@ module GitHooks
|
|
130
128
|
|
131
129
|
# DSL Methods
|
132
130
|
|
131
|
+
def config_path
|
132
|
+
GitHooks.hooks_root.join('configs')
|
133
|
+
end
|
134
|
+
|
135
|
+
def config_file(*path_components)
|
136
|
+
config_path.join(*path_components)
|
137
|
+
end
|
138
|
+
|
139
|
+
def lib_path
|
140
|
+
GitHooks.hooks_root.join('lib')
|
141
|
+
end
|
142
|
+
|
143
|
+
def lib_file(*path_components)
|
144
|
+
lib_path.join(*path_components)
|
145
|
+
end
|
146
|
+
|
133
147
|
def limit(type)
|
134
|
-
|
135
|
-
@limiters
|
148
|
+
unless @limiters.include? type
|
149
|
+
@limiters[type] ||= Repository::Limiter.new(type)
|
136
150
|
end
|
151
|
+
@limiters[type]
|
137
152
|
end
|
138
153
|
|
139
154
|
def on_each_file(&block)
|
@@ -154,10 +169,6 @@ module GitHooks
|
|
154
169
|
|
155
170
|
private
|
156
171
|
|
157
|
-
def find_limiter(type)
|
158
|
-
@limiters.select { |l| l.type == type }.first
|
159
|
-
end
|
160
|
-
|
161
172
|
def run_command(command, *args, &block)
|
162
173
|
prefix = nil
|
163
174
|
args.extract_options.tap { |options|
|
@@ -30,7 +30,7 @@ module GitHooks
|
|
30
30
|
|
31
31
|
GitHooks.verbose = !!options['verbose']
|
32
32
|
GitHooks.debug = !!options['debug']
|
33
|
-
options['repo'] ||= GitHooks::Repository.
|
33
|
+
options['repo'] ||= GitHooks::Repository.path
|
34
34
|
|
35
35
|
repo_data = GitHooks::Repository::Config.new.get(
|
36
36
|
option_name,
|
@@ -59,7 +59,7 @@ module GitHooks
|
|
59
59
|
def set(option_name, option_value) # rubocop:disable AbcSize
|
60
60
|
GitHooks.verbose = !!options['verbose']
|
61
61
|
GitHooks.debug = !!options['debug']
|
62
|
-
options['repo'] ||= GitHooks::Repository.
|
62
|
+
options['repo'] ||= GitHooks::Repository.path
|
63
63
|
|
64
64
|
GitHooks::Repository::Config.new.set(
|
65
65
|
option_name,
|
@@ -76,7 +76,7 @@ module GitHooks
|
|
76
76
|
def unset(option_name, option_value = nil) # rubocop:disable AbcSize
|
77
77
|
GitHooks.verbose = !!options['verbose']
|
78
78
|
GitHooks.debug = !!options['debug']
|
79
|
-
options['repo'] ||= GitHooks::Repository.
|
79
|
+
options['repo'] ||= GitHooks::Repository.path
|
80
80
|
|
81
81
|
GitHooks::Repository::Config.new.unset(
|
82
82
|
option_name,
|
@@ -93,7 +93,7 @@ module GitHooks
|
|
93
93
|
GitHooks.verbose = !!options['verbose']
|
94
94
|
GitHooks.debug = !!options['debug']
|
95
95
|
|
96
|
-
options['repo'] ||= GitHooks::Repository.
|
96
|
+
options['repo'] ||= GitHooks::Repository.path
|
97
97
|
config = GitHooks::Repository::Config.new
|
98
98
|
|
99
99
|
githooks = config.list(global: options['global'], repo_path: options['repo'])['githooks']
|
data/lib/githooks/cli.rb
CHANGED
@@ -4,13 +4,21 @@ require_relative 'runner'
|
|
4
4
|
|
5
5
|
module GitHooks
|
6
6
|
module CLI
|
7
|
-
autoload :Config, 'githooks/
|
7
|
+
autoload :Config, 'githooks/cli/config'
|
8
8
|
|
9
9
|
# rubocop:disable AbcSize
|
10
10
|
class Base < Thor
|
11
11
|
class_option :verbose, aliases: '-v', type: :boolean, desc: 'verbose output', default: false
|
12
12
|
class_option :debug, aliases: '-d', type: :boolean, desc: 'debug output', default: false
|
13
13
|
|
14
|
+
desc :version, 'display version information'
|
15
|
+
def version
|
16
|
+
puts "GitHooks: #{GitHooks::VERSION}"
|
17
|
+
puts "Git : #{%x{git --version | grep git}.split(/\s+/).last}"
|
18
|
+
puts "Bundler : #{Bundler::VERSION}"
|
19
|
+
puts "Ruby : #{RUBY_ENGINE} #{RUBY_VERSION}p#{RUBY_PATCHLEVEL} (#{RUBY_RELEASE_DATE})"
|
20
|
+
end
|
21
|
+
|
14
22
|
# githook attach [--hook <hook1,hookN>] [--script <path> | --path <path>] [--bootstrap <path>]
|
15
23
|
# -- attaches the listed hooks (or all if none specified) to the githook runner
|
16
24
|
# optionally sets the script XOR path
|
@@ -33,7 +41,7 @@ module GitHooks
|
|
33
41
|
fail ArgumentError, %q"Neither 'path' nor 'script' were specified - please provide at least one."
|
34
42
|
end
|
35
43
|
|
36
|
-
Runner.
|
44
|
+
Runner.new(options.dup).attach
|
37
45
|
end
|
38
46
|
|
39
47
|
# githook dettach [--hook <hook1,hookN>]
|
@@ -49,7 +57,7 @@ module GitHooks
|
|
49
57
|
def detach
|
50
58
|
GitHooks.verbose = !!options['verbose']
|
51
59
|
GitHooks.debug = !!options['debug']
|
52
|
-
Runner.detach(options['
|
60
|
+
Runner.new(options.dup).detach(options['hooks'])
|
53
61
|
end
|
54
62
|
|
55
63
|
# githook list [--hook <hook1,hook2,hookN>]
|
@@ -59,7 +67,7 @@ module GitHooks
|
|
59
67
|
def list
|
60
68
|
GitHooks.verbose = !!options['verbose']
|
61
69
|
GitHooks.debug = !!options['debug']
|
62
|
-
Runner.
|
70
|
+
Runner.new(options.dup).list
|
63
71
|
end
|
64
72
|
|
65
73
|
# githooks execute [--[no-]staged] [--tracked] [--untracked] [--args -- one two three ...]
|
@@ -78,10 +86,11 @@ module GitHooks
|
|
78
86
|
method_option :'skip-bundler', type: :boolean, desc: %q"Don't load bundler gemfile", default: false
|
79
87
|
method_option :args, type: :array, desc: 'Args to pass to pre/post scripts and main testing script', default: []
|
80
88
|
def execute
|
81
|
-
GitHooks.verbose =
|
82
|
-
GitHooks.debug =
|
89
|
+
GitHooks.verbose = options['verbose']
|
90
|
+
GitHooks.debug = options['debug']
|
83
91
|
|
84
|
-
opts =
|
92
|
+
opts = options.dup
|
93
|
+
opts['staged'] ||= !(opts['tracked'] || opts['untracked'])
|
85
94
|
|
86
95
|
if opts['staged']
|
87
96
|
if opts['tracked']
|
@@ -93,9 +102,9 @@ module GitHooks
|
|
93
102
|
end
|
94
103
|
end
|
95
104
|
|
96
|
-
opts['
|
105
|
+
opts['skip-bundler'] ||= !!ENV['GITHOOKS_SKIP_BUNDLER']
|
97
106
|
|
98
|
-
|
107
|
+
Runner.new(opts).run
|
99
108
|
end
|
100
109
|
|
101
110
|
desc :config, 'manage githooks configuration'
|
@@ -1,3 +1,21 @@
|
|
1
|
+
=begin
|
2
|
+
Copyright (C) 2013 Carl P. Corliss
|
3
|
+
|
4
|
+
This program is free software; you can redistribute it and/or modify
|
5
|
+
it under the terms of the GNU General Public License as published by
|
6
|
+
the Free Software Foundation; either version 2 of the License, or
|
7
|
+
(at your option) any later version.
|
8
|
+
|
9
|
+
This program is distributed in the hope that it will be useful,
|
10
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
GNU General Public License for more details.
|
13
|
+
|
14
|
+
You should have received a copy of the GNU General Public License along
|
15
|
+
with this program; if not, write to the Free Software Foundation, Inc.,
|
16
|
+
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
17
|
+
=end
|
18
|
+
|
1
19
|
class Array
|
2
20
|
def extract_options!
|
3
21
|
last.is_a?(Hash) ? pop : {}
|
@@ -1,3 +1,21 @@
|
|
1
|
+
=begin
|
2
|
+
Copyright (C) 2013 Carl P. Corliss
|
3
|
+
|
4
|
+
This program is free software; you can redistribute it and/or modify
|
5
|
+
it under the terms of the GNU General Public License as published by
|
6
|
+
the Free Software Foundation; either version 2 of the License, or
|
7
|
+
(at your option) any later version.
|
8
|
+
|
9
|
+
This program is distributed in the hope that it will be useful,
|
10
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
GNU General Public License for more details.
|
13
|
+
|
14
|
+
You should have received a copy of the GNU General Public License along
|
15
|
+
with this program; if not, write to the Free Software Foundation, Inc.,
|
16
|
+
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
17
|
+
=end
|
18
|
+
|
1
19
|
class Array
|
2
20
|
def select_with_index(regexp = nil, &block)
|
3
21
|
[].tap do |collection|
|
@@ -1,3 +1,21 @@
|
|
1
|
+
=begin
|
2
|
+
Copyright (C) 2013 Carl P. Corliss
|
3
|
+
|
4
|
+
This program is free software; you can redistribute it and/or modify
|
5
|
+
it under the terms of the GNU General Public License as published by
|
6
|
+
the Free Software Foundation; either version 2 of the License, or
|
7
|
+
(at your option) any later version.
|
8
|
+
|
9
|
+
This program is distributed in the hope that it will be useful,
|
10
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
GNU General Public License for more details.
|
13
|
+
|
14
|
+
You should have received a copy of the GNU General Public License along
|
15
|
+
with this program; if not, write to the Free Software Foundation, Inc.,
|
16
|
+
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
17
|
+
=end
|
18
|
+
|
1
19
|
require_relative 'array/min_max'
|
2
20
|
require_relative 'array/select_with_index'
|
3
21
|
require_relative 'array/extract_options'
|
@@ -1 +1,19 @@
|
|
1
|
+
=begin
|
2
|
+
Copyright (C) 2013 Carl P. Corliss
|
3
|
+
|
4
|
+
This program is free software; you can redistribute it and/or modify
|
5
|
+
it under the terms of the GNU General Public License as published by
|
6
|
+
the Free Software Foundation; either version 2 of the License, or
|
7
|
+
(at your option) any later version.
|
8
|
+
|
9
|
+
This program is distributed in the hope that it will be useful,
|
10
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
GNU General Public License for more details.
|
13
|
+
|
14
|
+
You should have received a copy of the GNU General Public License along
|
15
|
+
with this program; if not, write to the Free Software Foundation, Inc.,
|
16
|
+
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
17
|
+
=end
|
18
|
+
|
1
19
|
require_relative 'numbers/infinity'
|
@@ -1,3 +1,21 @@
|
|
1
|
+
=begin
|
2
|
+
Copyright (C) 2013 Carl P. Corliss
|
3
|
+
|
4
|
+
This program is free software; you can redistribute it and/or modify
|
5
|
+
it under the terms of the GNU General Public License as published by
|
6
|
+
the Free Software Foundation; either version 2 of the License, or
|
7
|
+
(at your option) any later version.
|
8
|
+
|
9
|
+
This program is distributed in the hope that it will be useful,
|
10
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
GNU General Public License for more details.
|
13
|
+
|
14
|
+
You should have received a copy of the GNU General Public License along
|
15
|
+
with this program; if not, write to the Free Software Foundation, Inc.,
|
16
|
+
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
17
|
+
=end
|
18
|
+
|
1
19
|
class Object
|
2
20
|
def deep_dup
|
3
21
|
Marshal.load(Marshal.dump(self))
|
@@ -0,0 +1,44 @@
|
|
1
|
+
=begin
|
2
|
+
Copyright (C) 2013 Carl P. Corliss
|
3
|
+
|
4
|
+
This program is free software; you can redistribute it and/or modify
|
5
|
+
it under the terms of the GNU General Public License as published by
|
6
|
+
the Free Software Foundation; either version 2 of the License, or
|
7
|
+
(at your option) any later version.
|
8
|
+
|
9
|
+
This program is distributed in the hope that it will be useful,
|
10
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
GNU General Public License for more details.
|
13
|
+
|
14
|
+
You should have received a copy of the GNU General Public License along
|
15
|
+
with this program; if not, write to the Free Software Foundation, Inc.,
|
16
|
+
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
17
|
+
=end
|
18
|
+
|
19
|
+
require 'ostruct'
|
20
|
+
require 'thor/core_ext/hash_with_indifferent_access'
|
21
|
+
|
22
|
+
class IndifferentAccessOpenStruct < OpenStruct
|
23
|
+
def new_ostruct_member(name)
|
24
|
+
return super unless name.to_s.include? '-'
|
25
|
+
|
26
|
+
original_name, sanitized_name = name, name.to_s.gsub('-', '_').to_sym
|
27
|
+
return if respond_to?(sanitized_name)
|
28
|
+
|
29
|
+
define_singleton_method(sanitized_name) { @table[original_name] }
|
30
|
+
define_singleton_method("#{sanitized_name}=") { |x| @table[original_name] = x }
|
31
|
+
end
|
32
|
+
|
33
|
+
def [](k)
|
34
|
+
public_send(k)
|
35
|
+
end
|
36
|
+
|
37
|
+
def []=(k, v)
|
38
|
+
public_send("#{k}=", v)
|
39
|
+
end
|
40
|
+
|
41
|
+
def to_h
|
42
|
+
Thor::CoreExt::HashWithIndifferentAccess.new(@table)
|
43
|
+
end
|
44
|
+
end
|
@@ -1,3 +1,21 @@
|
|
1
|
+
=begin
|
2
|
+
Copyright (C) 2013 Carl P. Corliss
|
3
|
+
|
4
|
+
This program is free software; you can redistribute it and/or modify
|
5
|
+
it under the terms of the GNU General Public License as published by
|
6
|
+
the Free Software Foundation; either version 2 of the License, or
|
7
|
+
(at your option) any later version.
|
8
|
+
|
9
|
+
This program is distributed in the hope that it will be useful,
|
10
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
GNU General Public License for more details.
|
13
|
+
|
14
|
+
You should have received a copy of the GNU General Public License along
|
15
|
+
with this program; if not, write to the Free Software Foundation, Inc.,
|
16
|
+
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
17
|
+
=end
|
18
|
+
|
1
19
|
require 'pathname'
|
2
20
|
|
3
21
|
if RUBY_ENGINE == 'jruby'
|
@@ -26,3 +44,13 @@ if RUBY_ENGINE == 'jruby'
|
|
26
44
|
private :java_realpath
|
27
45
|
end
|
28
46
|
end
|
47
|
+
|
48
|
+
class Pathname
|
49
|
+
def include?(component)
|
50
|
+
to_s.split(File::SEPARATOR).include?(component)
|
51
|
+
end
|
52
|
+
|
53
|
+
def exclude?(component)
|
54
|
+
!include?(component)
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
=begin
|
2
|
+
Copyright (C) 2013 Carl P. Corliss
|
3
|
+
|
4
|
+
This program is free software; you can redistribute it and/or modify
|
5
|
+
it under the terms of the GNU General Public License as published by
|
6
|
+
the Free Software Foundation; either version 2 of the License, or
|
7
|
+
(at your option) any later version.
|
8
|
+
|
9
|
+
This program is distributed in the hope that it will be useful,
|
10
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
GNU General Public License for more details.
|
13
|
+
|
14
|
+
You should have received a copy of the GNU General Public License along
|
15
|
+
with this program; if not, write to the Free Software Foundation, Inc.,
|
16
|
+
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
17
|
+
=end
|
18
|
+
|
19
|
+
require 'rainbow/ext/string'
|
20
|
+
|
21
|
+
module Rainbow
|
22
|
+
module Ext
|
23
|
+
module String
|
24
|
+
module InstanceMethods
|
25
|
+
def success!
|
26
|
+
color(:green).bright
|
27
|
+
end
|
28
|
+
|
29
|
+
def failure!
|
30
|
+
color(:red).bright
|
31
|
+
end
|
32
|
+
|
33
|
+
def unknown!
|
34
|
+
color(:yellow).bright
|
35
|
+
end
|
36
|
+
alias_method :warning!, :unknown!
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -1,3 +1,21 @@
|
|
1
|
+
=begin
|
2
|
+
Copyright (C) 2013 Carl P. Corliss
|
3
|
+
|
4
|
+
This program is free software; you can redistribute it and/or modify
|
5
|
+
it under the terms of the GNU General Public License as published by
|
6
|
+
the Free Software Foundation; either version 2 of the License, or
|
7
|
+
(at your option) any later version.
|
8
|
+
|
9
|
+
This program is distributed in the hope that it will be useful,
|
10
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
GNU General Public License for more details.
|
13
|
+
|
14
|
+
You should have received a copy of the GNU General Public License along
|
15
|
+
with this program; if not, write to the Free Software Foundation, Inc.,
|
16
|
+
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
17
|
+
=end
|
18
|
+
|
1
19
|
class String
|
2
20
|
def git_option_path_split
|
3
21
|
section, *subsection, option = split('.')
|
@@ -1,3 +1,21 @@
|
|
1
|
+
=begin
|
2
|
+
Copyright (C) 2013 Carl P. Corliss
|
3
|
+
|
4
|
+
This program is free software; you can redistribute it and/or modify
|
5
|
+
it under the terms of the GNU General Public License as published by
|
6
|
+
the Free Software Foundation; either version 2 of the License, or
|
7
|
+
(at your option) any later version.
|
8
|
+
|
9
|
+
This program is distributed in the hope that it will be useful,
|
10
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
GNU General Public License for more details.
|
13
|
+
|
14
|
+
You should have received a copy of the GNU General Public License along
|
15
|
+
with this program; if not, write to the Free Software Foundation, Inc.,
|
16
|
+
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
17
|
+
=end
|
18
|
+
|
1
19
|
=begin
|
2
20
|
Mostly borrowed from Rails' ActiveSupport::Inflections
|
3
21
|
=end
|
@@ -1,3 +1,21 @@
|
|
1
|
+
=begin
|
2
|
+
Copyright (C) 2013 Carl P. Corliss
|
3
|
+
|
4
|
+
This program is free software; you can redistribute it and/or modify
|
5
|
+
it under the terms of the GNU General Public License as published by
|
6
|
+
the Free Software Foundation; either version 2 of the License, or
|
7
|
+
(at your option) any later version.
|
8
|
+
|
9
|
+
This program is distributed in the hope that it will be useful,
|
10
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
GNU General Public License for more details.
|
13
|
+
|
14
|
+
You should have received a copy of the GNU General Public License along
|
15
|
+
with this program; if not, write to the Free Software Foundation, Inc.,
|
16
|
+
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
17
|
+
=end
|
18
|
+
|
1
19
|
require_relative '../array/extract_options'
|
2
20
|
|
3
21
|
class String
|
@@ -1,3 +1,21 @@
|
|
1
|
+
=begin
|
2
|
+
Copyright (C) 2013 Carl P. Corliss
|
3
|
+
|
4
|
+
This program is free software; you can redistribute it and/or modify
|
5
|
+
it under the terms of the GNU General Public License as published by
|
6
|
+
the Free Software Foundation; either version 2 of the License, or
|
7
|
+
(at your option) any later version.
|
8
|
+
|
9
|
+
This program is distributed in the hope that it will be useful,
|
10
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
GNU General Public License for more details.
|
13
|
+
|
14
|
+
You should have received a copy of the GNU General Public License along
|
15
|
+
with this program; if not, write to the Free Software Foundation, Inc.,
|
16
|
+
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
17
|
+
=end
|
18
|
+
|
1
19
|
require_relative 'string/git_option_path_split'
|
2
20
|
require_relative 'string/inflections'
|
3
21
|
require_relative 'string/sanitize'
|
data/lib/githooks/core_ext.rb
CHANGED
@@ -18,7 +18,8 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|
18
18
|
|
19
19
|
require_relative 'core_ext/object'
|
20
20
|
require_relative 'core_ext/array'
|
21
|
-
require_relative 'core_ext/
|
21
|
+
require_relative 'core_ext/rainbow'
|
22
22
|
require_relative 'core_ext/numbers'
|
23
23
|
require_relative 'core_ext/string'
|
24
24
|
require_relative 'core_ext/pathname'
|
25
|
+
require_relative 'core_ext/ostruct'
|