ruby_easy_rsa 0.10.0.pre.5 → 0.10.0.pre.8

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.
Files changed (41) 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/lib/ruby_easy_rsa/commands/base.rb +16 -18
  7. data/lib/ruby_easy_rsa/commands/build_ca.rb +3 -2
  8. data/lib/ruby_easy_rsa/commands/build_client_full.rb +3 -2
  9. data/lib/ruby_easy_rsa/commands/build_client_server_full.rb +3 -2
  10. data/lib/ruby_easy_rsa/commands/build_server_full.rb +3 -2
  11. data/lib/ruby_easy_rsa/commands/export_p12.rb +2 -0
  12. data/lib/ruby_easy_rsa/commands/export_p7.rb +2 -0
  13. data/lib/ruby_easy_rsa/commands/gen_crl.rb +3 -2
  14. data/lib/ruby_easy_rsa/commands/gen_dh.rb +3 -2
  15. data/lib/ruby_easy_rsa/commands/gen_req.rb +3 -2
  16. data/lib/ruby_easy_rsa/commands/import_req.rb +3 -2
  17. data/lib/ruby_easy_rsa/commands/init_pki.rb +2 -0
  18. data/lib/ruby_easy_rsa/commands/mixins/algorithm_config.rb +29 -8
  19. data/lib/ruby_easy_rsa/commands/mixins/copy_extensions_config.rb +13 -3
  20. data/lib/ruby_easy_rsa/commands/mixins/encrypt_key_config.rb +17 -3
  21. data/lib/ruby_easy_rsa/commands/mixins/extra_extensions_config.rb +26 -8
  22. data/lib/ruby_easy_rsa/commands/mixins/global_config.rb +94 -29
  23. data/lib/ruby_easy_rsa/commands/mixins/inline_credentials_file_config.rb +15 -3
  24. data/lib/ruby_easy_rsa/commands/mixins/netscape_extensions_config.rb +32 -9
  25. data/lib/ruby_easy_rsa/commands/mixins/ssl_config.rb +114 -35
  26. data/lib/ruby_easy_rsa/commands/mixins/sub_ca_config.rb +15 -4
  27. data/lib/ruby_easy_rsa/commands/renew.rb +3 -2
  28. data/lib/ruby_easy_rsa/commands/revoke.rb +2 -0
  29. data/lib/ruby_easy_rsa/commands/set_ec_pass.rb +2 -0
  30. data/lib/ruby_easy_rsa/commands/set_rsa_pass.rb +2 -0
  31. data/lib/ruby_easy_rsa/commands/show_ca.rb +2 -0
  32. data/lib/ruby_easy_rsa/commands/show_cert.rb +2 -0
  33. data/lib/ruby_easy_rsa/commands/show_req.rb +2 -0
  34. data/lib/ruby_easy_rsa/commands/sign_req.rb +3 -2
  35. data/lib/ruby_easy_rsa/commands/update_db.rb +3 -2
  36. data/lib/ruby_easy_rsa/commands/upgrade.rb +3 -2
  37. data/lib/ruby_easy_rsa/commands.rb +3 -2
  38. data/lib/ruby_easy_rsa/version.rb +3 -1
  39. data/lib/ruby_easy_rsa.rb +6 -0
  40. data/ruby_easy_rsa.gemspec +55 -0
  41. metadata +64 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 82569f3b7d0745a7856894d4788c3f1f8d57352a1653b31b490e0d0ae8f0b527
4
- data.tar.gz: 6ea48e38a2fc6d7547d71a740ab96996149a3e1587be57794a9b67402824ec51
3
+ metadata.gz: fcb178c3cc51693c50831b26b5a7ead27c2930ff13ed9dd937619d06644e5729
4
+ data.tar.gz: 2f9834bef0711d28b65067428b0551bec015d4e55ff41950aa7ac52c3715894f
5
5
  SHA512:
