rake_git_crypt 0.1.0.pre.15 → 0.1.0.pre.17

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: e426a2d4bc292264074ac8e12c0ac21ebdfd3c834de262bf8afd889f3365e66d
4
- data.tar.gz: f043f33c2f71f991b54a972b1bb6683730f75c54bfaa1375c878253a8b81f2bd
3
+ metadata.gz: 3a748262afe405e1a15bf60aa63e213dbb2a908b7116ebb397243719dffaf138
4
+ data.tar.gz: 3bd972019c51aec40d6309c616b9ffeb4763384ad06dc405d073a705ba1d9274
5
5
  SHA512:
6
- metadata.gz: 263ca6021195915bceb150d3c3921377b2547a9b25850388e08766bc02d4037e126f3e27a4d402fc949d849a6ac82f9099e25555a938a2fc8cb735f518d4d85b
7
- data.tar.gz: 2fac6b967672f0dfd2bc307b64591d85b998b4eccddb41fba867c23a88dce24f95e2b2911db412fd39a2f51ea69efc38e47b2ef8d6a031936af9be597033790a
6
+ metadata.gz: 214da466a7dc1e925eb425b43218fc4250328cfef808d645a55a128dc19a0c0632c4393d267cfea407b996dd45b0731cdcad7f4c6a3a8aef2809c140290089ce
7
+ data.tar.gz: 90d8d68012f680583f37ba842f36176d7a83d3226ec8f088a5d5a85f68a0d47575fc4133b4cf66525a4abbb5fb07a137a24c2cfec253ffc53f3791f7014597ed
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rake_git_crypt (0.1.0.pre.15)
4
+ rake_git_crypt (0.1.0.pre.17)
5
5
  colored2 (~> 3.1)
6
6
  rake_factory (= 0.32.0.pre.2)
7
7
  ruby_git_crypt (= 0.1.0.pre.2)
@@ -120,7 +120,7 @@ GEM
120
120
  simplecov-html (0.12.3)
121
121
  simplecov_json_formatter (0.1.4)
122
122
  sshkey (2.0.0)
123
- tzinfo (2.0.5)
123
+ tzinfo (2.0.6)
124
124
  concurrent-ruby (~> 1.0)
125
125
  unicode-display_width (2.4.2)
126
126
 
@@ -148,4 +148,4 @@ DEPENDENCIES
148
148
  simplecov
149
149
 
150
150
  BUNDLED WITH
151
- 2.4.5
151
+ 2.4.6
@@ -6,6 +6,7 @@ require_relative '../mixins/support'
6
6
 
7
7
  module RakeGitCrypt
8
8
  module Tasks
9
+ # rubocop:disable Metrics/ClassLength
9
10
  class AddUsers < RakeFactory::Task
10
11
  include Mixins::Support
11
12
 
@@ -34,6 +35,37 @@ module RakeGitCrypt
34
35
 
35
36
  private
36
37
 
38
+ def gpg_user_key_paths
39
+ parameter = self.class.parameter_set.find(:gpg_user_key_paths)
40
+ key_paths = parameter.get(self)
41
+
42
+ return nil if key_paths.nil?
43
+
44
+ resolve_key_paths(key_paths)
45
+ end
46
+
47
+ def resolve_key_paths(paths)
48
+ paths.inject([]) do |acc, key_path|
49
+ [*acc, *resolve_key_path(key_path)]
50
+ end
51
+ end
52
+
53
+ def resolve_key_path(path)
54
+ if File.file?(path)
55
+ [path]
56
+ elsif File.directory?(path)
57
+ resolve_key_paths(list_directory(path))
58
+ else
59
+ []
60
+ end
61
+ end
62
+
63
+ def list_directory(path)
64
+ Dir.entries(path)
65
+ .reject { |entry| %w[. ..].include?(entry) }
66
+ .map { |entry| File.join(path, entry) }
67
+ end
68
+
37
69
  def ensure_users_provided
38
70
  if gpg_user_details_present?(:key_path) ||
39
71
  gpg_user_details_present?(:id)
@@ -124,5 +156,6 @@ module RakeGitCrypt
124
156
  )
125
157
  end
126
158
  end
159
+ # rubocop:enable Metrics/ClassLength
127
160
  end
128
161
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RakeGitCrypt
4
- VERSION = '0.1.0.pre.15'
4
+ VERSION = '0.1.0.pre.17'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
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.15
4
+ version: 0.1.0.pre.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - InfraBlocks Maintainers