ruby_gpg2 0.9.0.pre.4 → 0.9.0.pre.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +2 -0
  3. data/Gemfile.lock +37 -2
  4. data/LICENSE.txt +1 -1
  5. data/Rakefile +83 -46
  6. data/bin/console +4 -3
  7. data/lib/ruby_gpg2/colon_output.rb +61 -42
  8. data/lib/ruby_gpg2/colon_record.rb +257 -222
  9. data/lib/ruby_gpg2/commands/base.rb +9 -13
  10. data/lib/ruby_gpg2/commands/decrypt.rb +3 -2
  11. data/lib/ruby_gpg2/commands/encrypt.rb +3 -2
  12. data/lib/ruby_gpg2/commands/export.rb +2 -0
  13. data/lib/ruby_gpg2/commands/export_secret_keys.rb +2 -0
  14. data/lib/ruby_gpg2/commands/generate_key.rb +5 -1
  15. data/lib/ruby_gpg2/commands/import.rb +2 -0
  16. data/lib/ruby_gpg2/commands/list_public_keys.rb +3 -2
  17. data/lib/ruby_gpg2/commands/list_secret_keys.rb +3 -2
  18. data/lib/ruby_gpg2/commands/mixins/armor_config.rb +2 -0
  19. data/lib/ruby_gpg2/commands/mixins/batch_config.rb +2 -0
  20. data/lib/ruby_gpg2/commands/mixins/colon_config.rb +2 -0
  21. data/lib/ruby_gpg2/commands/mixins/global_config.rb +7 -2
  22. data/lib/ruby_gpg2/commands/mixins/input_config.rb +2 -0
  23. data/lib/ruby_gpg2/commands/mixins/output_config.rb +7 -2
  24. data/lib/ruby_gpg2/commands/mixins/passphrase_config.rb +7 -2
  25. data/lib/ruby_gpg2/commands/mixins/pinentry_config.rb +7 -2
  26. data/lib/ruby_gpg2/commands/mixins/recipient_config.rb +7 -2
  27. data/lib/ruby_gpg2/commands/mixins/status_config.rb +7 -2
  28. data/lib/ruby_gpg2/commands/mixins/trust_mode_config.rb +7 -2
  29. data/lib/ruby_gpg2/commands/mixins/with_captured_output.rb +10 -5
  30. data/lib/ruby_gpg2/commands/mixins/with_captured_status.rb +11 -7
  31. data/lib/ruby_gpg2/commands/mixins/with_result.rb +2 -0
  32. data/lib/ruby_gpg2/commands/mixins/without_passphrase.rb +8 -3
  33. data/lib/ruby_gpg2/commands/result.rb +3 -3
  34. data/lib/ruby_gpg2/commands.rb +3 -2
  35. data/lib/ruby_gpg2/key.rb +34 -25
  36. data/lib/ruby_gpg2/parameter_file_contents.rb +101 -51
  37. data/lib/ruby_gpg2/status_line.rb +15 -12
  38. data/lib/ruby_gpg2/status_lines/import_ok.rb +29 -25
  39. data/lib/ruby_gpg2/status_lines/import_problem.rb +19 -15
  40. data/lib/ruby_gpg2/status_lines/imported.rb +13 -9
  41. data/lib/ruby_gpg2/status_lines/key_considered.rb +18 -14
  42. data/lib/ruby_gpg2/status_lines/key_created.rb +20 -16
  43. data/lib/ruby_gpg2/status_lines/unimplemented.rb +6 -3
  44. data/lib/ruby_gpg2/status_lines.rb +2 -1
  45. data/lib/ruby_gpg2/status_output.rb +2 -0
  46. data/lib/ruby_gpg2/user_id.rb +19 -16
  47. data/lib/ruby_gpg2/version.rb +3 -1
  48. data/lib/ruby_gpg2.rb +2 -0
  49. data/ruby_gpg2.gemspec +55 -0
  50. metadata +64 -6
@@ -1,154 +1,129 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'date'
2
4
 
3
5
  module RubyGPG2
6
+ # rubocop:disable Metrics/ClassLength
4
7
  class ColonRecord
5
- USER_ID_REGEX = /^(.*?) (?:\((.*)\) )?<(.*)>$/
8
+ USER_ID_REGEX = /^(.*?) (?:\((.*)\) )?<(.*)>$/.freeze
6
9
 
