Sha256: c3ab2d272a2a6354a442069bd7c435aecd833a1d7d875e102350726fdd42ca37

Contents?: true

Size: 719 Bytes

Versions: 1

Compression:

Stored size: 719 Bytes

Contents

require 'rake/tasklib'

module Avrolution
  module Rake
    class BaseTask < ::Rake::TaskLib

      attr_accessor :name, :task_namespace, :task_desc, :dependencies

      def self.define(**options, &block)
        new(**options, &block).define
      end

      def initialize(name: nil, dependencies: [])
        @name = name
        @task_namespace = :avro
        @dependencies = dependencies

        yield self if block_given?
      end

      def define
        namespace task_namespace do
          desc task_desc
          task(name.to_sym => dependencies) do
            perform
          end
        end
      end

      private

      def perform
        raise NotImplementedError
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
avrolution-0.6.1 lib/avrolution/rake/base_task.rb