ruby_git_crypt 0.1.0.pre.1 → 0.1.0.pre.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +81 -43
- data/Rakefile +57 -9
- data/lib/ruby_git_crypt/commands/add_gpg_user.rb +29 -0
- data/lib/ruby_git_crypt/commands/export_key.rb +27 -0
- data/lib/ruby_git_crypt/commands/init.rb +22 -0
- data/lib/ruby_git_crypt/commands/lock.rb +24 -0
- data/lib/ruby_git_crypt/commands/status.rb +15 -0
- data/lib/ruby_git_crypt/commands/unlock.rb +19 -0
- data/lib/ruby_git_crypt/commands.rb +5 -0
- data/lib/ruby_git_crypt/options/definition.rb +3 -3
- data/lib/ruby_git_crypt/options/definitions.rb +23 -1
- data/lib/ruby_git_crypt/options/name.rb +3 -5
- data/lib/ruby_git_crypt/version.rb +1 -1
- data/lib/ruby_git_crypt.rb +25 -0
- data/ruby_git_crypt.gemspec +2 -0
- metadata +35 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d37ab0ade0b9831210c8d11eebb0917d110016fba406c2e3dcad612baacd53ad
|
|
4
|
+
data.tar.gz: 35d6eea48374b5055841ccca1315afa9243f3b9e1e2c66917ccc86197b9891a6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 043b073e21160b9dbc21675b6ea150ca68f28cb8de3c614050aac1ab23b7c364bd074e7485ab7d51788deadd3f26289982a792ca7c7e306434e6a440cac3dd22
|
|
7
|
+
data.tar.gz: f549733d0e005631e737166a6d25585d0861bcf94c9f8fc03dbb51d0905988241d3e1c0013b81209b6fc4c0731e8d833812443197cd4fe6b36acd3885b1f1c0c
|
data/Gemfile.lock
CHANGED
|
@@ -1,37 +1,51 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
ruby_git_crypt (0.1.0.pre.
|
|
4
|
+
ruby_git_crypt (0.1.0.pre.3)
|
|
5
5
|
immutable-struct (~> 2.4)
|
|
6
6
|
lino (~> 3.0)
|
|
7
7
|
|
|
8
8
|
GEM
|
|
9
9
|
remote: https://rubygems.org/
|
|
10
10
|
specs:
|
|
11
|
-
activesupport (7.
|
|
11
|
+
activesupport (7.1.1)
|
|
12
|
+
base64
|
|
13
|
+
bigdecimal
|
|
12
14
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
15
|
+
connection_pool (>= 2.2.5)
|
|
16
|
+
drb
|
|
13
17
|
i18n (>= 1.6, < 2)
|
|
14
18
|
minitest (>= 5.1)
|
|
19
|
+
mutex_m
|
|
15
20
|
tzinfo (~> 2.0)
|
|
16
|
-
addressable (2.8.
|
|
21
|
+
addressable (2.8.5)
|
|
17
22
|
public_suffix (>= 2.0.2, < 6.0)
|
|
18
23
|
ast (2.4.2)
|
|
24
|
+
base64 (0.1.1)
|
|
25
|
+
bigdecimal (3.1.4)
|
|
19
26
|
coderay (1.1.3)
|
|
20
27
|
colored2 (3.1.2)
|
|
21
|
-
concurrent-ruby (1.
|
|
28
|
+
concurrent-ruby (1.2.2)
|
|
29
|
+
connection_pool (2.4.1)
|
|
22
30
|
diff-lcs (1.5.0)
|
|
23
31
|
docile (1.4.0)
|
|
24
|
-
|
|
25
|
-
|
|
32
|
+
drb (2.1.1)
|
|
33
|
+
ruby2_keywords
|
|
34
|
+
excon (0.104.0)
|
|
35
|
+
faker (3.2.1)
|
|
26
36
|
i18n (>= 1.8.11, < 2)
|
|
27
|
-
faraday (2.7.
|
|
37
|
+
faraday (2.7.11)
|
|
38
|
+
base64
|
|
28
39
|
faraday-net_http (>= 2.0, < 3.1)
|
|
29
40
|
ruby2_keywords (>= 0.0.4)
|
|
30
41
|
faraday-net_http (3.0.2)
|
|
31
|
-
ffi (1.
|
|
42
|
+
ffi (1.16.3)
|
|
32
43
|
formatador (1.1.0)
|
|
33
44
|
gem-release (2.2.2)
|
|
34
|
-
|
|
45
|
+
git (1.18.0)
|
|
46
|
+
addressable (~> 2.8)
|
|
47
|
+
rchardet (~> 1.8)
|
|
48
|
+
guard (2.18.1)
|
|
35
49
|
formatador (>= 0.2.4)
|
|
36
50
|
listen (>= 2.7, < 4.0)
|
|
37
51
|
lumberjack (>= 1.0.12, < 2.0)
|
|
@@ -47,44 +61,57 @@ GEM
|
|
|
47
61
|
rspec (>= 2.99.0, < 4.0)
|
|
48
62
|
hamster (3.0.0)
|
|
49
63
|
concurrent-ruby (~> 1.0)
|
|
50
|
-
i18n (1.
|
|
64
|
+
i18n (1.14.1)
|
|
51
65
|
concurrent-ruby (~> 1.0)
|
|
52
66
|
immutable-struct (2.4.1)
|
|
53
67
|
json (2.6.3)
|
|
68
|
+
language_server-protocol (3.17.0.3)
|
|
54
69
|
lino (3.1.0)
|
|
55
70
|
hamster (~> 3.0)
|
|
56
71
|
open4 (~> 1.3)
|
|
57
|
-
listen (3.
|
|
72
|
+
listen (3.8.0)
|
|
58
73
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
|
59
74
|
rb-inotify (~> 0.9, >= 0.9.10)
|
|
60
|
-
lumberjack (1.2.
|
|
75
|
+
lumberjack (1.2.9)
|
|
61
76
|
method_source (1.0.0)
|
|
62
|
-
minitest (5.
|
|
77
|
+
minitest (5.20.0)
|
|
78
|
+
mutex_m (0.1.2)
|
|
63
79
|
nenv (0.3.0)
|
|
64
80
|
notiffany (0.1.3)
|
|
65
81
|
nenv (~> 0.1)
|
|
66
82
|
shellany (~> 0.0)
|
|
67
|
-
octokit (6.
|
|
83
|
+
octokit (6.1.1)
|
|
68
84
|
faraday (>= 1, < 3)
|
|
69
85
|
sawyer (~> 0.9)
|
|
70
86
|
open4 (1.3.4)
|
|
71
|
-
parallel (1.
|
|
72
|
-
parser (3.
|
|
87
|
+
parallel (1.23.0)
|
|
88
|
+
parser (3.2.2.4)
|
|
73
89
|
ast (~> 2.4.1)
|
|
74
|
-
|
|
90
|
+
racc
|
|
91
|
+
pry (0.14.2)
|
|
75
92
|
coderay (~> 1.1)
|
|
76
93
|
method_source (~> 1.0)
|
|
77
|
-
public_suffix (5.0.
|
|
94
|
+
public_suffix (5.0.3)
|
|
95
|
+
racc (1.7.1)
|
|
78
96
|
rainbow (3.1.1)
|
|
79
|
-
rake (13.0
|
|
97
|
+
rake (13.1.0)
|
|
80
98
|
rake_circle_ci (0.11.0)
|
|
81
99
|
colored2 (~> 3.1)
|
|
82
100
|
excon (~> 0.72)
|
|
83
101
|
rake_factory (~> 0.23)
|
|
84
102
|
sshkey (~> 2.0)
|
|
85
|
-
rake_factory (0.
|
|
103
|
+
rake_factory (0.32.0.pre.2)
|
|
86
104
|
activesupport (>= 4)
|
|
87
105
|
rake (~> 13.0)
|
|
106
|
+
rake_git (0.1.0.pre.8)
|
|
107
|
+
colored2 (~> 3.1)
|
|
108
|
+
git (~> 1.13, >= 1.13.2)
|
|
109
|
+
rake_factory (= 0.32.0.pre.2)
|
|
110
|
+
rake_git_crypt (0.1.0.pre.27)
|
|
111
|
+
colored2 (~> 3.1)
|
|
112
|
+
rake_factory (= 0.32.0.pre.2)
|
|
113
|
+
ruby_git_crypt (= 0.1.0.pre.2)
|
|
114
|
+
ruby_gpg2 (~> 0.6)
|
|
88
115
|
rake_github (0.11.0)
|
|
89
116
|
colored2 (~> 3.1)
|
|
90
117
|
octokit (>= 4.16, < 7.0)
|
|
@@ -93,45 +120,53 @@ GEM
|
|
|
93
120
|
rake_gpg (0.18.0)
|
|
94
121
|
rake_factory (~> 0.23)
|
|
95
122
|
ruby_gpg2 (~> 0.6)
|
|
96
|
-
rake_ssh (0.
|
|
123
|
+
rake_ssh (0.10.0)
|
|
97
124
|
colored2 (~> 3.1)
|
|
98
125
|
rake_factory (~> 0.23)
|
|
99
126
|
sshkey (~> 2.0)
|
|
100
127
|
rb-fsevent (0.11.2)
|
|
101
128
|
rb-inotify (0.10.1)
|
|
102
129
|
ffi (~> 1.0)
|
|
103
|
-
|
|
104
|
-
|
|
130
|
+
rchardet (1.8.0)
|
|
131
|
+
regexp_parser (2.8.2)
|
|
132
|
+
rexml (3.2.6)
|
|
105
133
|
rspec (3.12.0)
|
|
106
134
|
rspec-core (~> 3.12.0)
|
|
107
135
|
rspec-expectations (~> 3.12.0)
|
|
108
136
|
rspec-mocks (~> 3.12.0)
|
|
109
|
-
rspec-core (3.12.
|
|
137
|
+
rspec-core (3.12.2)
|
|
110
138
|
rspec-support (~> 3.12.0)
|
|
111
|
-
rspec-expectations (3.12.
|
|
139
|
+
rspec-expectations (3.12.3)
|
|
112
140
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
113
141
|
rspec-support (~> 3.12.0)
|
|
114
|
-
rspec-mocks (3.12.
|
|
142
|
+
rspec-mocks (3.12.6)
|
|
115
143
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
116
144
|
rspec-support (~> 3.12.0)
|
|
117
|
-
rspec-support (3.12.
|
|
118
|
-
rubocop (1.
|
|
145
|
+
rspec-support (3.12.1)
|
|
146
|
+
rubocop (1.57.2)
|
|
119
147
|
json (~> 2.3)
|
|
148
|
+
language_server-protocol (>= 3.17.0)
|
|
120
149
|
parallel (~> 1.10)
|
|
121
|
-
parser (>= 3.
|
|
150
|
+
parser (>= 3.2.2.4)
|
|
122
151
|
rainbow (>= 2.2.2, < 4.0)
|
|
123
152
|
regexp_parser (>= 1.8, < 3.0)
|
|
124
153
|
rexml (>= 3.2.5, < 4.0)
|
|
125
|
-
rubocop-ast (>= 1.
|
|
154
|
+
rubocop-ast (>= 1.28.1, < 2.0)
|
|
126
155
|
ruby-progressbar (~> 1.7)
|
|
127
|
-
unicode-display_width (>=
|
|
128
|
-
rubocop-ast (1.
|
|
129
|
-
parser (>= 3.
|
|
156
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
|
157
|
+
rubocop-ast (1.30.0)
|
|
158
|
+
parser (>= 3.2.1.0)
|
|
159
|
+
rubocop-capybara (2.19.0)
|
|
160
|
+
rubocop (~> 1.41)
|
|
161
|
+
rubocop-factory_bot (2.24.0)
|
|
162
|
+
rubocop (~> 1.33)
|
|
130
163
|
rubocop-rake (0.6.0)
|
|
131
164
|
rubocop (~> 1.0)
|
|
132
|
-
rubocop-rspec (2.
|
|
133
|
-
rubocop (~> 1.
|
|
134
|
-
|
|
165
|
+
rubocop-rspec (2.25.0)
|
|
166
|
+
rubocop (~> 1.40)
|
|
167
|
+
rubocop-capybara (~> 2.17)
|
|
168
|
+
rubocop-factory_bot (~> 2.22)
|
|
169
|
+
ruby-progressbar (1.13.0)
|
|
135
170
|
ruby2_keywords (0.0.5)
|
|
136
171
|
ruby_gpg2 (0.10.0)
|
|
137
172
|
lino (~> 3.0)
|
|
@@ -147,18 +182,19 @@ GEM
|
|
|
147
182
|
simplecov_json_formatter (0.1.4)
|
|
148
183
|
sshkey (2.0.0)
|
|
149
184
|
terminal-notifier-guard (1.7.0)
|
|
150
|
-
thor (1.
|
|
151
|
-
tzinfo (2.0.
|
|
185
|
+
thor (1.3.0)
|
|
186
|
+
tzinfo (2.0.6)
|
|
152
187
|
concurrent-ruby (~> 1.0)
|
|
153
|
-
unicode-display_width (2.
|
|
154
|
-
|
|
155
|
-
yard (0.9.28)
|
|
156
|
-
webrick (~> 1.7.0)
|
|
188
|
+
unicode-display_width (2.5.0)
|
|
189
|
+
yard (0.9.34)
|
|
157
190
|
|
|
158
191
|
PLATFORMS
|
|
159
192
|
arm64-darwin-21
|
|
193
|
+
arm64-darwin-22
|
|
160
194
|
ruby
|
|
161
195
|
x86_64-darwin-19
|
|
196
|
+
x86_64-darwin-20
|
|
197
|
+
x86_64-darwin-21
|
|
162
198
|
x86_64-linux
|
|
163
199
|
|
|
164
200
|
DEPENDENCIES
|
|
@@ -169,6 +205,8 @@ DEPENDENCIES
|
|
|
169
205
|
guard-rspec
|
|
170
206
|
rake
|
|
171
207
|
rake_circle_ci
|
|
208
|
+
rake_git
|
|
209
|
+
rake_git_crypt
|
|
172
210
|
rake_github
|
|
173
211
|
rake_gpg
|
|
174
212
|
rake_ssh
|
|
@@ -182,4 +220,4 @@ DEPENDENCIES
|
|
|
182
220
|
yard
|
|
183
221
|
|
|
184
222
|
BUNDLED WITH
|
|
185
|
-
2.4.
|
|
223
|
+
2.4.17
|
data/Rakefile
CHANGED
|
@@ -1,20 +1,45 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require 'yaml'
|
|
4
|
-
require 'yard'
|
|
5
3
|
require 'rake_circle_ci'
|
|
4
|
+
require 'rake_git'
|
|
5
|
+
require 'rake_git_crypt'
|
|
6
6
|
require 'rake_github'
|
|
7
|
-
require 'rake_ssh'
|
|
8
7
|
require 'rake_gpg'
|
|
9
|
-
require '
|
|
8
|
+
require 'rake_ssh'
|
|
10
9
|
require 'rspec/core/rake_task'
|
|
11
10
|
require 'rubocop/rake_task'
|
|
11
|
+
require 'securerandom'
|
|
12
|
+
require 'yaml'
|
|
13
|
+
require 'yard'
|
|
12
14
|
|
|
13
15
|
task default: %i[
|
|
14
16
|
library:fix
|
|
15
17
|
test:unit
|
|
16
18
|
]
|
|
17
19
|
|
|
20
|
+
RakeGitCrypt.define_standard_tasks(
|
|
21
|
+
namespace: :git_crypt,
|
|
22
|
+
|
|
23
|
+
provision_secrets_task_name: :'secrets:provision',
|
|
24
|
+
destroy_secrets_task_name: :'secrets:destroy',
|
|
25
|
+
|
|
26
|
+
install_commit_task_name: :'git:commit',
|
|
27
|
+
uninstall_commit_task_name: :'git:commit',
|
|
28
|
+
|
|
29
|
+
gpg_user_key_paths: %w[
|
|
30
|
+
config/gpg
|
|
31
|
+
config/secrets/ci/gpg.public
|
|
32
|
+
]
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
namespace :git do
|
|
36
|
+
RakeGit.define_commit_task(
|
|
37
|
+
argument_names: [:message]
|
|
38
|
+
) do |t, args|
|
|
39
|
+
t.message = args.message
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
18
43
|
namespace :encryption do
|
|
19
44
|
namespace :directory do
|
|
20
45
|
desc 'Ensure CI secrets directory exists.'
|
|
@@ -24,10 +49,12 @@ namespace :encryption do
|
|
|
24
49
|
end
|
|
25
50
|
|
|
26
51
|
namespace :passphrase do
|
|
27
|
-
desc 'Generate encryption passphrase
|
|
52
|
+
desc 'Generate encryption passphrase for CI GPG key'
|
|
28
53
|
task generate: ['directory:ensure'] do
|
|
29
|
-
File.write(
|
|
30
|
-
|
|
54
|
+
File.write(
|
|
55
|
+
'config/secrets/ci/encryption.passphrase',
|
|
56
|
+
SecureRandom.base64(36)
|
|
57
|
+
)
|
|
31
58
|
end
|
|
32
59
|
end
|
|
33
60
|
end
|
|
@@ -52,12 +79,33 @@ namespace :keys do
|
|
|
52
79
|
end
|
|
53
80
|
|
|
54
81
|
namespace :secrets do
|
|
55
|
-
|
|
56
|
-
|
|
82
|
+
namespace :directory do
|
|
83
|
+
desc 'Ensure secrets directory exists and is set up correctly'
|
|
84
|
+
task :ensure do
|
|
85
|
+
FileUtils.mkdir_p('config/secrets')
|
|
86
|
+
unless File.exist?('config/secrets/.unlocked')
|
|
87
|
+
File.write('config/secrets/.unlocked', 'true')
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
desc 'Generate all generatable secrets.'
|
|
93
|
+
task generate: %w[
|
|
57
94
|
encryption:passphrase:generate
|
|
58
95
|
keys:deploy:generate
|
|
59
96
|
keys:gpg:generate
|
|
60
97
|
]
|
|
98
|
+
|
|
99
|
+
desc 'Provision all secrets.'
|
|
100
|
+
task provision: [:generate]
|
|
101
|
+
|
|
102
|
+
desc 'Delete all secrets.'
|
|
103
|
+
task :destroy do
|
|
104
|
+
rm_rf 'config/secrets'
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
desc 'Rotate all secrets.'
|
|
108
|
+
task rotate: [:'git_crypt:reinstall']
|
|
61
109
|
end
|
|
62
110
|
|
|
63
111
|
RuboCop::RakeTask.new
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative 'base'
|
|
4
|
+
|
|
5
|
+
module RubyGitCrypt
|
|
6
|
+
module Commands
|
|
7
|
+
class AddGPGUser < Base
|
|
8
|
+
# @!visibility private
|
|
9
|
+
def subcommands
|
|
10
|
+
%w[add-gpg-user]
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# @!visibility private
|
|
14
|
+
def options
|
|
15
|
+
super +
|
|
16
|
+
%w[
|
|
17
|
+
--key-name
|
|
18
|
+
--no-commit
|
|
19
|
+
--trusted
|
|
20
|
+
]
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# @!visibility private
|
|
24
|
+
def arguments(parameters)
|
|
25
|
+
[parameters[:gpg_user_id]]
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative 'base'
|
|
4
|
+
|
|
5
|
+
module RubyGitCrypt
|
|
6
|
+
module Commands
|
|
7
|
+
class ExportKey < Base
|
|
8
|
+
# @!visibility private
|
|
9
|
+
def subcommands
|
|
10
|
+
%w[export-key]
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# @!visibility private
|
|
14
|
+
def options
|
|
15
|
+
super +
|
|
16
|
+
%w[
|
|
17
|
+
--key-name
|
|
18
|
+
]
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# @!visibility private
|
|
22
|
+
def arguments(parameters)
|
|
23
|
+
[parameters[:filename]]
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative 'base'
|
|
4
|
+
|
|
5
|
+
module RubyGitCrypt
|
|
6
|
+
module Commands
|
|
7
|
+
class Init < Base
|
|
8
|
+
# @!visibility private
|
|
9
|
+
def subcommands
|
|
10
|
+
%w[init]
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# @!visibility private
|
|
14
|
+
def options
|
|
15
|
+
super +
|
|
16
|
+
%w[
|
|
17
|
+
--key-name
|
|
18
|
+
]
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative 'base'
|
|
4
|
+
|
|
5
|
+
module RubyGitCrypt
|
|
6
|
+
module Commands
|
|
7
|
+
class Lock < Base
|
|
8
|
+
# @!visibility private
|
|
9
|
+
def subcommands
|
|
10
|
+
%w[lock]
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# @!visibility private
|
|
14
|
+
def options
|
|
15
|
+
super +
|
|
16
|
+
%w[
|
|
17
|
+
--all
|
|
18
|
+
--force
|
|
19
|
+
--key-name
|
|
20
|
+
]
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -9,6 +9,21 @@ module RubyGitCrypt
|
|
|
9
9
|
def subcommands
|
|
10
10
|
%w[status]
|
|
11
11
|
end
|
|
12
|
+
|
|
13
|
+
# @!visibility private
|
|
14
|
+
def options
|
|
15
|
+
super +
|
|
16
|
+
%w[
|
|
17
|
+
-e
|
|
18
|
+
-u
|
|
19
|
+
--fix
|
|
20
|
+
]
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# @!visibility private
|
|
24
|
+
def arguments(parameters)
|
|
25
|
+
[parameters[:files]]
|
|
26
|
+
end
|
|
12
27
|
end
|
|
13
28
|
end
|
|
14
29
|
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative 'base'
|
|
4
|
+
|
|
5
|
+
module RubyGitCrypt
|
|
6
|
+
module Commands
|
|
7
|
+
class Unlock < Base
|
|
8
|
+
# @!visibility private
|
|
9
|
+
def subcommands
|
|
10
|
+
%w[unlock]
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# @!visibility private
|
|
14
|
+
def arguments(parameters)
|
|
15
|
+
[parameters[:key_files]]
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require_relative 'commands/init'
|
|
3
4
|
require_relative 'commands/status'
|
|
5
|
+
require_relative 'commands/lock'
|
|
6
|
+
require_relative 'commands/unlock'
|
|
7
|
+
require_relative 'commands/export_key'
|
|
8
|
+
require_relative 'commands/add_gpg_user'
|
|
4
9
|
|
|
5
10
|
module RubyGitCrypt
|
|
6
11
|
module Commands
|
|
@@ -2,6 +2,28 @@
|
|
|
2
2
|
|
|
3
3
|
module RubyGitCrypt
|
|
4
4
|
module Options
|
|
5
|
-
DEFINITIONS = [
|
|
5
|
+
DEFINITIONS = [
|
|
6
|
+
# flag options
|
|
7
|
+
definition(name: '-e', option_type: :flag, value_type: :boolean,
|
|
8
|
+
override_keys: { singular: :encrypted_only }),
|
|
9
|
+
definition(name: '-u', option_type: :flag, value_type: :boolean,
|
|
10
|
+
override_keys: { singular: :unencrypted_only }),
|
|
11
|
+
%w[
|
|
12
|
+
--all
|
|
13
|
+
--fix
|
|
14
|
+
--force
|
|
15
|
+
--no-commit
|
|
16
|
+
--trusted
|
|
17
|
+
].map do |o|
|
|
18
|
+
definition(name: o, option_type: :flag, value_type: :boolean)
|
|
19
|
+
end,
|
|
20
|
+
|
|
21
|
+
# string options
|
|
22
|
+
%w[
|
|
23
|
+
--key-name
|
|
24
|
+
].map do |o|
|
|
25
|
+
definition(name: o, option_type: :standard, value_type: :string)
|
|
26
|
+
end
|
|
27
|
+
].flatten.freeze
|
|
6
28
|
end
|
|
7
29
|
end
|
|
@@ -4,15 +4,13 @@ require 'immutable-struct'
|
|
|
4
4
|
|
|
5
5
|
module RubyGitCrypt
|
|
6
6
|
module Options
|
|
7
|
-
class Name < ImmutableStruct.new(:name)
|
|
7
|
+
class Name < ImmutableStruct.new(:name, :prefix)
|
|
8
|
+
attr_reader :name
|
|
9
|
+
|
|
8
10
|
def initialize(name)
|
|
9
11
|
super(name: name.to_s)
|
|
10
12
|
end
|
|
11
13
|
|
|
12
|
-
def name
|
|
13
|
-
"--#{without_prefix}"
|
|
14
|
-
end
|
|
15
|
-
|
|
16
14
|
alias to_s name
|
|
17
15
|
|
|
18
16
|
def as_singular_key
|
data/lib/ruby_git_crypt.rb
CHANGED
|
@@ -21,11 +21,36 @@ module RubyGitCrypt
|
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
module ClassMethods
|
|
24
|
+
def add_gpg_user(parameters = {}, invocation_options = {})
|
|
25
|
+
exec(RubyGitCrypt::Commands::AddGPGUser,
|
|
26
|
+
parameters, invocation_options)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def export_key(parameters = {}, invocation_options = {})
|
|
30
|
+
exec(RubyGitCrypt::Commands::ExportKey,
|
|
31
|
+
parameters, invocation_options)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def init(parameters = {}, invocation_options = {})
|
|
35
|
+
exec(RubyGitCrypt::Commands::Init,
|
|
36
|
+
parameters, invocation_options)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def lock(parameters = {}, invocation_options = {})
|
|
40
|
+
exec(RubyGitCrypt::Commands::Lock,
|
|
41
|
+
parameters, invocation_options)
|
|
42
|
+
end
|
|
43
|
+
|
|
24
44
|
def status(parameters = {}, invocation_options = {})
|
|
25
45
|
exec(RubyGitCrypt::Commands::Status,
|
|
26
46
|
parameters, invocation_options)
|
|
27
47
|
end
|
|
28
48
|
|
|
49
|
+
def unlock(parameters = {}, invocation_options = {})
|
|
50
|
+
exec(RubyGitCrypt::Commands::Unlock,
|
|
51
|
+
parameters, invocation_options)
|
|
52
|
+
end
|
|
53
|
+
|
|
29
54
|
private
|
|
30
55
|
|
|
31
56
|
def exec(command_class, parameters, invocation_options)
|
data/ruby_git_crypt.gemspec
CHANGED
|
@@ -48,6 +48,8 @@ Gem::Specification.new do |spec|
|
|
|
48
48
|
spec.add_development_dependency 'guard-rspec'
|
|
49
49
|
spec.add_development_dependency 'rake'
|
|
50
50
|
spec.add_development_dependency 'rake_circle_ci'
|
|
51
|
+
spec.add_development_dependency 'rake_git'
|
|
52
|
+
spec.add_development_dependency 'rake_git_crypt'
|
|
51
53
|
spec.add_development_dependency 'rake_github'
|
|
52
54
|
spec.add_development_dependency 'rake_gpg'
|
|
53
55
|
spec.add_development_dependency 'rake_ssh'
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ruby_git_crypt
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.0.pre.
|
|
4
|
+
version: 0.1.0.pre.3
|
|
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-
|
|
11
|
+
date: 2023-10-29 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: immutable-struct
|
|
@@ -136,6 +136,34 @@ dependencies:
|
|
|
136
136
|
- - ">="
|
|
137
137
|
- !ruby/object:Gem::Version
|
|
138
138
|
version: '0'
|
|
139
|
+
- !ruby/object:Gem::Dependency
|
|
140
|
+
name: rake_git
|
|
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_git_crypt
|
|
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'
|
|
139
167
|
- !ruby/object:Gem::Dependency
|
|
140
168
|
name: rake_github
|
|
141
169
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -294,8 +322,13 @@ files:
|
|
|
294
322
|
- bin/setup
|
|
295
323
|
- lib/ruby_git_crypt.rb
|
|
296
324
|
- lib/ruby_git_crypt/commands.rb
|
|
325
|
+
- lib/ruby_git_crypt/commands/add_gpg_user.rb
|
|
297
326
|
- lib/ruby_git_crypt/commands/base.rb
|
|
327
|
+
- lib/ruby_git_crypt/commands/export_key.rb
|
|
328
|
+
- lib/ruby_git_crypt/commands/init.rb
|
|
329
|
+
- lib/ruby_git_crypt/commands/lock.rb
|
|
298
330
|
- lib/ruby_git_crypt/commands/status.rb
|
|
331
|
+
- lib/ruby_git_crypt/commands/unlock.rb
|
|
299
332
|
- lib/ruby_git_crypt/errors.rb
|
|
300
333
|
- lib/ruby_git_crypt/errors/execution_error.rb
|
|
301
334
|
- lib/ruby_git_crypt/options.rb
|