Sha256: 3e9cfd0736cc4b8ca30712fa59584109efa1956e7b3261266ce6aaa46b34900b

Contents?: true

Size: 1.12 KB

Versions: 1

Compression:

Stored size: 1.12 KB

Contents

module Wukong
  class Workflow < Hanuman::Graph

    class ActionWithInputs < Hanuman::Action
      include Hanuman::Slottable
      include Hanuman::SplatInputs
      include Hanuman::SplatOutputs

      def self.make(workflow, *input_stages, &block)
        options  = input_stages.extract_options!
        stage    = new
        workflow.add_stage stage
        input_stages.map do |input|
          workflow.connect(input, stage)
        end
        stage.receive!(options, &block)
        stage
      end
    end

    #
    # A command is a workflow action that runs a type of command on many inputs,
    # under a given configuration, into named outputs.
    #
    # @example
    #   bash 'create_archive.sh', filenames, :compression_level => 9 > 'archive.tar.gz'
    #
    class Command < ActionWithInputs

      def self.make(workflow, stage_name, *input_stages, &block)
        options  = input_stages.extract_options!
        super(workflow, *input_stages, options.merge(:name => stage_name, :script => stage_name), &block)
      end
    end

    class Shell < Command
      field :script, String
      register_action
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
wukong-3.0.0.pre lib/wukong/workflow/command.rb