Sha256: caf525f5489b1d6c0ff837ba135115e83442b0ea91772a8f34f2efad8423ad5c

Contents?: true

Size: 957 Bytes

Versions: 3

Compression:

Stored size: 957 Bytes

Contents

#require 'rake'
require 'rake/tasklib'

require 'reap/projectinfo.rb'
require 'facet/hash/keys_to_s'


module Reap

  def self.RakeAdapter( reapclass )

    Class.new( ::Rake::TaskLib ) do

      define_method( :reapclass ) {  reapclass }

      attr_accessor :name, :options

      # Create task.
      def initialize(name=reapclass.task_name) # :yield:
        @name = name
        @options = nil
        if block_given?
          options = OpenObject.new
          yield( options )
          @options = options.to_h.keys_to_s
          #reapclass.master[reapclass.task_name].update( @options )
        end
        define
      end

      # Create the tasks defined by this task lib.
      def define
        desc reapclass.task_desc
        task name do
          rc = reapclass.new
          if @options
            rc.execute( @options.to_h )
          else
            rc.execute
          end
        end
        self
      end

    end

  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
reap-4.5.0 doc/rake/adapter.rb
reap-4.4.0 lib/reap/rake/adapter.rb
reap-4.4.1 lib/reap/rake/adapter.rb