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 +4 -4
- data/Gemfile.lock +3 -3
- data/lib/rake_git_crypt/tasks/add_users.rb +33 -0
- data/lib/rake_git_crypt/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3a748262afe405e1a15bf60aa63e213dbb2a908b7116ebb397243719dffaf138
|
4
|
+
data.tar.gz: 3bd972019c51aec40d6309c616b9ffeb4763384ad06dc405d073a705ba1d9274
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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.
|
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.
|
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
|