Sha256: a0c4056a81af9fe5feec0c88b258cbe0adbdce72a4ff7af593b8b453c6144f46

Contents?: true

Size: 1.13 KB

Versions: 6

Compression:

Stored size: 1.13 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/easy_rsa_ensure_prerequisite'

module RakeEasyRSA
  module Tasks
    module Certificate
      class Revoke < RakeFactory::Task
        include Mixins::GlobalParameters
        include Mixins::SSLParameters
        include Mixins::EasyRSAEnsurePrerequisite

        parameter(:default_argument_names,
                  default: %i[filename_base reason])

        default_name :revoke
        default_description 'Revoke a certificate of the PKI'

        parameter :reason, default: 'unspecified'

        def argument_names
          @argument_names + default_argument_names
        end

        action do |t, args|
          puts "Revoking certificate '#{args.filename_base}'... "
          reason = args.reason || t.reason
          RubyEasyRSA.revoke(
            t.parameter_values.merge(
              reason:,
              filename_base: args.filename_base
            )
          )
          puts 'Done.'
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rake_easy_rsa-0.16.0.pre.2 lib/rake_easy_rsa/tasks/certificate/revoke.rb
rake_easy_rsa-0.16.0.pre.1 lib/rake_easy_rsa/tasks/certificate/revoke.rb
rake_easy_rsa-0.15.0 lib/rake_easy_rsa/tasks/certificate/revoke.rb
rake_easy_rsa-0.14.0.pre.7 lib/rake_easy_rsa/tasks/certificate/revoke.rb
rake_easy_rsa-0.14.0.pre.6 lib/rake_easy_rsa/tasks/certificate/revoke.rb
rake_easy_rsa-0.14.0.pre.5 lib/rake_easy_rsa/tasks/certificate/revoke.rb