7
10
  TYPES = {
8
- 'pub' => :public_key,
9
- 'crt' => :x509_certificate,
10
- 'crs' => :x509_certificate_and_private_key,
11
- 'sub' => :sub_key,
12
- 'sec' => :secret_key,
13
- 'ssb' => :secret_sub_key,
14
- 'uid' => :user_id,
15
- 'uat' => :user_attribute,
16
- 'sig' => :signature,
17
- 'rev' => :revocation_signature,
18
- 'rvs' => :standalone_revocation_signature,
19
- 'fpr' => :fingerprint,
20
- 'pkd' => :public_key_data,
21
- 'grp' => :key_grip,
22
- 'rvk' => :revocation_key,
23
- 'tfs' => :tofu_statistics,
24
- 'tru' => :trust_database_information,
25
- 'spk' => :signature_sub_packet,
26
- 'cfg' => :configuration_data
27
- }
11
+ 'pub' => :public_key,
12
+ 'crt' => :x509_certificate,
13
+ 'crs' => :x509_certificate_and_private_key,
14
+ 'sub' => :sub_key,
15
+ 'sec' => :secret_key,
16
+ 'ssb' => :secret_sub_key,
17
+ 'uid' => :user_id,
18
+ 'uat' => :user_attribute,
19
+ 'sig' => :signature,
20
+ 'rev' => :revocation_signature,
21
+ 'rvs' => :standalone_revocation_signature,
22
+ 'fpr' => :fingerprint,
23
+ 'pkd' => :public_key_data,
24
+ 'grp' => :key_grip,
25
+ 'rvk' => :revocation_key,
26
+ 'tfs' => :tofu_statistics,
27
+ 'tru' => :trust_database_information,
28
+ 'spk' => :signature_sub_packet,
29
+ 'cfg' => :configuration_data
30
+ }.freeze
28
31
 
29
32
  TRUST_MODELS = {
30
- '0' => :classic,
31
- '1' => :pgp
32
- }
33
+ '0' => :classic,
34
+ '1' => :pgp
35
+ }.freeze
33
36
 
34
37
  VALIDITIES = {
35
- 'o' => :unknown_new_key,
36
- 'i' => :invalid,
37
- 'd' => :disabled,
38
- 'r' => :revoked,
39
- 'e' => :expired,
40
- '-' => :unknown,
41
- 'q' => :undefined,
42
- 'n' => :never,
43
- 'm' => :marginal,
44
- 'f' => :full,
45
- 'u' => :ultimate,
46
- 'w' => :well_known_private,
47
- 's' => :special
48
- }
38
+ 'o' => :unknown_new_key,
39
+ 'i' => :invalid,
40
+ 'd' => :disabled,
41
+ 'r' => :revoked,
42
+ 'e' => :expired,
43
+ '-' => :unknown,
44
+ 'q' => :undefined,
45
+ 'n' => :never,
46
+ 'm' => :marginal,
47
+ 'f' => :full,
48
+ 'u' => :ultimate,
49
+ 'w' => :well_known_private,
50
+ 's' => :special
51
+ }.freeze
49
52
 
50
53
  KEY_ALGORITHMS = {
51
- '1' => :rsa_encrypt_or_sign,
52
- '2' => :rsa_encrypt_only,
53
- '3' => :rsa_sign_only,
54
- '16' => :elgamal_encrypt_only,
55
- '17' => :dsa,
56
- '18' => :ecdh,
57
- '19' => :ecdsa,
58
- }
54
+ '1' => :rsa_encrypt_or_sign,
55
+ '2' => :rsa_encrypt_only,
56
+ '3' => :rsa_sign_only,
57
+ '16' => :elgamal_encrypt_only,
58
+ '17' => :dsa,
59
+ '18' => :ecdh,
60
+ '19' => :ecdsa
61
+ }.freeze
59
62
 
60
63
  TRUSTS = {
61
- '-' => :unknown,
62
- 'n' => :never,
63
- 'm' => :marginal,
64
- 'f' => :full,
65
- 'u' => :ultimate,
66
- }
64
+ '-' => :unknown,
65
+ 'n' => :never,
66
+ 'm' => :marginal,
67
+ 'f' => :full,
68
+ 'u' => :ultimate
69
+ }.freeze
67
70
 
