Sha256: 2be374f4c3051ab7f1beb36868839654932518a75f1624669331c85aa766b7c9

Contents?: true

Size: 1.1 KB

Versions: 4

Compression:

Stored size: 1.1 KB

Contents

# frozen_string_literal: true

require 'avrolution/rake/base_task'

module Avrolution
  module Rake
    class AddCompatibilityBreakTask < BaseTask

      def initialize(**)
        super
        @name ||= :add_compatibility_break
        @task_desc ||= 'Add an Avro schema compatibility break. Parameters: name, fingerprint, ' \
          'with_compatibility, after_compatibility'
      end

      private

      def perform
        compatibility_break_args = ENV.to_h.slice(
          'name', 'fingerprint', 'with_compatibility', 'after_compatibility'
        ).symbolize_keys

        missing_args = [:name, :fingerprint].select do |arg|
          compatibility_break_args[arg].blank?
        end

        if missing_args.any?
          puts missing_args.map { |arg| "#{arg} can't be blank" }.join(', ')
          puts 'Usage: rake avro:add_compatibility_break name=<name> fingerprint=<fingerprint> ' \
            '[with_compatibility=<default:NONE>] [after_compatibility=<compatibility>]'
          exit(1)
        end

        Avrolution::CompatibilityBreaksFile.add(**compatibility_break_args)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
avrolution-0.9.0 lib/avrolution/rake/add_compatibility_break_task.rb
avrolution-0.8.0 lib/avrolution/rake/add_compatibility_break_task.rb
avrolution-0.7.2 lib/avrolution/rake/add_compatibility_break_task.rb
avrolution-0.7.1 lib/avrolution/rake/add_compatibility_break_task.rb