Sha256: b084f5da1640de9ebf45fb6ef9498e69ed5915599ed1431d60f36562c05b8879

Contents?: true

Size: 1.18 KB

Versions: 28

Compression:

Stored size: 1.18 KB

Contents

require 'rake/tasklib'

require_relative 'parameters'
require_relative 'parameter_view'
require_relative 'actions'
require_relative 'configurable'
require_relative 'defaults'
require_relative 'definable'
require_relative 'arguments'

module RakeFactory
  class Task < ::Rake::TaskLib
    extend Definable

    include Parameters
    include Configurable
    include Defaults
    include Arguments
    include Actions

    def define_on(application)
      creator = self

      @task = application.define_task(
          Rake::Task,
          name,
          argument_names => prerequisites,
          order_only: order_only_prerequisites
      ) do |_, args|
        view = ParameterView.new(self, self.class, self.class, args)
        invoke_configuration_block_on(view, args)
        check_parameter_requirements
        invoke_actions(args)
      end
      @task.add_description(description)
      @task.instance_eval do
        define_singleton_method(:creator) { creator }
      end

      self
    end

    def method_missing(method, *args, &block)
      if @task.respond_to?(method)
        @task.send(method, *args, &block)
      else
        super(method, *args, &block)
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
rake_factory-0.30.0.pre.5 lib/rake_factory/task.rb
rake_factory-0.30.0.pre.4 lib/rake_factory/task.rb
rake_factory-0.30.0.pre.3 lib/rake_factory/task.rb
rake_factory-0.30.0.pre.2 lib/rake_factory/task.rb
rake_factory-0.30.0.pre.1 lib/rake_factory/task.rb
rake_factory-0.29.0 lib/rake_factory/task.rb
rake_factory-0.28.0.pre.2 lib/rake_factory/task.rb
rake_factory-0.28.0.pre.1 lib/rake_factory/task.rb
rake_factory-0.27.0 lib/rake_factory/task.rb
rake_factory-0.26.0.pre.1 lib/rake_factory/task.rb
rake_factory-0.24.0.pre.2 lib/rake_factory/task.rb
rake_factory-0.25.0 lib/rake_factory/task.rb
rake_factory-0.24.0.pre.1 lib/rake_factory/task.rb
rake_factory-0.23.0 lib/rake_factory/task.rb
rake_factory-0.22.0.pre.1 lib/rake_factory/task.rb
rake_factory-0.21.0 lib/rake_factory/task.rb
rake_factory-0.20.0.pre.1 lib/rake_factory/task.rb
rake_factory-0.19.0 lib/rake_factory/task.rb
rake_factory-0.18.0.pre.2 lib/rake_factory/task.rb
rake_factory-0.18.0.pre.1 lib/rake_factory/task.rb