Skip to content
A framework for creating configurable, distributable tasks and workflows.
Ruby JavaScript
Latest commit 87d676f Jan 9, 2011 @thinkerbot version tap-tasks-0.8.0


Tap (Task Application)

tap n. to draw a supply from a resource

A configurable, distributable workflow framework.


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 provides a standard library of tasks, generators, and test modules to expedite development.


Tasks are defined as subclasses of Tap::Task.

require 'tap/task'
# ::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)
    "#{message} #{name}"

Tap discovers tasks.

% tap list
  dump                 # dump data
  goodnight            # your basic goodnight moon task
  list                 # list resources
  load                 # load data
  prompt               # open a prompt
  signal               # signal via a task
  gate                 # collects results
  join                 # unsyncrhonized multi-way join
  sync                 # synchronized multi-way join
  debugger             # default debugger

Generates command-line documentation.

% tap goodnight --help
Goodnight -- your basic goodnight moon task
  Says goodnight with a configurable message.
usage: tap goodnight NAME
        --message MESSAGE            a goodnight message
        --help                       Print this help
        --config FILE                Specifies a config file

And provides a robust syntax for building both simple and complex workflows. This joins a goodnight task to a dump task in order to print the goodnight message.

% tap goodnight moon -: dump
goodnight moon
% tap goodnight world --message hello -: dump
hello world

Workflows support the use of middleware to wrap the execution of each task, most commonly for logging and/or debugging.

% tap goodnight moon -: dump --/use debugger
  21:06:53       0 << ["moon"] (Goodnight)
  21:06:53       0 >> "goodnight moon" (Goodnight)
  21:06:53       1 << "goodnight moon" (Tap::Tasks::Dump)
goodnight moon
  21:06:53       1 >> "goodnight moon" (Tap::Tasks::Dump)

Tap provides a set of test modules to simplify testing of workflows both off and on the command-line (this documentation is tested, for example):

require 'tap/test/unit'
class ShellTestTest < Test::Unit::TestCase
  def test_goodnight_moon
    sh_test %q{
    % tap load 'goodnight moon' -: dump
    goodnight moon

Tasks can be packaged into gems like any other code. Tap automatically finds tasks in gems containing a tap.yml file so that distribution feels normal and unobtrusive.

% tap load/yaml
unresolvable constant: "load/yaml"
% gem install tap-tasks
% tap load/yaml "[1, 2, 3]" -: dump/yaml
- 1
- 2
- 3

For local tasks that don't need to be distributed, Tap provides declarations a-la Rake. By default any tasks in a tapfile are available for use.

desc "concat file contents"
task :cat do |config, *files|
  files.collect {|file| }.join
desc "grep lines"
task :grep, :e => '.' do |config, str|
% tap cat tapfile -:a grep -e task -:i dump
task :cat do |config, *files|
task :grep, :e => '.' do |config, str|

See the documentation for a greater explanation of the workflow syntax, several common patterns, and the underlying APIs.


Tap is available as a gem on Gemcutter.

% gem install tap



Simon Chiang



Something went wrong with that request. Please try again.