rake_git_crypt 0.1.0.pre.1 → 0.1.0.pre.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -1
- data/lib/rake_git_crypt/tasks/add_gpg_user.rb +82 -0
- data/lib/rake_git_crypt/tasks/init.rb +6 -2
- data/lib/rake_git_crypt/tasks.rb +1 -0
- data/lib/rake_git_crypt/version.rb +1 -1
- data/rake_git_crypt.gemspec +1 -0
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ebf5b5840f7126aa22776be5637cb20756c128c7f5da74d6b8d1cea6897a677
|
4
|
+
data.tar.gz: 4bd0e38ea31eb8d2ecd2f38ee7673c97709f6dfec58ef630b370bda870261889
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff6d4a8cfa9df6f20daed3e22ae1cad73d2a8b9a16cb065aa271e9d13e9fd8201d16e90a12d90c1933756fc9477c673282c7039e0c92c409764de814a4864b9f
|
7
|
+
data.tar.gz: 195901c1744a6399303b846ff9b769b743d57dbc36211bec7d16777265d5dcf5c23e80849d64cca0391c3d67c92af5b08f7ec9328a00fd1b7fa248e3dc82c2c9
|
data/Gemfile.lock
CHANGED
@@ -0,0 +1,82 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rake_factory'
|
4
|
+
require 'ruby_git_crypt'
|
5
|
+
require 'ruby_gpg2'
|
6
|
+
|
7
|
+
module RakeGitCrypt
|
8
|
+
module Tasks
|
9
|
+
class AddGPGUser < RakeFactory::Task
|
10
|
+
default_name :add_gpg_user
|
11
|
+
default_description 'Add GPG user to git-crypt.'
|
12
|
+
|
13
|
+
parameter :key_name
|
14
|
+
|
15
|
+
parameter :gpg_user_id
|
16
|
+
parameter :gpg_user_key_path
|
17
|
+
|
18
|
+
action do
|
19
|
+
validate
|
20
|
+
|
21
|
+
if gpg_user_id
|
22
|
+
log_adding_by_id
|
23
|
+
add_gpg_user(gpg_user_id)
|
24
|
+
log_done
|
25
|
+
end
|
26
|
+
|
27
|
+
if gpg_user_key_path
|
28
|
+
log_adding_by_key_path
|
29
|
+
result = import_key
|
30
|
+
key_fingerprint = lookup_key_fingerprint(result)
|
31
|
+
add_gpg_user(key_fingerprint)
|
32
|
+
log_done
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
def validate
|
39
|
+
return if gpg_user_id || gpg_user_key_path
|
40
|
+
|
41
|
+
raise RakeFactory::RequiredParameterUnset,
|
42
|
+
'One of gpg_user_id or gpg_user_key_path must be provided ' \
|
43
|
+
'but neither was.'
|
44
|
+
end
|
45
|
+
|
46
|
+
def import_key
|
47
|
+
RubyGPG2.import(
|
48
|
+
key_file_paths: [gpg_user_key_path],
|
49
|
+
with_status: true
|
50
|
+
)
|
51
|
+
end
|
52
|
+
|
53
|
+
def lookup_key_fingerprint(result)
|
54
|
+
result.status.filter_by_type(:import_ok)
|
55
|
+
.first_line.key_fingerprint
|
56
|
+
end
|
57
|
+
|
58
|
+
def add_gpg_user(gpg_user_id)
|
59
|
+
RubyGitCrypt.add_gpg_user(
|
60
|
+
key_name: key_name,
|
61
|
+
gpg_user_id: gpg_user_id
|
62
|
+
)
|
63
|
+
end
|
64
|
+
|
65
|
+
def log_adding_by_id
|
66
|
+
$stdout.puts(
|
67
|
+
"Adding GPG user with ID: '#{gpg_user_id}' to git-crypt..."
|
68
|
+
)
|
69
|
+
end
|
70
|
+
|
71
|
+
def log_adding_by_key_path
|
72
|
+
puts(
|
73
|
+
"Adding GPG user with key at: '#{gpg_user_key_path}' to git-crypt..."
|
74
|
+
)
|
75
|
+
end
|
76
|
+
|
77
|
+
def log_done
|
78
|
+
$stdout.puts('Done.')
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
@@ -9,9 +9,13 @@ module RakeGitCrypt
|
|
9
9
|
default_name :init
|
10
10
|
default_description 'Initialise git-crypt.'
|
11
11
|
|
12
|
-
|
12
|
+
parameter :key_name
|
13
|
+
|
14
|
+
action do |task|
|
13
15
|
puts('Initialising git-crypt...')
|
14
|
-
RubyGitCrypt.init
|
16
|
+
RubyGitCrypt.init(
|
17
|
+
key_name: task.key_name
|
18
|
+
)
|
15
19
|
end
|
16
20
|
end
|
17
21
|
end
|
data/lib/rake_git_crypt/tasks.rb
CHANGED
data/rake_git_crypt.gemspec
CHANGED
@@ -39,6 +39,7 @@ Gem::Specification.new do |spec|
|
|
39
39
|
spec.add_dependency 'colored2', '~> 3.1'
|
40
40
|
spec.add_dependency 'rake_factory', '~> 0.23'
|
41
41
|
spec.add_dependency 'ruby_git_crypt', '0.1.0.pre.2'
|
42
|
+
spec.add_dependency 'ruby_gpg2', '~> 0.6'
|
42
43
|
|
43
44
|
spec.add_development_dependency 'activesupport'
|
44
45
|
spec.add_development_dependency 'bundler'
|
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.
|
4
|
+
version: 0.1.0.pre.2
|
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-
|
11
|
+
date: 2023-01-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colored2
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - '='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 0.1.0.pre.2
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: ruby_gpg2
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.6'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0.6'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: activesupport
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -266,6 +280,7 @@ files:
|
|
266
280
|
- lib/rake_git_crypt.rb
|
267
281
|
- lib/rake_git_crypt/task_sets.rb
|
268
282
|
- lib/rake_git_crypt/tasks.rb
|
283
|
+
- lib/rake_git_crypt/tasks/add_gpg_user.rb
|
269
284
|
- lib/rake_git_crypt/tasks/init.rb
|
270
285
|
- lib/rake_git_crypt/version.rb
|
271
286
|
- rake_git_crypt.gemspec
|