6
- metadata.gz: ee7239a999da93126d2c5d586a29ee8da816920c33c9de9bf7066bc3553d39682ea4613f7e2997f87f329aee02db0d4f66aebb05a9a8ae4ee29377b1dc011058
7
- data.tar.gz: 48d2d078c25df81ec5d01018e67c056c7ea4925a165055b58d8b2baf13905df6eaf7bd372b8ff38f7b3e65b0ddae9c86808f3603d4f05fd51e79e1ee0143c922
6
+ metadata.gz: eac992afcb2beba9a54714d7f38d2fd7eedc20136e61f5e0f66c3199bd5a89c916a9f0e4fc672b4e4cdb480657d8c18852553708ec84bd75f4fc0c227a0299bd
7
+ data.tar.gz: 9daa2b0ddfacadf12c675e80ca0adcb8abf656844e715868a3d8d82e57bc17ec33179d559d63ad0ba34c87e512f3186a3defd47eb5661f5d8089341b3536402f
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  # Specify your gem's dependencies in ruby_fly.gemspec
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ruby_easy_rsa (0.10.0.pre.5)
4
+ ruby_easy_rsa (0.10.0.pre.8)
5
5
  lino (~> 3.0)
6
6
 
7
7
  GEM
@@ -14,9 +14,11 @@ GEM
14
14
  tzinfo (~> 2.0)
15
15
  addressable (2.8.0)
16
16
  public_suffix (>= 2.0.2, < 5.0)
17
+ ast (2.4.2)
17
18
  colored2 (3.1.2)
18
19
  concurrent-ruby (1.1.9)
19
20
  diff-lcs (1.5.0)
21
+ docile (1.4.0)
20
22
  excon (0.92.0)
21
23
  faraday (1.10.0)
22
24
  faraday-em_http (~> 1.0)
@@ -55,7 +57,11 @@ GEM
55
57
  faraday (>= 0.9)
56
58
  sawyer (~> 0.8.0, >= 0.5.3)
57
59
  open4 (1.3.4)
60
+ parallel (1.22.1)
61
+ parser (3.1.1.0)
62
+ ast (~> 2.4.1)
58
63
  public_suffix (4.0.6)
64
+ rainbow (3.1.1)
59
65
  rake (13.0.6)
60
66
  rake_circle_ci (0.9.0)
61
67
  colored2 (~> 3.1)
@@ -77,6 +83,8 @@ GEM
77
83
  colored2 (~> 3.1)
78
84
  rake_factory (~> 0.23)
79
85
  sshkey (~> 2.0)
86
+ regexp_parser (2.2.1)
87
+ rexml (3.2.5)
80
88
  rspec (3.11.0)
81
89
  rspec-core (~> 3.11.0)
82
90
  rspec-expectations (~> 3.11.0)
@@ -90,15 +98,38 @@ GEM
90
98
  diff-lcs (>= 1.2.0, < 2.0)
91
99
  rspec-support (~> 3.11.0)
92
100
  rspec-support (3.11.0)
101
+ rubocop (1.27.0)
102
+ parallel (~> 1.10)
103
+ parser (>= 3.1.0.0)
104
+ rainbow (>= 2.2.2, < 4.0)
105
+ regexp_parser (>= 1.8, < 3.0)
106
+ rexml
107
+ rubocop-ast (>= 1.16.0, < 2.0)
108
+ ruby-progressbar (~> 1.7)
109
+ unicode-display_width (>= 1.4.0, < 3.0)
110
+ rubocop-ast (1.16.0)
111
+ parser (>= 3.1.1.0)
112
+ rubocop-rake (0.6.0)
113
+ rubocop (~> 1.0)
114
+ rubocop-rspec (2.9.0)
115
+ rubocop (~> 1.19)
116
+ ruby-progressbar (1.11.0)
93
117
  ruby2_keywords (0.0.5)
94
118
  ruby_gpg2 (0.8.0)
95
119
  lino (>= 1.5)
96
120
  sawyer (0.8.2)
97
121
  addressable (>= 2.3.5)
98
122
  faraday (> 0.8, < 2.0)
123
+ simplecov (0.21.2)
124
+ docile (~> 1.1)
125
+ simplecov-html (~> 0.11)
126
+ simplecov_json_formatter (~> 0.1)
127
+ simplecov-html (0.12.3)
128
+ simplecov_json_formatter (0.1.4)
99
129
  sshkey (2.0.0)
100
130
  tzinfo (2.0.4)
