Sha256: b67f1125945b81b029d955a54481d3f784c6fd7582f6b3c1ae5a8d34eba5250a

Contents?: true

Size: 1.51 KB

Versions: 14

Compression:

Stored size: 1.51 KB

Contents

# frozen_string_literal: true

require 'rake_factory'
require 'ruby_easy_rsa'

require_relative '../../mixins/global_parameters'
require_relative '../../mixins/ssl_parameters'
require_relative '../../mixins/algorithm_parameters'
require_relative '../../mixins/encrypt_key_parameters'
require_relative '../../mixins/gitkeep_parameters'
require_relative '../../mixins/easy_rsa_ensure_prerequisite'

module RakeEasyRSA
  module Tasks
    module CA
      class Create < RakeFactory::Task
        include Mixins::GlobalParameters
        include Mixins::SSLParameters
        include Mixins::AlgorithmParameters
        include Mixins::EncryptKeyParameters
        include Mixins::GitkeepParameters
        include Mixins::EasyRSAEnsurePrerequisite

        default_name :create
        default_description 'Create the CA certificate for the PKI'

        action do |t|
          puts 'Creating CA certificate... '
          RubyEasyRSA.build_ca(t.parameter_values)
          if t.include_gitkeep_files
            %w[certs_by_serial/.gitkeep
               issued/.gitkeep
               renewed/certs_by_serial/.gitkeep
               renewed/private_by_serial/.gitkeep
               renewed/reqs_by_serial/.gitkeep
               revoked/certs_by_serial/.gitkeep
               revoked/private_by_serial/.gitkeep
               revoked/reqs_by_serial/.gitkeep].each do |gitkeep_file|
              File.write("#{t.pki_directory}/#{gitkeep_file}", '')
            end
          end
          puts 'Done.'
        end
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
rake_easy_rsa-0.16.0.pre.2 lib/rake_easy_rsa/tasks/ca/create.rb
rake_easy_rsa-0.16.0.pre.1 lib/rake_easy_rsa/tasks/ca/create.rb
rake_easy_rsa-0.15.0 lib/rake_easy_rsa/tasks/ca/create.rb
rake_easy_rsa-0.14.0.pre.7 lib/rake_easy_rsa/tasks/ca/create.rb
rake_easy_rsa-0.14.0.pre.6 lib/rake_easy_rsa/tasks/ca/create.rb
rake_easy_rsa-0.14.0.pre.5 lib/rake_easy_rsa/tasks/ca/create.rb
rake_easy_rsa-0.14.0.pre.4 lib/rake_easy_rsa/tasks/ca/create.rb
rake_easy_rsa-0.14.0.pre.3 lib/rake_easy_rsa/tasks/ca/create.rb
rake_easy_rsa-0.14.0.pre.2 lib/rake_easy_rsa/tasks/ca/create.rb
rake_easy_rsa-0.14.0.pre.1 lib/rake_easy_rsa/tasks/ca/create.rb
rake_easy_rsa-0.13.0 lib/rake_easy_rsa/tasks/ca/create.rb
rake_easy_rsa-0.12.0.pre.4 lib/rake_easy_rsa/tasks/ca/create.rb
rake_easy_rsa-0.12.0.pre.3 lib/rake_easy_rsa/tasks/ca/create.rb
rake_easy_rsa-0.12.0.pre.2 lib/rake_easy_rsa/tasks/ca/create.rb