rabbitt-githooks 1.5.0 → 1.5.1

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: c2910eaac5a0a17a57550adbda1fb32c5663d511
4
- data.tar.gz: beacd673a92ee04af1e4a876fc05ff83282a3115
3
+ metadata.gz: 9be7b07bbebbb66c3fc6cbc08f76c2759f4f24bc
4
+ data.tar.gz: 6521197f0aa99b077a74a4b7362541de2ee8f635
5
5
  SHA512:
6
- metadata.gz: bdb2a859e74d8ce90bf8644f20a0409b056a35599bacb1d87b7dbab3cfd0fbe3ca793dc17023f61c6059a0d0897dfb29223ec96c57221868e84c027e72d3f973
7
- data.tar.gz: 8e756225570a161cab9eabe5a22fbf3ed001d0d008c3e5a7058d850b905bf22c19f932f59b6b39fd36c7a183128b10cd8c7170a2e13d05ac65801ff1f26c5e44
6
+ metadata.gz: 6b6da3d8b71bff3f1bb1b3a705183aa67c06ba73cf210046d5cade7d2dcca6b277438b0b0a5902a0b22b67ade84a6a8b38c38902a70bcf0921d6b56c7a8a21f3
7
+ data.tar.gz: 680979f0543e112cf61a1ef9ecad384691c646659e7d5f47f674fc7122390680b477ed0e6c7fd669a8e3f3351490d64628add6015e288fd436caf1a9b6df2525
data/Gemfile.lock CHANGED
@@ -1,22 +1,23 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rabbitt-githooks (1.5.0)
4
+ rabbitt-githooks (1.5.1)
5
5
  rainbow (~> 2.0.0)
6
6
  thor (~> 0.18)
7
7
 
8
8
  GEM
9
9
  remote: http://rubygems.org/
10
10
  specs:
11
- ast (2.0.0)
12
- astrolabe (1.3.0)
13
- parser (>= 2.2.0.pre.3, < 3.0)
11
+ ast (2.1.0)
12
+ astrolabe (1.3.1)
13
+ parser (~> 2.2)
14
14
  diff-lcs (1.2.5)
15
15
  docile (1.1.5)
16
- multi_json (1.10.1)
17
- parser (2.2.0.2)
16
+ json (1.8.3)
17
+ json (1.8.3-java)
18
+ parser (2.2.2.6)
18
19
  ast (>= 1.1, < 3.0)
19
- powerpack (0.1.0)
20
+ powerpack (0.1.1)
20
21
  rainbow (2.0.0)
21
22
  rake (10.4.2)
22
23
  rspec (2.99.0)
@@ -26,22 +27,22 @@ GEM
26
27
  rspec-core (2.99.2)
27
28
  rspec-expectations (2.99.2)
28
29
  diff-lcs (>= 1.1.3, < 2.0)
29
- rspec-mocks (2.99.3)
30
- rubocop (0.29.0)
30
+ rspec-mocks (2.99.4)
31
+ rubocop (0.34.2)
31
32
  astrolabe (~> 1.3)
32
- parser (>= 2.2.0.1, < 3.0)
33
+ parser (>= 2.2.2.5, < 3.0)
33
34
  powerpack (~> 0.1)
34
35
  rainbow (>= 1.99.1, < 3.0)
35
36
  ruby-progressbar (~> 1.4)
36
- ruby-lint (2.0.3)
37
- parser (~> 2.1, >= 2.1.1)
37
+ ruby-lint (2.0.5)
38
+ parser (~> 2.2)
38
39
  slop (~> 3.4, >= 3.4.7)
39
- ruby-progressbar (1.7.1)
40
- simplecov (0.9.1)
40
+ ruby-progressbar (1.7.5)
41
+ simplecov (0.10.0)
41
42
  docile (~> 1.1.0)
42
- multi_json (~> 1.0)
43
- simplecov-html (~> 0.8.0)
44
- simplecov-html (0.8.0)
43
+ json (~> 1.8)
44
+ simplecov-html (~> 0.10.0)
45
+ simplecov-html (0.10.0)
45
46
  slop (3.6.0)