101
131
  concurrent-ruby (~> 1.0)
132
+ unicode-display_width (2.1.0)
102
133
 
103
134
  PLATFORMS
104
135
  arm64-darwin-21
@@ -113,7 +144,11 @@ DEPENDENCIES
113
144
  rake_gpg
114
145
  rake_ssh
115
146
  rspec
147
+ rubocop
148
+ rubocop-rake
149
+ rubocop-rspec
116
150
  ruby_easy_rsa!
151
+ simplecov
117
152
 
118
153
  BUNDLED WITH
119
- 2.3.9
154
+ 2.3.11
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2020 InfraBlocks
3
+ Copyright (c) 2022 InfraBlocks Maintainers
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'yaml'
2
4
  require 'rake_circle_ci'
3
5
  require 'rake_github'
@@ -5,17 +7,26 @@ require 'rake_ssh'
5
7
  require 'rake_gpg'
6
8
  require 'securerandom'
7
9
  require 'rspec/core/rake_task'
10
+ require 'rubocop/rake_task'
8
11
 
9
- task :default => :spec
10
-
11
- RSpec::Core::RakeTask.new(:spec)
12
+ task default: %i[
13
+ library:fix
14
+ test:unit
15
+ ]
12
16
 
13
17
  namespace :encryption do
18
+ namespace :directory do
19
+ desc 'Ensure CI secrets directory exists.'
20
+ task :ensure do
21
+ FileUtils.mkdir_p('config/secrets/ci')
22
+ end
23
+ end
24
+
14
25
  namespace :passphrase do
15
- task :generate do
16
- File.open('config/secrets/ci/encryption.passphrase', 'w') do |f|
17
- f.write(SecureRandom.base64(36))
18
- end
26
+ desc 'Generate encryption passphrase used by CI.'
27
+ task generate: ['directory:ensure'] do
28
+ File.write('config/secrets/ci/encryption.passphrase',
29
+ SecureRandom.base64(36))
19
30
  end
20
31
  end
21
32
  end
@@ -23,85 +34,111 @@ end
23
34
  namespace :keys do
24
35
  namespace :deploy do
25
36
  RakeSSH.define_key_tasks(
26
- path: 'config/secrets/ci/',
27
- comment: 'maintainers@infrablocks.io')
37
+ path: 'config/secrets/ci/',
38
+ comment: 'maintainers@infrablocks.io'
39
+ )
28
40
  end
29
41
 
30
42
  namespace :gpg do
31
43
  RakeGPG.define_generate_key_task(
32
- output_directory: 'config/secrets/ci',
33
- name_prefix: 'gpg',
34
- owner_name: 'InfraBlocks Maintainers',
35
- owner_email: 'maintainers@infrablocks.io',
36
- owner_comment: 'ruby_easy_rsa CI Key')
44
+ output_directory: 'config/secrets/ci',
45
+ name_prefix: 'gpg',
46
+ owner_name: 'InfraBlocks Maintainers',
47
+ owner_email: 'maintainers@infrablocks.io',
48
+ owner_comment: 'ruby_easy_rsa CI Key'
49
+ )
37
50
  end
38
51
  end
39
52
 
53
+ namespace :secrets do
54
+ desc 'Regenerate all generatable secrets.'
55
+ task regenerate: %w[
56
+ encryption:passphrase:generate
57
+ keys:deploy:generate
58
+ keys:gpg:generate
59
+ ]
60
+ end
61
+
62
+ RuboCop::RakeTask.new
63
+
64
+ namespace :library do
65
+ desc 'Run all checks of the library'
66
+ task check: [:rubocop]
67
+
68
+ desc 'Attempt to automatically fix issues with the library'
69
+ task fix: [:'rubocop:auto_correct']
70
+ end
71
+
72
+ namespace :test do
73
+ RSpec::Core::RakeTask.new(:unit)
74
+ end
75
+
40
76
  RakeCircleCI.define_project_tasks(
41
- namespace: :circle_ci,
42
- project_slug: 'github/infrablocks/ruby_easy_rsa'
77
+ namespace: :circle_ci,
78
+ project_slug: 'github/infrablocks/ruby_easy_rsa'
43
79
  ) do |t|
