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.58 lib/rbbt/workflow/definition.rb
rbbt-util-5.5.57 lib/rbbt/workflow/definition.rb
rbbt-util-5.5.56 lib/rbbt/workflow/definition.rb
rbbt-util-5.5.55 lib/rbbt/workflow/definition.rb
rbbt-util-5.5.54 lib/rbbt/workflow/definition.rb
rbbt-util-5.5.53 lib/rbbt/workflow/definition.rb
rbbt-util-5.5.52 lib/rbbt/workflow/definition.rb
rbbt-util-5.5.51 lib/rbbt/workflow/definition.rb
rbbt-util-5.5.50 lib/rbbt/workflow/definition.rb
rbbt-util-5.5.49 lib/rbbt/workflow/definition.rb
rbbt-util-5.5.48 lib/rbbt/workflow/definition.rb
rbbt-util-5.5.47 lib/rbbt/workflow/definition.rb
rbbt-util-5.5.46 lib/rbbt/workflow/definition.rb
rbbt-util-5.5.45 lib/rbbt/workflow/definition.rb
rbbt-util-5.5.44 lib/rbbt/workflow/definition.rb
rbbt-util-5.5.43 lib/rbbt/workflow/definition.rb
rbbt-util-5.5.42 lib/rbbt/workflow/definition.rb
rbbt-util-5.5.41 lib/rbbt/workflow/definition.rb
rbbt-util-5.5.40 lib/rbbt/workflow/definition.rb
rbbt-util-5.5.39 lib/rbbt/workflow/definition.rb