rake_git_crypt 0.1.0.pre.12 → 0.1.0.pre.13

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
  SHA256:
3
- metadata.gz: 34731a912f782d1fc1183dfb48d5925d93b3ca862d1443b47bc8c2b61cb8124f
4
- data.tar.gz: 95596062d6eea240963dca39981cc88dd39a5f4895204d78e3c5bad637f9ada1
3
+ metadata.gz: c79a14818908aa6aff28a9fbac914c51bca6bd66b4dd585aa2eb9bf572c990a2
4
+ data.tar.gz: 59d3a64f1f1257a842b650f39029623f3ef25cddbb903b06f40cd322796d7031
5
5
  SHA512:
6
- metadata.gz: 2cb7508f0c19c589538cdce1c553203d44db6e711a0e929e48b3f5b34c66c93d415705024d075c22aaf4df0795dff08a6ad6521ead580ef6a86aa3b3ee55e268
7
- data.tar.gz: d0c3976ed25b41beed85fa04750ed205546e8be7a83a9f88b44d0ab2b03c18d220ee80c8ebb8411166be3e47563463d8941b91c7b1a8217220a27dbd947aa281
6
+ metadata.gz: c3442a576db2d1db507a0aec982f8c25244568a99d0cfd9b01d6ac9411118b336ebb95785b3fd7b750acd3ef2dc854c8042e1d9b0a16e3bbe700fef7a11ae76f
7
+ data.tar.gz: '08a4abbc29b0fab4e42ee3625e9287750c5003289e0121b3dacade64fb84b690e307b2d9aca55ab4db8822869d1babad41fd20592a4da9ec52b755c387b10e21'
data/Gemfile CHANGED
@@ -4,3 +4,18 @@ source 'https://rubygems.org'
4
4
 
5
5
  # Specify your gem's dependencies in rake_git_crypt.gemspec
6
6
  gemspec
7
+
8
+ gem 'activesupport'
9
+ gem 'bundler'
10
+ gem 'gem-release'
11
+ gem 'memfs'
12
+ gem 'rake'
13
+ gem 'rake_circle_ci'
14
+ gem 'rake_github'
15
+ gem 'rake_gpg'
16
+ gem 'rake_ssh'
17
+ gem 'rspec'
18
+ gem 'rubocop'
19
+ gem 'rubocop-rake'
20
+ gem 'rubocop-rspec'
21
+ gem 'simplecov'
data/Gemfile.lock CHANGED
@@ -1,16 +1,16 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rake_git_crypt (0.1.0.pre.12)
4
+ rake_git_crypt (0.1.0.pre.13)
5
5
  colored2 (~> 3.1)
6
- rake_factory (~> 0.23)
6
+ rake_factory (= 0.32.0.pre.2)
7
7
  ruby_git_crypt (= 0.1.0.pre.2)
8
8
  ruby_gpg2 (~> 0.6)
9
9
 
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- activesupport (7.0.4)
13
+ activesupport (7.0.4.2)
14
14
  concurrent-ruby (~> 1.0, >= 1.0.2)
15
15
  i18n (>= 1.6, < 2)
16
16
  minitest (>= 5.1)
@@ -19,11 +19,11 @@ GEM
19
19
  public_suffix (>= 2.0.2, < 6.0)
20
20
  ast (2.4.2)
21
21
  colored2 (3.1.2)
22
- concurrent-ruby (1.1.10)
22
+ concurrent-ruby (1.2.0)
23
23
  diff-lcs (1.5.0)
24
24
  docile (1.4.0)
25
- excon (0.96.0)
26
- faraday (2.7.2)
25
+ excon (0.98.0)
26
+ faraday (2.7.4)
27
27
  faraday-net_http (>= 2.0, < 3.1)
28
28
  ruby2_keywords (>= 0.0.4)
29
29
  faraday-net_http (3.0.2)
@@ -54,7 +54,7 @@ GEM
54
54
  excon (~> 0.72)
55
55
  rake_factory (~> 0.23)
56
56
  sshkey (~> 2.0)
57
- rake_factory (0.31.0)
57
+ rake_factory (0.32.0.pre.2)
58
58
  activesupport (>= 4)
59
59
  rake (~> 13.0)
60
60
  rake_github (0.11.0)
@@ -69,7 +69,7 @@ GEM
69
69
  colored2 (~> 3.1)
70
70
  rake_factory (~> 0.23)
71
71
  sshkey (~> 2.0)
72
- regexp_parser (2.6.1)
72
+ regexp_parser (2.6.2)
73
73
  rexml (3.2.5)
74
74
  rspec (3.12.0)