44
80
  circle_ci_config =
45
- YAML.load_file('config/secrets/circle_ci/config.yaml')
81
+ YAML.load_file('config/secrets/circle_ci/config.yaml')
46
82
 
47
- t.api_token = circle_ci_config["circle_ci_api_token"]
83
+ t.api_token = circle_ci_config['circle_ci_api_token']
48
84
  t.environment_variables = {
49
- ENCRYPTION_PASSPHRASE:
50
- File.read('config/secrets/ci/encryption.passphrase')
51
- .chomp
85
+ ENCRYPTION_PASSPHRASE:
86
+ File.read('config/secrets/ci/encryption.passphrase')
87
+ .chomp
52
88
  }
53
89
  t.checkout_keys = []
54
90
  t.ssh_keys = [
55
- {
56
- hostname: "github.com",
57
- private_key: File.read('config/secrets/ci/ssh.private')
58
- }
91
+ {
92
+ hostname: 'github.com',
93
+ private_key: File.read('config/secrets/ci/ssh.private')
94
+ }
59
95
  ]
60
96
  end
61
97
 
62
98
  RakeGithub.define_repository_tasks(
63
- namespace: :github,
64
- repository: 'infrablocks/ruby_easy_rsa',
99
+ namespace: :github,
100
+ repository: 'infrablocks/ruby_easy_rsa'
65
101
  ) do |t, args|
66
102
  github_config =
67
- YAML.load_file('config/secrets/github/config.yaml')
103
+ YAML.load_file('config/secrets/github/config.yaml')
68
104
 
69
- t.access_token = github_config["github_personal_access_token"]
105
+ t.access_token = github_config['github_personal_access_token']
70
106
  t.deploy_keys = [
71
- {
72
- title: 'CircleCI',
73
- public_key: File.read('config/secrets/ci/ssh.public')
74
- }
107
+ {
108
+ title: 'CircleCI',
109
+ public_key: File.read('config/secrets/ci/ssh.public')
110
+ }
75
111
  ]
76
112
  t.branch_name = args.branch_name
77
113
  t.commit_message = args.commit_message
78
114
  end
79
115
 
80
116
  namespace :pipeline do