68
71
  KEY_CAPABILITIES = {
69
- 'e' => :encrypt,
70
- 's' => :sign,
71
- 'c' => :certify,
72
- 'a' => :authenticate,
73
- 'E' => :primary_encrypt,
74
- 'S' => :primary_sign,
75
- 'C' => :primary_certify,
76
- 'A' => :primary_authenticate,
77
- '?' => :unknown
78
- }
72
+ 'e' => :encrypt,
73
+ 's' => :sign,
74
+ 'c' => :certify,
75
+ 'a' => :authenticate,
76
+ 'E' => :primary_encrypt,
77
+ 'S' => :primary_sign,
78
+ 'C' => :primary_certify,
79
+ 'A' => :primary_authenticate,
80
+ '?' => :unknown
81
+ }.freeze
79
82
 
80
83
  COMPLIANCE_MODES = {
81
- '8' => :rfc_4880bis,
82
- '23' => :de_vs,
83
- '6001' => :roca_screening_hit
84
- }
84
+ '8' => :rfc_4880bis,
85
+ '23' => :de_vs,
86
+ '6001' => :roca_screening_hit
87
+ }.freeze
85
88
 
86
89
  def self.parse(record)
87
90
  fields = record.split(':', 22)
88
91
  type = type(fields[0])
89
- case type
90
- when :trust_database_information
91
- new(
92
- raw: record,
93
- type: type,
94
- trust_model: trust_model(fields[2]),
95
- creation_date: creation_date(fields[3]),
96
- expiration_date: expiration_date(fields[4]),
97
- new_key_signer_marginal_count:
98
- new_key_signer_marginal_count(fields[5]),
99
- new_key_signer_complete_count:
100
- new_key_signer_complete_count(fields[6]),
101
- maximum_certificate_chain_depth:
102
- maximum_certificate_chain_depth(fields[7]))
92
+ if trust_base_record?(type)
93
+ make_trust_base_record(record, type, fields)
103
94
  else
104
- new(
105
- raw: record,
106
- type: type,
107
- validity: validity(fields[1]),
108
- key_length: key_length(fields[2]),
109
- key_algorithm: key_algorithm(fields[3]),
110
- key_id: key_id(fields[4]),
111
- creation_date: creation_date(fields[5]),
112
- expiration_date: expiration_date(fields[6]),
113
- user_id_hash: user_id_hash(type, fields[7]),
114
- owner_trust: owner_trust(fields[8]),
115
- fingerprint: fingerprint(type, fields[9]),
116
- key_grip: key_grip(type, fields[9]),
117
- user_id: user_id(type, fields[9]),
118
- signature_class: signature_class(fields[10]),
119
- key_capabilities: key_capabilities(fields[11]),
120
- serial_number: serial_number(fields[14]),
121
- compliance_modes: compliance_modes(fields[17]),
122
- last_update: last_update(fields[18]),
123
- origin: origin(fields[19]))
95
+ make_standard_record(record, type, fields)
124
96
  end
125
97
  end
126
98
 
127
99
  attr_reader(
128
- :raw,
129
- :type,
130
- :trust_model,
131
- :validity,
132
- :key_length,
133
- :key_algorithm,
134
- :key_id,
135
- :creation_date,
136
- :expiration_date,
137
- :user_id_hash,
138
- :owner_trust,
139
- :fingerprint,
140
- :key_grip,
141
- :user_id,
142
- :signature_class,
143
- :key_capabilities,
144
- :serial_number,
145
- :compliance_modes,
146
- :last_update,
147
- :origin,
148
- :new_key_signer_marginal_count,
149
- :new_key_signer_complete_count,
150
- :maximum_certificate_chain_depth)
151
-
100
+ :raw,
101
+ :type,
102
+ :trust_model,
103
+ :validity,
104
+ :key_length,
105
+ :key_algorithm,
106
+ :key_id,
107
+ :creation_date,
108
+ :expiration_date,
109
+ :user_id_hash,
110
+ :owner_trust,
111
+ :fingerprint,
112
+ :key_grip,
113
+ :user_id,
114
+ :signature_class,
115
+ :key_capabilities,
116
+ :serial_number,
117
+ :compliance_modes,
118
+ :last_update,
119
+ :origin,
120
+ :new_key_signer_marginal_count,
121
+ :new_key_signer_complete_count,
122
+ :maximum_certificate_chain_depth
123
+ )
124
+
125
+ # rubocop:disable Metrics/MethodLength
126
+ # rubocop:disable Metrics/AbcSize
152
127
  def initialize(opts)
153
128
  @raw = opts[:raw]
154
129
  @type = opts[:type]
@@ -174,6 +149,8 @@ module RubyGPG2
174
149
  @new_key_signer_complete_count = opts[:new_key_signer_complete_count]