75
75
  rspec-core (~> 3.12.0)
@@ -80,26 +80,29 @@ GEM
80
80
  rspec-expectations (3.12.2)
81
81
  diff-lcs (>= 1.2.0, < 2.0)
82
82
  rspec-support (~> 3.12.0)
83
- rspec-mocks (3.12.2)
83
+ rspec-mocks (3.12.3)
84
84
  diff-lcs (>= 1.2.0, < 2.0)
85
85
  rspec-support (~> 3.12.0)
86
86
  rspec-support (3.12.0)
87
- rubocop (1.42.0)
87
+ rubocop (1.44.1)
88
88
  json (~> 2.3)
89
89
  parallel (~> 1.10)
90
- parser (>= 3.1.2.1)
90
+ parser (>= 3.2.0.0)
91
91
  rainbow (>= 2.2.2, < 4.0)
92
92
  regexp_parser (>= 1.8, < 3.0)
93
93
  rexml (>= 3.2.5, < 4.0)
94
94
  rubocop-ast (>= 1.24.1, < 2.0)
95
95
  ruby-progressbar (~> 1.7)
96
- unicode-display_width (>= 1.4.0, < 3.0)
96
+ unicode-display_width (>= 2.4.0, < 3.0)
97
97
  rubocop-ast (1.24.1)
98
98
  parser (>= 3.1.1.0)
99
+ rubocop-capybara (2.17.0)
100
+ rubocop (~> 1.41)
99
101
  rubocop-rake (0.6.0)
100
102
  rubocop (~> 1.0)
101
- rubocop-rspec (2.16.0)
103
+ rubocop-rspec (2.18.1)
102
104
  rubocop (~> 1.33)
105
+ rubocop-capybara (~> 2.17)
103
106
  ruby-progressbar (1.11.0)
104
107
  ruby2_keywords (0.0.5)
105
108
  ruby_git_crypt (0.1.0.pre.2)
@@ -145,4 +148,4 @@ DEPENDENCIES
145
148
  simplecov
146
149
 
147
150
  BUNDLED WITH
148
- 2.4.3
151
+ 2.4.5
@@ -8,10 +8,118 @@ module RakeGitCrypt
8
8
  default_name :add_users
9
9
  default_description 'Add users to git-crypt.'
10
10
 
11
- parameter :gpg_user_key_paths
11
+ parameter :gpg_user_key_paths, default: []
12
+ parameter :gpg_user_ids, default: []
12
13
 
13
- action do
14
- # no-op
14
+ parameter(
15
+ :add_user_by_id_task_name,
16
+ default: :add_user_by_id
17
+ )
18
+ parameter(
19
+ :add_user_by_key_path_task_name,
20
+ default: :add_user_by_key_path
21
+ )
22
+
23
+ action do |t, args|
24
+ ensure_users_provided
25
+ ensure_tasks_present(t)
26
+
27
+ add_users_by_key_paths(t, args)
28
+ add_users_by_ids(t, args)
29
+ end
30
+
31
+ private
32
+
33
+ def ensure_users_provided
34
+ if gpg_user_details_present?(:key_path) ||
35
+ gpg_user_details_present?(:id)
36
+ return
37
+ end
38
+
39
+ raise_user_details_missing
40
+ end
41
+
42
+ def ensure_tasks_present(task)
43
+ ensure_add_user_task_present(task, :id)
44
+ ensure_add_user_task_present(task, :key_path)
45
+ end
46
+
47
+ def ensure_add_user_task_present(task, user_type)
48
+ unless task_required?(user_type) && (
49
+ task_name_missing?(user_type) ||
50
+ !task_defined?(task, user_type))
51
+ return
52
+ end
53
+
54
+ if task_name_missing?(user_type)
55
+ raise_add_user_task_name_missing(user_type)
56
+ else
57
+ raise_add_user_task_undefined(user_type)
58
+ end
59
+ end
60
+
61
+ def task_name_missing?(user_type)
62
+ send(:"add_user_by_#{user_type}_task_name").nil?
63
+ end
64
+
65
+ def task_required?(user_type)
66
+ gpg_user_details_present?(user_type)
67
+ end
68
+
69
+ def task_defined?(task, user_type)
70
+ !task.application
71
+ .lookup(send(:"add_user_by_#{user_type}_task_name"), task.scope)
72
+ .nil?
73
+ end
74
+
75
+ def gpg_user_details_present?(user_type)
76
+ !(send(:"gpg_user_#{user_type}s").nil? ||
77
+ send(:"gpg_user_#{user_type}s").empty?)
78
+ end
79
+
80
+ def add_users_by_key_paths(task, args)
81
+ add_users(task, args, :key_path)
82
+ end
83
+
84
+ def add_users_by_ids(task, args)
85
+ add_users(task, args, :id)
86
+ end
87
+
88
+ def add_users(task, args, user_type)
89
+ return unless gpg_user_details_present?(user_type)
90
+
91
+ puts "Adding git-crypt users by type #{user_type}..."
92
+ add_user_task_name = task.send(:"add_user_by_#{user_type}_task_name")
93
+ add_user_task = task.application[add_user_task_name, task.scope]
94
+ send(:"gpg_user_#{user_type}s").each do |detail|
95
+ add_user_task.invoke(detail, *args)
96
+ add_user_task.reenable
97
+ end
98
+ end
99
+
100
+ def raise_add_user_task_name_missing(user_type)
101
+ raise(
102
+ RakeFactory::RequiredParameterUnset,
103
+ "When gpg_user_#{user_type}s provided, " \
104
+ "add_user_by_#{user_type}_task_name must be defined but is nil."
105
+ )
106
+ end
107
+
108
+ def raise_add_user_task_undefined(user_type)
109
+ raise(
110
+ RakeFactory::DependencyTaskMissing,
111
+ 'The task with name defined in ' \
112
+ "add_user_by_#{user_type}_task_name does not exist but is needed " \
113
+ "since gpg_user_#{user_type}s provided."
114
+ )
115
+ end
116
+
117
+ def raise_user_details_missing
118
+ raise(
119
+ RakeFactory::RequiredParameterUnset,
120
+ 'At least one of gpg_user_key_paths or gpg_user_ids ' \
121
+ 'must be provided.'
122
+ )
15
123
  end
