Sha256: a8d0155e7adf8dad3741f16b482eacae4f838e2ab49fc7febfcd97c183ace7eb

Contents?: true

Size: 606 Bytes

Versions: 5

Compression:

Stored size: 606 Bytes

Contents

require 'rake/tasklib'

module Albacore
  class AlbacoreTask < ::Rake::TaskLib
    attr_accessor :name
    
    def initialize(name, *args, &block)
      @block = block
      args = args.insert(0, name)
      define name, args
    end
    
    def define(name, args)
      task *args do |task, task_args|
      	@task_args = task_args
        execute name.to_s
      end
    end
    
    def call_task_block(obj)
      if !@block.nil?
      	if @block.arity == 1
      	  @block.call(obj)
        else
      	  @block.call(obj, @task_args)
  	    end
  	  end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
albacore-0.2.0.preview1 lib/rake/support/albacoretask.rb
albacore-0.1.5 lib/rake/support/albacoretask.rb
albacore-0.1.4 lib/rake/support/albacoretask.rb
albacore-0.1.3 lib/rake/support/albacoretask.rb
albacore-0.1.2 lib/rake/support/albacoretask.rb