175
150
  @maximum_certificate_chain_depth = opts[:maximum_certificate_chain_depth]
176
151
  end
152
+ # rubocop:enable Metrics/AbcSize
153
+ # rubocop:enable Metrics/MethodLength
177
154
 
178
155
  def fingerprint_record?
179
156
  type == :fingerprint
@@ -184,21 +161,24 @@ module RubyGPG2
184
161
  end
185
162
 
186
163
  def user_name
187
- if (match = user_id&.match(USER_ID_REGEX))
188
- match[1]
189
- end
164
+ match = user_id&.match(USER_ID_REGEX)
165
+ return unless match
166
+
167
+ match[1]
190
168
  end
191
169
 
192
170
  def user_comment
193
- if (match = user_id&.match(USER_ID_REGEX))
194
- match[2]
195
- end
171
+ match = user_id&.match(USER_ID_REGEX)
172
+ return unless match
173
+
174
+ match[2]
196
175
  end
197
176
 
198
177
  def user_email
199
- if (match = user_id&.match(USER_ID_REGEX))
200
- match[3]
201
- end
178
+ match = user_id&.match(USER_ID_REGEX)
179
+ return unless match
180
+
181
+ match[3]
202
182
  end
203
183
 
204
184
  def ==(other)
@@ -207,124 +187,179 @@ module RubyGPG2
207
187
 
208
188
  protected
209
189
 
190
+ # rubocop:disable Metrics/MethodLength
210
191
  def state
211
192
  [
212
- @raw,
213
- @type,
214
- @trust_model,
215
- @validity,
216
- @key_length,
217
- @key_algorithm,
218
- @key_id,
219
- @creation_date,
220
- @expiration_date,
221
- @user_id_hash,
222
- @owner_trust,
223
- @fingerprint,
224
- @key_grip,
225
- @user_id,
226
- @signature_class,
227
- @key_capabilities,
228
- @serial_number,
229
- @compliance_modes,
230
- @last_update,
231
- @origin,
232
- @new_key_signer_marginal_count,
233
- @new_key_signer_complete_count,
234
- @maximum_certificate_chain_depth
193
+ @raw,
194
+ @type,
195
+ @trust_model,
196
+ @validity,
197
+ @key_length,
198
+ @key_algorithm,
199
+ @key_id,
200
+ @creation_date,
201
+ @expiration_date,
202
+ @user_id_hash,
203
+ @owner_trust,
204
+ @fingerprint,
205
+ @key_grip,
206
+ @user_id,
207
+ @signature_class,
208
+ @key_capabilities,
209
+ @serial_number,
210
+ @compliance_modes,
211
+ @last_update,
212
+ @origin,
213
+ @new_key_signer_marginal_count,
214
+ @new_key_signer_complete_count,
215
+ @maximum_certificate_chain_depth
235
216
  ]
236
217
  end
218
+ # rubocop:enable Metrics/MethodLength
237
219
 
238
- private
220
+ class << self
221
+ protected
239
222
 
240
- def self.type(value)
241
- TYPES[value]
242
- end
223
+ # rubocop:disable Metrics/MethodLength
224
+ # rubocop:disable Metrics/AbcSize
225
+ def make_standard_record(record, type, fields)
226
+ new(
227
+ raw: record,
228
+ type: type,
229
+ validity: validity(fields[1]),
230
+ key_length: key_length(fields[2]),
231
+ key_algorithm: key_algorithm(fields[3]),
232
+ key_id: key_id(fields[4]),
233
+ creation_date: creation_date(fields[5]),
234
+ expiration_date: expiration_date(fields[6]),
235
+ user_id_hash: user_id_hash(type, fields[7]),
236
+ owner_trust: owner_trust(fields[8]),
237
+ fingerprint: fingerprint(type, fields[9]),
238
+ key_grip: key_grip(type, fields[9]),
239
+ user_id: user_id(type, fields[9]),
240
+ signature_class: signature_class(fields[10]),
241
+ key_capabilities: key_capabilities(fields[11]),
242
+ serial_number: serial_number(fields[14]),
243
+ compliance_modes: compliance_modes(fields[17]),
244
+ last_update: last_update(fields[18]),
245
+ origin: origin(fields[19])
246
+ )
247
+ end
248
+ # rubocop:enable Metrics/AbcSize
249
+ # rubocop:enable Metrics/MethodLength
243
250
 
