rake_git_crypt 0.1.0.pre.13 → 0.1.0.pre.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/rake_git_crypt/mixins/support.rb +19 -0
- data/lib/rake_git_crypt/tasks/add_users.rb +12 -10
- data/lib/rake_git_crypt/tasks/uninstall.rb +60 -0
- data/lib/rake_git_crypt/tasks/unlock.rb +2 -2
- data/lib/rake_git_crypt/tasks.rb +1 -0
- data/lib/rake_git_crypt/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 67d46cbdcafb550596764ed445eae72fc7a8e690643621c41042ea5eae5368de
|
4
|
+
data.tar.gz: 86f379c9c2e690764078268b4203dbb6b610676b7ef1523f96aaa860aece6f24
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 18ef74b4cdc187ca7d72cd3feb5f492b448495cf72f5535a4c35ccec8824fbd95ef4cd36caa5abfee3d2100dc42ae6d51e03541afedc60f782c89f0367f2439f
|
7
|
+
data.tar.gz: ccfe1faca75c66a6d715259796448aafb476a5fbf1ac3e4b710a86395fe473fd58961966d52b33c31be4d309caca68f6a39cbc6d83d55ee4a11fa821bad81cf8
|
data/Gemfile.lock
CHANGED
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RakeGitCrypt
|
4
|
+
module Mixins
|
5
|
+
module Support
|
6
|
+
def task_by_name(task, name)
|
7
|
+
task.application.lookup(name, task.scope)
|
8
|
+
end
|
9
|
+
|
10
|
+
def task_defined?(task, name)
|
11
|
+
!task_by_name(task, name).nil?
|
12
|
+
end
|
13
|
+
|
14
|
+
def invoke_task_with_name(task, name, args)
|
15
|
+
task_by_name(task, name).invoke(*args)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -2,9 +2,13 @@
|
|
2
2
|
|
3
3
|
require 'rake_factory'
|
4
4
|
|
5
|
+
require_relative '../mixins/support'
|
6
|
+
|
5
7
|
module RakeGitCrypt
|
6
8
|
module Tasks
|
7
9
|
class AddUsers < RakeFactory::Task
|
10
|
+
include Mixins::Support
|
11
|
+
|
8
12
|
default_name :add_users
|
9
13
|
default_description 'Add users to git-crypt.'
|
10
14
|
|
@@ -45,31 +49,29 @@ module RakeGitCrypt
|
|
45
49
|
end
|
46
50
|
|
47
51
|
def ensure_add_user_task_present(task, user_type)
|
48
|
-
unless
|
49
|
-
|
50
|
-
!
|
52
|
+
unless add_user_task_required?(user_type) && (
|
53
|
+
add_user_task_name_missing?(user_type) ||
|
54
|
+
!add_user_task_defined?(task, user_type))
|
51
55
|
return
|
52
56
|
end
|
53
57
|
|
54
|
-
if
|
58
|
+
if add_user_task_name_missing?(user_type)
|
55
59
|
raise_add_user_task_name_missing(user_type)
|
56
60
|
else
|
57
61
|
raise_add_user_task_undefined(user_type)
|
58
62
|
end
|
59
63
|
end
|
60
64
|
|
61
|
-
def
|
65
|
+
def add_user_task_name_missing?(user_type)
|
62
66
|
send(:"add_user_by_#{user_type}_task_name").nil?
|
63
67
|
end
|
64
68
|
|
65
|
-
def
|
69
|
+
def add_user_task_required?(user_type)
|
66
70
|
gpg_user_details_present?(user_type)
|
67
71
|
end
|
68
72
|
|
69
|
-
def
|
70
|
-
|
71
|
-
.lookup(send(:"add_user_by_#{user_type}_task_name"), task.scope)
|
72
|
-
.nil?
|
73
|
+
def add_user_task_defined?(task, user_type)
|
74
|
+
task_defined?(task, send(:"add_user_by_#{user_type}_task_name"))
|
73
75
|
end
|
74
76
|
|
75
77
|
def gpg_user_details_present?(user_type)
|
@@ -0,0 +1,60 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rake_factory'
|
4
|
+
require 'ruby_git_crypt'
|
5
|
+
|
6
|
+
require_relative '../mixins/support'
|
7
|
+
|
8
|
+
module RakeGitCrypt
|
9
|
+
module Tasks
|
10
|
+
class Uninstall < RakeFactory::Task
|
11
|
+
include Mixins::Support
|
12
|
+
|
13
|
+
default_name :uninstall
|
14
|
+
default_description 'Uninstall git-crypt.'
|
15
|
+
|
16
|
+
parameter(:lock_task_name, default: :lock)
|
17
|
+
parameter(:delete_secrets_task_name)
|
18
|
+
|
19
|
+
action do |task, args|
|
20
|
+
puts('Uninstalling git-crypt...')
|
21
|
+
lock_git_crypt(task, args)
|
22
|
+
delete_git_crypt_directories
|
23
|
+
maybe_delete_secrets(task, args)
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def lock_git_crypt(task, args)
|
29
|
+
invoke_task_with_name(task, lock_task_name, args)
|
30
|
+
end
|
31
|
+
|
32
|
+
def delete_git_crypt_directories
|
33
|
+
FileUtils.rm_rf('.git-crypt')
|
34
|
+
FileUtils.rm_rf('.git/git-crypt')
|
35
|
+
end
|
36
|
+
|
37
|
+
def maybe_delete_secrets(task, args)
|
38
|
+
return unless delete_secrets_task_name
|
39
|
+
|
40
|
+
unless delete_secrets_task_defined?(task)
|
41
|
+
raise_delete_secrets_task_undefined
|
42
|
+
end
|
43
|
+
|
44
|
+
invoke_task_with_name(task, delete_secrets_task_name, args)
|
45
|
+
end
|
46
|
+
|
47
|
+
def delete_secrets_task_defined?(task)
|
48
|
+
task_defined?(task, delete_secrets_task_name)
|
49
|
+
end
|
50
|
+
|
51
|
+
def raise_delete_secrets_task_undefined
|
52
|
+
raise(
|
53
|
+
RakeFactory::DependencyTaskMissing,
|
54
|
+
'The task with name defined in delete_secrets_task_name does not ' \
|
55
|
+
'exist.'
|
56
|
+
)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -9,12 +9,12 @@ module RakeGitCrypt
|
|
9
9
|
default_name :unlock
|
10
10
|
default_description 'Unlock git-crypt.'
|
11
11
|
|
12
|
-
parameter :
|
12
|
+
parameter :key_paths
|
13
13
|
|
14
14
|
action do
|
15
15
|
puts('Unlocking git-crypt...')
|
16
16
|
RubyGitCrypt.unlock(
|
17
|
-
|
17
|
+
key_files: key_paths
|
18
18
|
)
|
19
19
|
end
|
20
20
|
end
|
data/lib/rake_git_crypt/tasks.rb
CHANGED
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.14
|
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-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colored2
|
@@ -83,12 +83,14 @@ files:
|
|
83
83
|
- bin/setup
|
84
84
|
- lib/rake_git_crypt.rb
|
85
85
|
- lib/rake_git_crypt/home.rb
|
86
|
+
- lib/rake_git_crypt/mixins/support.rb
|
86
87
|
- lib/rake_git_crypt/task_sets.rb
|
87
88
|
- lib/rake_git_crypt/tasks.rb
|
88
89
|
- lib/rake_git_crypt/tasks/add_user.rb
|
89
90
|
- lib/rake_git_crypt/tasks/add_users.rb
|
90
91
|
- lib/rake_git_crypt/tasks/init.rb
|
91
92
|
- lib/rake_git_crypt/tasks/lock.rb
|
93
|
+
- lib/rake_git_crypt/tasks/uninstall.rb
|
92
94
|
- lib/rake_git_crypt/tasks/unlock.rb
|
93
95
|
- lib/rake_git_crypt/version.rb
|
94
96
|
- rake_git_crypt.gemspec
|