46
47
  thor (0.19.1)
47
48
  yard (0.8.7.6)
@@ -59,3 +60,6 @@ DEPENDENCIES
59
60
  ruby-lint (~> 2.0)
60
61
  simplecov (~> 0.9)
61
62
  yard (~> 0.7)
63
+
64
+ BUNDLED WITH
65
+ 1.10.6
@@ -48,6 +48,7 @@ module GitHooks
48
48
  # overrides previous action method to only return
49
49
  # actions that have a non-empty manifest
50
50
  def actions
51
+ return @actions unless @hook.phase == 'pre-commit'
51
52
  @actions.reject { |action| action.manifest.empty? }
52
53
  end
53
54
  alias_method :__getobj__, :actions
@@ -64,7 +64,7 @@ module GitHooks
64
64
 
65
65
  ENV_WHITELIST = %w(
66
66
  PATH HOME LDFLAGS CPPFLAGS DISPLAY EDITOR
67
- LANG LC_ALL SHELL SHLVL TERM TMPDIR USER
67
+ LANG LC_ALL SHELL SHLVL TERM TMPDIR USER HOME
68
68
  SSH_USER SSH_AUTH_SOCK
69
69
  GEM_HOME GEM_PATH MY_RUBY_HOME
70
70
  GIT_DIR GIT_AUTHOR_DATE GIT_INDEX_FILE GIT_AUTHOR_NAME GIT_PREFIX GIT_AUTHOR_EMAIL
@@ -134,9 +134,22 @@ module GitHooks
134
134
  options.delete(:use_name) ? name : bin_path.to_s
135
135
  end
136
136
 
137
- def prep_env(env = {})
138
- Hash[env].each_with_object([]) do |(k, v), array|
139
- array << %Q|#{k}="#{v}"| if ENV_WHITELIST.include? k
137
+ def prep_env(env = ENV, options = {})
138
+ include_keys = options.delete(:include) || ENV_WHITELIST
139
+ exclude_keys = options.delete(:exclude) || []
140
+
141
+ if exclude_keys.size > 0 && include_keys.size > 0
142
+ raise ArgumentError, "include and exclude are mutually exclusive"
143
+ end
144
+
145
+ Hash[env].each_with_object([]) do |(key, value), array|
146
+ if exclude_keys.size > 0
147
+ next if exclude_keys.include?(key)
148
+ elsif include_keys.size > 0
149
+ next unless include_keys.include?(key)
150
+ end
151
+
152
+ array << %Q'#{key}=#{value.inspect}'
140
153
  end
141
154
  end
142
155
 
@@ -156,7 +169,9 @@ module GitHooks
156
169
  command.push options.delete(:post_run) if options[:post_run]
157
170
  command = shellwords(command.flatten.join(';'))
158
171
 
159
- environment = prep_env(options.delete(:env) || ENV).join(' ')
172
+ command_env = options.delete(:env) || {}
173
+ whitelist_keys = ENV_WHITELIST | command_env.keys
174
+ environment = prep_env(ENV.to_h.merge(command_env), include: whitelist_keys).join(' ')
160
175
 
161
176
  error_file = Tempfile.new('ghstderr')
162
177
 
@@ -18,5 +18,5 @@ with this program; if not, write to the Free Software Foundation, Inc.,
18
18
  =end
19
19
 
20
20
  module GitHooks
21
- VERSION = '1.5.0' unless defined? VERSION
21
+ VERSION = '1.5.1' unless defined? VERSION
22
22
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rabbitt-githooks
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carl P. Corliss
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-17 00:00:00.000000000 Z
11
+ date: 2015-09-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rainbow
@@ -209,7 +209,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
209
209
  version: '0'
210
210
  requirements: []
211
211
  rubyforge_project:
212
- rubygems_version: 2.2.2
212
+ rubygems_version: 2.4.8
213
213
  signing_key:
214
214
  specification_version: 4
215
215
  summary: framework for building git hooks tests