81
- task :prepare => [
82
- :'circle_ci:project:follow',
83
- :'circle_ci:env_vars:ensure',
84
- :'circle_ci:checkout_keys:ensure',
85
- :'circle_ci:ssh_keys:ensure',
86
- :'github:deploy_keys:ensure'
117
+ desc 'Prepare CircleCI Pipeline'
118
+ task prepare: %i[
119
+ circle_ci:project:follow
120
+ circle_ci:env_vars:ensure
121
+ circle_ci:checkout_keys:ensure
122
+ circle_ci:ssh_keys:ensure
123
+ github:deploy_keys:ensure
87
124
  ]
88
125
  end
89
126
 
90
127
  namespace :version do
91
- desc "Bump version for specified type (pre, major, minor, patch)"
128
+ desc 'Bump version for specified type (pre, major, minor, patch)'
92
129
  task :bump, [:type] do |_, args|
93
130
  bump_version_for(args.type)
94
131
  end
95
132
  end
96
133
 
97
- desc "Release gem"
134
+ desc 'Release gem'
98
135
  task :release do
99
- sh "gem release --tag --push"
136
+ sh 'gem release --tag --push'
100
137
  end
101
138
 
102
139
  def bump_version_for(version_type)
103
- sh "gem bump --version #{version_type} " +
104
- "&& bundle install " +
105
- "&& export LAST_MESSAGE=\"$(git log -1 --pretty=%B)\" " +
106
- "&& git commit -a --amend -m \"${LAST_MESSAGE} [ci skip]\""
140
+ sh "gem bump --version #{version_type} " \
141
+ '&& bundle install ' \
142
+ '&& export LAST_MESSAGE="$(git log -1 --pretty=%B)" ' \
143
+ '&& git commit -a --amend -m "${LAST_MESSAGE} [ci skip]"'
107
144
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'lino'
2
4
 
3
5
  module RubyEasyRSA
@@ -14,42 +16,38 @@ module RubyEasyRSA
14
16
  end
15
17
 
16
18
  def stdout
17
- STDOUT
19
+ $stdout
18
20
  end
19
21
 
20
22
  def stderr
21
- STDERR
23
+ $stderr
22
24
  end
23
25
 
24
26
  def execute(opts = {})
25
- builder = instantiate_builder
26
-
27
27
  do_before(opts)
28
- builder = configure_command(builder, opts)
29
- builder
30
- .build
31
- .execute(
32
- stdin: stdin,
33
- stdout: stdout,
34
- stderr: stderr)
28
+ configure_command(instantiate_builder, opts)
29
+ .build
30
+ .execute(
31
+ stdin: stdin,
32
+ stdout: stdout,
33
+ stderr: stderr
34
+ )
35
35
  do_after(opts)
36
36
  end
37
37
 
38
38
  def instantiate_builder
39
39
  Lino::CommandLineBuilder
40
- .for_command(binary)
41
- .with_option_separator('=')
40
+ .for_command(binary)
41
+ .with_option_separator('=')
42
42
  end
43
43
 
44
- def do_before(opts)
45
- end
44
+ def do_before(_); end
46
45
 
47
- def configure_command(builder, opts)
46
+ def configure_command(builder, _opts)
48
47
  builder
49
48
  end
50
49
 
51
- def do_after(opts)
52
- end
50
+ def do_after(_); end
53
51
  end
54
52
  end
55
53
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'lino'
2
4
 
3
5
  require_relative 'base'
@@ -19,8 +21,7 @@ module RubyEasyRSA
19
21
 
20
22
  builder = builder.with_subcommand('build-ca')
21
23
  builder = builder.with_argument('subca') if sub_ca
22
- builder = super(builder, opts)
23
- builder
24
+ super(builder, opts)
24
25
  end
25
26
  end
26
27
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'lino'
2
4
 
3
5
  require_relative 'base'
@@ -29,8 +31,7 @@ module RubyEasyRSA
29
31
 
30
32
  builder = builder.with_subcommand('build-client-full')
31
33
  builder = builder.with_argument(filename_base)
32
- builder = super(builder, opts)
33
- builder
34
+ super(builder, opts)
34
35
  end
35
36
  end
36
37
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'lino'
2
4
 
3
5
  require_relative 'base'
@@ -29,8 +31,7 @@ module RubyEasyRSA
29
31
 
30
32
  builder = builder.with_subcommand('build-clientServer-full')
31
33
  builder = builder.with_argument(filename_base)
32
- builder = super(builder, opts)
33
- builder
34
+ super(builder, opts)
34
35
  end
35
36
  end
36
37
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'lino'
2
4
 
3
5
  require_relative 'base'
@@ -29,8 +31,7 @@ module RubyEasyRSA
29
31
 
30
32
  builder = builder.with_subcommand('build-server-full')
31
33
  builder = builder.with_argument(filename_base)
32
- builder = super(builder, opts)
33
- builder
34
+ super(builder, opts)
34
35
  end
35
36
  end
36
37
  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'
@@ -12,8 +14,7 @@ module RubyEasyRSA
12
14
 
13
15
  def configure_command(builder, opts)
14
16
  builder = builder.with_subcommand('gen-crl')
15
- builder = super(builder, opts)
16
- builder
17
+ super(builder, opts)
17
18
  end
18
19
  end
19
20
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'lino'
2
4
 
3
5
  require_relative 'base'
@@ -12,8 +14,7 @@ module RubyEasyRSA
12
14
 
13
15
  def configure_command(builder, opts)
14
16
  builder = super(builder, opts)
15
- builder = builder.with_subcommand('gen-dh')
16
- builder
17
+ builder.with_subcommand('gen-dh')
17
18
  end
18
19
  end
19
20
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'lino'
2
4
 
3
5
  require_relative 'base'
@@ -21,8 +23,7 @@ module RubyEasyRSA
21
23
 
22
24
  builder = builder.with_subcommand('gen-req')
23
25
  builder = builder.with_argument(filename_base)
24
- builder = super(builder, opts)
25
- builder
26
+ super(builder, opts)
26
27
  end
27
28
  end
28
29
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'lino'
2
4
 
3
5
  require_relative 'base'
@@ -17,8 +19,7 @@ module RubyEasyRSA
17
19
  builder = super(builder, opts)
18
20
  builder = builder.with_subcommand('import-req')
19
21
  builder = builder.with_argument(request_file)
20
- builder = builder.with_argument(filename_base)
21
- builder
22
+ builder.with_argument(filename_base)
22
23
  end
23
24
  end
24
25
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'lino'
2
4
 
3
5
  require_relative 'base'
@@ -1,19 +1,40 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module RubyEasyRSA
2
4
  module Commands
3
5
  module Mixins
4
6
  module AlgorithmConfig
7
+ # rubocop:disable Style/RedundantAssignment
5
8
  def configure_command(builder, opts)
6
- algorithm = opts[:algorithm]
7
- curve = opts[:curve]
8
- ec_directory = opts[:ec_directory]
9
-
10
9
  builder = super(builder, opts)
11
- builder = builder.with_environment_variable(
12
- 'EASYRSA_EC_DIR', ec_directory) if ec_directory
13
- builder = builder.with_option('--use-algo', algorithm) if algorithm
14
- builder = builder.with_option('--curve', curve) if curve
10
+ builder = with_ec_directory(builder, opts[:ec_directory])
11
+ builder = with_algorithm(builder, opts[:algorithm])
12
+ builder = with_curve(builder, opts[:curve])
15
13
  builder
16
14
  end
15
+ # rubocop:enable Style/RedundantAssignment
16
+
17
+ private
18
+
19
+ def with_ec_directory(builder, ec_directory)
20
+ return builder unless ec_directory
21
+
22
+ builder.with_environment_variable(
23
+ 'EASYRSA_EC_DIR', ec_directory
24
+ )
25
+ end
26
+
27
+ def with_algorithm(builder, algorithm)
28
+ return builder unless algorithm
29
+
30
+ builder.with_option('--use-algo', algorithm)
31
+ end
32
+
33
+ def with_curve(builder, curve)
34
+ return builder unless curve
35
+
36
+ builder.with_option('--curve', curve)
37
+ end
17
38
  end
18
39
  end
19
40
  end
@@ -1,14 +1,24 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module RubyEasyRSA
2
4
  module Commands
3
5
  module Mixins
4
6
  module CopyExtensionsConfig
7
+ # rubocop:disable Style/RedundantAssignment
5
8
  def configure_command(builder, opts)
6
- copy_extensions = opts[:copy_extensions]
7
-
8
9
  builder = super(builder, opts)
9
- builder = builder.with_flag('--copy-ext') if copy_extensions
10
+ builder = with_copy_extensions(builder, opts[:copy_extensions])
10
11
  builder
11
12
  end
13
+ # rubocop:enable Style/RedundantAssignment
14
+
15
+ private
16
+
17
+ def with_copy_extensions(builder, copy_extensions)
18
+ return builder unless copy_extensions
19
+
20
+ builder.with_flag('--copy-ext')
21
+ end
12
22
  end
13
23
  end
14
24
  end
@@ -1,14 +1,28 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module RubyEasyRSA
2
4
  module Commands
3
5
  module Mixins
4
6
  module EncryptKeyConfig
7
+ # rubocop:disable Style/RedundantAssignment
5
8
  def configure_command(builder, opts)
6
- encrypt_key = opts[:encrypt_key].nil? ? true : opts[:encrypt_key]
7
-
8
9
  builder = super(builder, opts)
9
- builder = builder.with_argument('nopass') unless encrypt_key
10
+ builder = with_encrypt_key(builder, encrypt_key(opts))
10
11
  builder
11
12
  end
13
+ # rubocop:enable Style/RedundantAssignment
14
+
15
+ private
16
+
17
+ def encrypt_key(opts)
18
+ opts[:encrypt_key].nil? ? true : opts[:encrypt_key]
19
+ end
20
+
21
+ def with_encrypt_key(builder, encrypt_key)
22
+ return builder if encrypt_key
23
+
24
+ builder.with_argument('nopass')
25
+ end
12
26
  end
13
27
  end
14
28
  end