244
- def self.trust_model(value)
245
- TRUST_MODELS[value]
246
- end
251
+ # rubocop:disable Metrics/MethodLength
252
+ def make_trust_base_record(record, type, fields)
253
+ new(
254
+ raw: record,
255
+ type: type,
256
+ trust_model: trust_model(fields[2]),
257
+ creation_date: creation_date(fields[3]),
258
+ expiration_date: expiration_date(fields[4]),
259
+ new_key_signer_marginal_count:
260
+ new_key_signer_marginal_count(fields[5]),
261
+ new_key_signer_complete_count:
262
+ new_key_signer_complete_count(fields[6]),
263
+ maximum_certificate_chain_depth:
264
+ maximum_certificate_chain_depth(fields[7])
265
+ )
266
+ end
267
+ # rubocop:enable Metrics/MethodLength
247
268
 
248
- def self.validity(value)
249
- VALIDITIES[value]
250
- end
269
+ def trust_base_record?(type)
270
+ type == :trust_database_information
271
+ end
251
272
 
252
- def self.key_length(value)
253
- value =~ /\d+/ ? value.to_s.to_i : nil
254
- end
273
+ def type(value)
274
+ TYPES[value]
275
+ end
255
276
 
256
- def self.key_algorithm(value)
257
- KEY_ALGORITHMS[value]
258
- end
277
+ def trust_model(value)
278
+ TRUST_MODELS[value]
279
+ end
259
280
 
260
- def self.key_id(value)
261
- value =~ /.+/ ? value : nil
262
- end
281
+ def validity(value)
282
+ VALIDITIES[value]
283
+ end
263
284
 
264
- def self.creation_date(value)
265
- value =~ /\d+/ ? DateTime.strptime(value, '%s') : nil
266
- end
285
+ def key_length(value)
286
+ value =~ /\d+/ ? value.to_s.to_i : nil
287
+ end
267
288
 
268
- def self.expiration_date(value)
269
- value =~ /\d+/ ? DateTime.strptime(value, '%s') : nil
270
- end
289
+ def key_algorithm(value)
290
+ KEY_ALGORITHMS[value]
291
+ end
271
292
 
272
- def self.user_id_hash(type, value)
273
- type == :user_id ? value : nil
274
- end
293
+ def key_id(value)
294
+ value =~ /.+/ ? value : nil
295
+ end
275
296
 
276
- def self.owner_trust(value)
277
- TRUSTS[value]
278
- end
297
+ def creation_date(value)
298
+ value =~ /\d+/ ? DateTime.strptime(value, '%s') : nil
299
+ end
279
300
 
280
- def self.fingerprint(type, value)
281
- type == :fingerprint ? value : nil
282
- end
301
+ def expiration_date(value)
302
+ value =~ /\d+/ ? DateTime.strptime(value, '%s') : nil
303
+ end
283
304
 
284
- def self.key_grip(type, value)
285
- type == :key_grip ? value : nil
286
- end
305
+ def user_id_hash(type, value)
306
+ type == :user_id ? value : nil
307
+ end
308
+
309
+ def owner_trust(value)
310
+ TRUSTS[value]
311
+ end
312
+
313
+ def fingerprint(type, value)
314
+ type == :fingerprint ? value : nil
315
+ end
316
+
317
+ def key_grip(type, value)
318
+ type == :key_grip ? value : nil
319
+ end
320
+
321
+ def user_id(type, value)
322
+ return if %i[fingerprint key_grip].include?(type)
287
323
 
288
- def self.user_id(type, value)
289
- unless [:fingerprint, :key_grip].include?(type)
290
324
  value =~ /.+/ ? value : nil
291
325
  end
292
- end
293
326
 
294
- def self.signature_class(value)
295
- value =~ /.+/ ? value : nil
296
- end
327
+ def signature_class(value)
328
+ value =~ /.+/ ? value : nil
329
+ end
297
330
 
298
- def self.key_capabilities(value)
299
- value =~ /.+/ ? value.chars.map { |c| KEY_CAPABILITIES[c] } : nil
300
- end
331
+ def key_capabilities(value)
332
+ value =~ /.+/ ? value.chars.map { |c| KEY_CAPABILITIES[c] } : nil
333
+ end
301
334
 
302
- def self.serial_number(value)
303
- value =~ /.+/ ? value : nil
304
- end
335
+ def serial_number(value)
336
+ value =~ /.+/ ? value : nil
337
+ end
305
338
 