16
124
  end
17
125
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RakeGitCrypt
4
- VERSION = '0.1.0.pre.12'
4
+ VERSION = '0.1.0.pre.13'
5
5
  end
@@ -37,24 +37,9 @@ Gem::Specification.new do |spec|
37
37
  spec.required_ruby_version = '>= 2.7'
38
38
 
39
39
  spec.add_dependency 'colored2', '~> 3.1'
40
- spec.add_dependency 'rake_factory', '~> 0.23'
40
+ spec.add_dependency 'rake_factory', '0.32.0.pre.2'
41
41
  spec.add_dependency 'ruby_git_crypt', '0.1.0.pre.2'
42
42
  spec.add_dependency 'ruby_gpg2', '~> 0.6'
43
43
 
44
- spec.add_development_dependency 'activesupport'
45
- spec.add_development_dependency 'bundler'
46
- spec.add_development_dependency 'gem-release'
47
- spec.add_development_dependency 'memfs'
48
- spec.add_development_dependency 'rake'
49
- spec.add_development_dependency 'rake_circle_ci'
50
- spec.add_development_dependency 'rake_github'
51
- spec.add_development_dependency 'rake_gpg'
52
- spec.add_development_dependency 'rake_ssh'
53
- spec.add_development_dependency 'rspec'
54
- spec.add_development_dependency 'rubocop'
55
- spec.add_development_dependency 'rubocop-rake'
56
- spec.add_development_dependency 'rubocop-rspec'
57
- spec.add_development_dependency 'simplecov'
58
-
59
44
  spec.metadata['rubygems_mfa_required'] = 'false'
