I released a new version of Tap today that fixes a number of the
syntax flubs I described in an earlier post, and lays the groundwork
for a number of future directions like the server, debugging, and
recovery from errors.
Some links:
* Documentation:
http://tap.rubyforge.org/rdoc/index.html
* Tutorial:
http://tap.rubyforge.org/tap-suite/files/doc/Tutorial.html
* Examples:
http://tap.rubyforge.org/rdoc/files/doc/Examples/
------------ Useability ------------------------------
The latest version is a lot more command-line friendly. Tap
environment configurations can be set via ENV variables, and the dump/
load tasks are much more amenable to redirections:
=== ENV variables (TAP_GEMS as an example)
% tap run -T
# ... lists all tasks in all gems
% TAP_GEMS= tap run -T
# ... no gem tasks
% TAP_GEMS="[tap-tasks, tap-mechanize]" tap run -T
# ... tasks from tap-tasks and tap-mechanize
=== Read data from $stdin
# [goodnight.txt]
# goodnight moon
% tap run -- load --: dump < goodnight.txt
goodnight moon
=== Dump data to $stdout
% tap run -- load 'goodnight moon' --: dump > goodnight.txt
% more goodnight.txt
goodnight moon
------------ Workflows ------------------------------
Workflows are much more standard now too. Gone are things like: '--
{}', '--*', etc. Now you simply specify the inputs and outputs in a
list:
% tap run -- load a -- load b -- dump --[0,1][2]
a
b
% tap run -- load a -- dump -- dump --[0][1,2]
a
a
The '--:' sequence syntax was kept for convenience:
% tap run -- load a --: dump
a
If you need to specify a particular join class, or if you want to add
flags, they go after the inputs/outputs list. This is a synchronized
merge:
% tap run -- load a -- load b -- dump --[0,1][2].sync
ab
The sync merge creates an array of the inputs and passes them at once
to the target(s). The 'ab' output is really ['a', 'b'] dumped as a
string, which can be better visualized with some of tasks in the tap-
tasks gem:
% tap run -- load a -- load b -- dump/yaml --[0,1][2].sync
---
- a
- b
% tap run -- load a -- load b -- inspect --[0,1][2].sync
["a", "b"]
All the default joins can be thought of in terms of arrays. Syncs
make arrays, various flags adjust how arrays are passed, such as
iterate:
% tap run -- load/yaml '[1, 2]' --: inspect
[1, 2]
% tap run -- load/yaml '[1, 2]' --:i inspect
1
2
Or splat:
# actually I don't have a quick example of that... as you may expect
it's
# for cases where the target task takes multiple inputs; you splat
the
# array down like 'process(*array)'
As an FYI, you can sync and iterate, or sync and splat, or sync and
iterate+splat... whatever works.
% tap run -- load a -- load b -- dump --[0,1][2]i.sync
a
b
Note that rounds are gone now, but that's actually ok I think because
they were originally added for an issue that I think is no longer an
issue.
------------ Middleware ------------------------------
Apps now support middleware (a-la Rack) to wrap the execution of each
task. There's great opportunities for debugging/logging/auditing and
more but I haven't made any great examples yet. In fact, auditing
was removed from Tap into a separate, currently neglected project:
http://github.com/bahuvrihi/auditor/tree/master
------------ Upgrade Notes ------------------------------
Tap has gone modular. The easiest way to get all the functionality
that was in tap is to:
% gem install tap-suite
The main thing most users will run into is that the '::manifest' task
identifier is now '::task'. Additionally, a number of internals have
changed and I fixed the names of a number of methods. Take a look at
the release notes in the history for more details or post if you have
issues.
http://tap.rubyforge.org/rdoc/files/History.html
------------ TODO ------------------------------
Lots... I'm still working on getting the server working as I want.
Controllers are there, as are the nuts and bolts of building and
running workflows, but there's quite a bit to do yet.
I also haven't gotten a chance to really develop debugging and
recovery, but all in good time.
Enjoy!