306
- def self.compliance_modes(value)
307
- value =~ /.+/ ? value.split(' ').map { |m| COMPLIANCE_MODES[m] } : nil
308
- end
339
+ def compliance_modes(value)
340
+ value =~ /.+/ ? value.split.map { |m| COMPLIANCE_MODES[m] } : nil
341
+ end
309
342
 
310
- def self.last_update(value)
311
- value =~ /\d+/ ? DateTime.strptime(value, '%s') : nil
312
- end
343
+ def last_update(value)
344
+ value =~ /\d+/ ? DateTime.strptime(value, '%s') : nil
345
+ end
313
346
 
314
- def self.origin(value)
315
- value
316
- end
347
+ def origin(value)
348
+ value
349
+ end
317
350
 
318
- def self.new_key_signer_marginal_count(value)
319
- value =~ /\d+/ ? value.to_i : nil
320
- end
351
+ def new_key_signer_marginal_count(value)
352
+ value =~ /\d+/ ? value.to_i : nil
353
+ end
321
354
 
322
- def self.new_key_signer_complete_count(value)
323
- value =~ /\d+/ ? value.to_i : nil
324
- end
355
+ def new_key_signer_complete_count(value)
356
+ value =~ /\d+/ ? value.to_i : nil
357
+ end
325
358
 
326
- def self.maximum_certificate_chain_depth(value)
327
- value =~ /\d+/ ? value.to_i : nil
359
+ def maximum_certificate_chain_depth(value)
360
+ value =~ /\d+/ ? value.to_i : nil
361
+ end
328
362
  end
329
363
  end
364
+ # rubocop:enable Metrics/ClassLength
330
365
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'lino'
2
4
 
3
5
  require_relative './result'
@@ -13,17 +15,12 @@ module RubyGPG2
13
15
  end
14
16
 
15
17
  def execute(opts = {})
16
- builder = instantiate_builder
17
-
18
18
  do_before(opts)
19
19
  do_around(opts) do |updated_opts|
20
- builder = configure_command(builder, updated_opts)
20
+ builder = configure_command(instantiate_builder, updated_opts)
21
21
  builder
22
- .build
23
- .execute(
24
- stdin: stdin,
25
- stdout: stdout,
26
- stderr: stderr)
22
+ .build
23
+ .execute(stdin: stdin, stdout: stdout, stderr: stderr)
27
24
  end
28
25
  do_after(opts)
29
26
  end
@@ -34,13 +31,12 @@ module RubyGPG2
34
31
 
35
32
  def instantiate_builder
36
33
  Lino::CommandLineBuilder
37
- .for_command(binary)
34
+ .for_command(binary)
38
35
  end
39
36
 
40
- def do_before(opts)
41
- end
37
+ def do_before(_); end
42
38
 
43
- def configure_command(builder, opts)
39
+ def configure_command(builder, _opts)
44
40
  builder
45
41
  end
46
42
 
@@ -48,7 +44,7 @@ module RubyGPG2
48
44
  yield opts
49
45
  end
50
46
 
51
- def do_after(opts)
47
+ def do_after(_)
52
48
  Result.new
53
49
  end
54
50
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'lino'
2
4
 
3
5
  require_relative 'base'
@@ -24,8 +26,7 @@ module RubyGPG2
24
26
 
25
27
  def configure_command(builder, opts)
26
28
  builder = super(builder, opts)
27
- builder = builder.with_subcommand('--decrypt')
28
- builder
29
+ builder.with_subcommand('--decrypt')
29
30
  end
30
31
  end
31
32
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'lino'
2
4
 
3
5
  require_relative 'base'
@@ -22,8 +24,7 @@ module RubyGPG2
22
24
 
23
25
  def configure_command(builder, opts)
24
26
  builder = super(builder, opts)
25
- builder = builder.with_subcommand('--encrypt')
26
- builder
27
+ builder.with_subcommand('--encrypt')
27
28
  end
28
29
  end
29
30
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'lino'
2
4
 
3
5
  require_relative 'base'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'lino'
2
4
 
3
5
  require_relative 'base'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'lino'
2
4
 
3
5
  require_relative 'base'
@@ -27,7 +29,9 @@ module RubyGPG2
27
29
 
28
30
  builder = builder.with_subcommand('--generate-key')
29
31
  builder = super(builder, opts)
30
- builder = builder.with_argument(parameter_file_path) if parameter_file_path
32
+ if parameter_file_path
33
+ builder = builder.with_argument(parameter_file_path)
34
+ end
31
35
  builder
32
36
  end
33
37
  end