Tap (Task Application)
tap n. to draw a supply from a resource
A configurable, distributable workflow framework.
Description
Tap allows the construction of workflows that may be defined, configured, and run from the command line. The tasks and joins composing a workflow are easy to test, subclass, and distribute as gems.
Tap is the core of the Tap-Suite which provides a standard library of tasks, generators, and test utilities.
Usage
Tasks are defined as subclasses of Tap::Task.
[lib/goodnight.rb]
# Goodnight::task your basic goodnight moon task
# Says goodnight with a configurable message.
class Goodnight < Tap::Task
config :message, 'goodnight' # a goodnight message
def process(name)
"#{} #{name}"
end
end
Tap automatically discovers tasks.
% tap run -T
sample:
goodnight # your basic goodnight moon task
tap:
dump # the default dump task
load # the default load task
And generates command line documentation.
% tap run -- goodnight --help
Goodnight -- your basic goodnight moon task
--------------------------------------------------------------------------------
Says goodnight with a configurable message.
--------------------------------------------------------------------------------
usage: tap run -- goodnight NAME
configurations:
--message MESSAGE a goodnight message
options:
--help Print this help
--enque Manually enques self
--config FILE Specifies a config file
Tasks are immediately available for use in workflows, and may be configured as if they were individual executables. This workflow joins the goodnight task to a dump task, which prints the message to stdout.
% tap run -- goodnight moon --: dump
goodnight moon
% tap run -- goodnight world --message hello --: dump
hello world
Workflow Syntax
Workflows are specified on the command line using argument vectors separated by option breaks (ie ‘–’). The argument vectors define the tasks while modifications to the breaks specify joins.
A simple sequence.
% tap run -- load 'goodnight moon' --: dump
goodnight moon
A more formal way of specifying a sequence.
% tap run -- load 'goodnight moon' -- dump --[0][1]
goodnight moon
A fork.
% tap run -- load 'goodnight moon' -- dump -- dump --[0][1,2]
goodnight moon
goodnight moon
A merge (note that dump receives the inputs in serial).
% tap run -- load goodnight -- load moon -- dump --[0,1][2]
goodnight
moon
A synchronized merge (the printout is ['goodnight', 'moon'].to_s
).
% tap run -- load goodnight -- load moon -- dump --[0,1][2].sync
goodnightmoon
Installation
Tap is available as a gem on Gemcutter.
% gem install tap
Info
- Developer
- License