60
45
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rake_git_crypt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.pre.12
4
+ version: 0.1.0.pre.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - InfraBlocks Maintainers
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-01-10 00:00:00.000000000 Z
11
+ date: 2023-01-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colored2
@@ -28,16 +28,16 @@ dependencies:
28
28
  name: rake_factory
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: '0.23'
33
+ version: 0.32.0.pre.2
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: '0.23'
40
+ version: 0.32.0.pre.2
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: ruby_git_crypt
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -66,202 +66,6 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0.6'
69
- - !ruby/object:Gem::Dependency
70
- name: activesupport
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: '0'
83
- - !ruby/object:Gem::Dependency
84
- name: bundler
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- version: '0'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- version: '0'
97
- - !ruby/object:Gem::Dependency
98
- name: gem-release
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - ">="
102
- - !ruby/object:Gem::Version
103
- version: '0'
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - ">="
109
- - !ruby/object:Gem::Version
110
- version: '0'
111
- - !ruby/object:Gem::Dependency
112
- name: memfs
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - ">="
116
- - !ruby/object:Gem::Version
117
- version: '0'
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - ">="
123
- - !ruby/object:Gem::Version
124
- version: '0'
125
- - !ruby/object:Gem::Dependency
126
- name: rake
127
- requirement: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - ">="
130
- - !ruby/object:Gem::Version
131
- version: '0'
132
- type: :development
133
- prerelease: false
134
- version_requirements: !ruby/object:Gem::Requirement
135
- requirements:
136
- - - ">="
137
- - !ruby/object:Gem::Version
138
- version: '0'
139
- - !ruby/object:Gem::Dependency
140
- name: rake_circle_ci
141
- requirement: !ruby/object:Gem::Requirement
142
- requirements:
143
- - - ">="
144
- - !ruby/object:Gem::Version
145
- version: '0'
146
- type: :development
147
- prerelease: false
148
- version_requirements: !ruby/object:Gem::Requirement
149
- requirements:
150
- - - ">="
151
- - !ruby/object:Gem::Version
152
- version: '0'
153
- - !ruby/object:Gem::Dependency
154
- name: rake_github
155
- requirement: !ruby/object:Gem::Requirement
156
- requirements:
157
- - - ">="
158
- - !ruby/object:Gem::Version
159
- version: '0'
160
- type: :development
161
- prerelease: false
162
- version_requirements: !ruby/object:Gem::Requirement
163
- requirements:
164
- - - ">="
165
- - !ruby/object:Gem::Version
166
- version: '0'
167
- - !ruby/object:Gem::Dependency
168
- name: rake_gpg
169
- requirement: !ruby/object:Gem::Requirement
170
- requirements:
171
- - - ">="
172
- - !ruby/object:Gem::Version
173
- version: '0'
174
- type: :development
175
- prerelease: false
176
- version_requirements: !ruby/object:Gem::Requirement
177
- requirements:
178
- - - ">="
179
- - !ruby/object:Gem::Version
180
- version: '0'
181
- - !ruby/object:Gem::Dependency
182
- name: rake_ssh
183
- requirement: !ruby/object:Gem::Requirement
184
- requirements:
185
- - - ">="
186
- - !ruby/object:Gem::Version
187
- version: '0'
188
- type: :development
189
- prerelease: false
190
- version_requirements: !ruby/object:Gem::Requirement
191
- requirements:
192
- - - ">="
193
- - !ruby/object:Gem::Version
194
- version: '0'
195
- - !ruby/object:Gem::Dependency
196
- name: rspec
197
- requirement: !ruby/object:Gem::Requirement
198
- requirements:
199
- - - ">="
200
- - !ruby/object:Gem::Version
201
- version: '0'
202
- type: :development
203
- prerelease: false
204
- version_requirements: !ruby/object:Gem::Requirement
205
- requirements:
206
- - - ">="
207
- - !ruby/object:Gem::Version
208
- version: '0'
209
- - !ruby/object:Gem::Dependency
210
- name: rubocop
211
- requirement: !ruby/object:Gem::Requirement
212
- requirements:
213
- - - ">="
214
- - !ruby/object:Gem::Version
215
- version: '0'
216
- type: :development
217
- prerelease: false
218
- version_requirements: !ruby/object:Gem::Requirement
219
- requirements:
220
- - - ">="
221
- - !ruby/object:Gem::Version
222
- version: '0'
223
- - !ruby/object:Gem::Dependency
224
- name: rubocop-rake
225
- requirement: !ruby/object:Gem::Requirement
226
- requirements:
227
- - - ">="
228
- - !ruby/object:Gem::Version
229
- version: '0'
230
- type: :development
231
- prerelease: false
232
- version_requirements: !ruby/object:Gem::Requirement
233
- requirements:
234
- - - ">="
235
- - !ruby/object:Gem::Version
236
- version: '0'
237
- - !ruby/object:Gem::Dependency
238
- name: rubocop-rspec
239
- requirement: !ruby/object:Gem::Requirement
240
- requirements:
241
- - - ">="
242
- - !ruby/object:Gem::Version
243
- version: '0'
244
- type: :development
245
- prerelease: false
246
- version_requirements: !ruby/object:Gem::Requirement
247
- requirements:
248
- - - ">="
249
- - !ruby/object:Gem::Version
250
- version: '0'
251
- - !ruby/object:Gem::Dependency
252
- name: simplecov
253
- requirement: !ruby/object:Gem::Requirement
254
- requirements:
255
- - - ">="
256
- - !ruby/object:Gem::Version
257
- version: '0'
258
- type: :development
259
- prerelease: false
260
- version_requirements: !ruby/object:Gem::Requirement
261
- requirements:
262
- - - ">="
263
- - !ruby/object:Gem::Version
264
- version: '0'
265
69
  description: Allows initialising, locking, unlocking and managing users for git-crypt.
266
70
  email:
267
71
  - maintainers@infrablocks.io