Sha256: 6a4b28329720330ba91ef05edd2d94b0f69cb65a0eb2396ba960df886e6996f7

Contents?: true

Size: 1.69 KB

Versions: 69

Compression:

Stored size: 1.69 KB

Contents

require 'rbbt-util'
require 'rbbt/workflow/annotate'

module Workflow
  include AnnotatedModule


  AnnotatedModule.add_consummable_annotation(self,
                                             :result_description => "",
                                             :result_type        => nil,
                                             :dependencies       => [])
  def helper(name, &block)
    helpers[name] = block
  end

  def desc(description)
    @description = description
  end

  def returns(description)
    @result_description = description
  end

  def dep(*dependency_list, &block)
    dependency_list << block if block_given?
    dependencies.concat dependency_list
  end

  def task(name, &block)
    if Hash === name
      type = name.first.last
      name = name.first.first
    else
      result_type = consume_result_type || :marshal
    end

    name = name.to_sym

    block = self.method(name) unless block_given?

    task_info = {
      :name => name,
      :inputs             => consume_inputs,
      :description        => consume_description,
      :input_types        => consume_input_types,
      :result_type        => (Array === type ? type.to_sym : type),
      :input_defaults     => consume_input_defaults,
      :input_descriptions => consume_input_descriptions,
      :input_options      => consume_input_options
    }
    
    task = Task.setup(task_info, &block)

    last_task = task

    tasks[name] = task
    task_dependencies[name] = consume_dependencies
  end
  
  def export_exec(*names)
    exec_exports.concat names
  end

  def export_asynchronous(*names)
    asynchronous_exports.concat names
  end

  def export_synchronous(*names)
    synchronous_exports.concat names
  end
end

Version data entries

69 entries across 69 versions & 1 rubygems

Version Path
rbbt-util-5.5.38 lib/rbbt/workflow/definition.rb
rbbt-util-5.5.37 lib/rbbt/workflow/definition.rb
rbbt-util-5.5.36 lib/rbbt/workflow/definition.rb
rbbt-util-5.5.35 lib/rbbt/workflow/definition.rb
rbbt-util-5.5.34 lib/rbbt/workflow/definition.rb
rbbt-util-5.5.33 lib/rbbt/workflow/definition.rb
rbbt-util-5.5.32 lib/rbbt/workflow/definition.rb
rbbt-util-5.5.31 lib/rbbt/workflow/definition.rb
rbbt-util-5.5.30 lib/rbbt/workflow/definition.rb
rbbt-util-5.5.29 lib/rbbt/workflow/definition.rb
rbbt-util-5.5.28 lib/rbbt/workflow/definition.rb
rbbt-util-5.5.27 lib/rbbt/workflow/definition.rb
rbbt-util-5.5.26 lib/rbbt/workflow/definition.rb
rbbt-util-5.5.25 lib/rbbt/workflow/definition.rb
rbbt-util-5.5.24 lib/rbbt/workflow/definition.rb
rbbt-util-5.5.23 lib/rbbt/workflow/definition.rb
rbbt-util-5.5.22 lib/rbbt/workflow/definition.rb
rbbt-util-5.5.21 lib/rbbt/workflow/definition.rb
rbbt-util-5.5.20 lib/rbbt/workflow/definition.rb
rbbt-util-5.5.19 lib/rbbt/workflow/definition.rb