tap 0.12.4 → 0.17.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History +34 -0
- data/README +62 -41
- data/bin/tap +36 -40
- data/cmd/console.rb +14 -6
- data/cmd/manifest.rb +62 -58
- data/cmd/run.rb +49 -31
- data/doc/API +84 -0
- data/doc/Class Reference +83 -115
- data/doc/Examples/Command Line +36 -0
- data/doc/Examples/Workflow +40 -0
- data/lib/tap/app.rb +293 -214
- data/lib/tap/app/node.rb +43 -0
- data/lib/tap/app/queue.rb +77 -0
- data/lib/tap/app/stack.rb +16 -0
- data/lib/tap/app/state.rb +22 -0
- data/lib/tap/constants.rb +2 -2
- data/lib/tap/env.rb +400 -314
- data/lib/tap/env/constant.rb +227 -0
- data/lib/tap/env/gems.rb +63 -0
- data/lib/tap/env/manifest.rb +89 -0
- data/lib/tap/env/minimap.rb +292 -0
- data/lib/tap/{support → env}/string_ext.rb +2 -2
- data/lib/tap/exe.rb +113 -125
- data/lib/tap/join.rb +175 -0
- data/lib/tap/joins.rb +9 -0
- data/lib/tap/joins/switch.rb +44 -0
- data/lib/tap/joins/sync.rb +99 -0
- data/lib/tap/root.rb +100 -491
- data/lib/tap/root/utils.rb +220 -0
- data/lib/tap/{support → root}/versions.rb +31 -29
- data/lib/tap/schema.rb +248 -0
- data/lib/tap/schema/parser.rb +413 -0
- data/lib/tap/schema/utils.rb +82 -0
- data/lib/tap/support/intern.rb +19 -6
- data/lib/tap/support/templater.rb +8 -3
- data/lib/tap/task.rb +175 -171
- data/lib/tap/tasks/dump.rb +58 -0
- data/lib/tap/tasks/load.rb +62 -0
- metadata +30 -73
- data/cmd/destroy.rb +0 -27
- data/cmd/generate.rb +0 -27
- data/doc/Command Reference +0 -105
- data/doc/Syntax Reference +0 -234
- data/doc/Tutorial +0 -348
- data/lib/tap/dump.rb +0 -142
- data/lib/tap/file_task.rb +0 -384
- data/lib/tap/generator/arguments.rb +0 -13
- data/lib/tap/generator/base.rb +0 -176
- data/lib/tap/generator/destroy.rb +0 -60
- data/lib/tap/generator/generate.rb +0 -93
- data/lib/tap/generator/generators/command/command_generator.rb +0 -21
- data/lib/tap/generator/generators/command/templates/command.erb +0 -32
- data/lib/tap/generator/generators/config/config_generator.rb +0 -98
- data/lib/tap/generator/generators/generator/generator_generator.rb +0 -37
- data/lib/tap/generator/generators/generator/templates/task.erb +0 -27
- data/lib/tap/generator/generators/generator/templates/test.erb +0 -26
- data/lib/tap/generator/generators/root/root_generator.rb +0 -84
- data/lib/tap/generator/generators/root/templates/MIT-LICENSE +0 -22
- data/lib/tap/generator/generators/root/templates/README +0 -14
- data/lib/tap/generator/generators/root/templates/Rakefile +0 -84
- data/lib/tap/generator/generators/root/templates/Rapfile +0 -11
- data/lib/tap/generator/generators/root/templates/gemspec +0 -27
- data/lib/tap/generator/generators/root/templates/test/tap_test_helper.rb +0 -3
- data/lib/tap/generator/generators/task/task_generator.rb +0 -25
- data/lib/tap/generator/generators/task/templates/task.erb +0 -14
- data/lib/tap/generator/generators/task/templates/test.erb +0 -19
- data/lib/tap/generator/manifest.rb +0 -20
- data/lib/tap/generator/preview.rb +0 -69
- data/lib/tap/load.rb +0 -64
- data/lib/tap/spec.rb +0 -41
- data/lib/tap/support/aggregator.rb +0 -65
- data/lib/tap/support/audit.rb +0 -333
- data/lib/tap/support/constant.rb +0 -143
- data/lib/tap/support/constant_manifest.rb +0 -126
- data/lib/tap/support/dependencies.rb +0 -54
- data/lib/tap/support/dependency.rb +0 -44
- data/lib/tap/support/executable.rb +0 -198
- data/lib/tap/support/executable_queue.rb +0 -125
- data/lib/tap/support/gems.rb +0 -43
- data/lib/tap/support/join.rb +0 -144
- data/lib/tap/support/joins.rb +0 -12
- data/lib/tap/support/joins/switch.rb +0 -27
- data/lib/tap/support/joins/sync_merge.rb +0 -38
- data/lib/tap/support/manifest.rb +0 -171
- data/lib/tap/support/minimap.rb +0 -90
- data/lib/tap/support/node.rb +0 -176
- data/lib/tap/support/parser.rb +0 -450
- data/lib/tap/support/schema.rb +0 -385
- data/lib/tap/support/shell_utils.rb +0 -67
- data/lib/tap/test.rb +0 -77
- data/lib/tap/test/assertions.rb +0 -38
- data/lib/tap/test/env_vars.rb +0 -29
- data/lib/tap/test/extensions.rb +0 -73
- data/lib/tap/test/file_test.rb +0 -362
- data/lib/tap/test/file_test_class.rb +0 -15
- data/lib/tap/test/regexp_escape.rb +0 -87
- data/lib/tap/test/script_test.rb +0 -46
- data/lib/tap/test/script_tester.rb +0 -115
- data/lib/tap/test/subset_test.rb +0 -260
- data/lib/tap/test/subset_test_class.rb +0 -99
- data/lib/tap/test/tap_test.rb +0 -109
- data/lib/tap/test/utils.rb +0 -231
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'tap/task'
|
2
|
+
|
3
|
+
module Tap
|
4
|
+
module Tasks
|
5
|
+
# :startdoc::task the default dump task
|
6
|
+
#
|
7
|
+
# Dumps data to $stdout or a file output.
|
8
|
+
#
|
9
|
+
# % tap run -- dump content --output FILEPATH
|
10
|
+
#
|
11
|
+
# Dump faciliates normal redirection:
|
12
|
+
#
|
13
|
+
# % tap run -- load hello --: dump | more
|
14
|
+
# hello
|
15
|
+
#
|
16
|
+
# % tap run -- load hello --: dump 1> results.txt
|
17
|
+
# % more results.txt
|
18
|
+
# hello
|
19
|
+
#
|
20
|
+
# Note that dumps are appended to the file. Dump only accepts one object
|
21
|
+
# at a time, so joins that produce an array (like sync) need to iterate
|
22
|
+
# outputs to dump:
|
23
|
+
#
|
24
|
+
# % tap run -- load hello -- load world -- dump --[0,1][2]i.sync
|
25
|
+
# hello
|
26
|
+
# world
|
27
|
+
#
|
28
|
+
# :startdoc::task-
|
29
|
+
#
|
30
|
+
# Dump serves as a baseclass for more complicated dumps. A YAML dump
|
31
|
+
# (see {tap-tasks}[http://tap.rubyforge.org/tap-tasks]) looks like this:
|
32
|
+
#
|
33
|
+
# class Yaml < Tap::Dump
|
34
|
+
# def dump(obj, io)
|
35
|
+
# YAML.dump(obj, io)
|
36
|
+
# end
|
37
|
+
# end
|
38
|
+
#
|
39
|
+
class Dump < Tap::Task
|
40
|
+
config :output, $stdout, &c.io(:<<, :puts, :print) # The dump target file
|
41
|
+
config :overwrite, false, &c.flag # Overwrite the existing target
|
42
|
+
|
43
|
+
# The default process prints dump headers as specified in the config,
|
44
|
+
# then append the audit value to io.
|
45
|
+
def process(input)
|
46
|
+
open_io(output, overwrite ? 'w' : 'a') do |io|
|
47
|
+
dump(input, io)
|
48
|
+
end
|
49
|
+
output
|
50
|
+
end
|
51
|
+
|
52
|
+
# Dumps the object to io, by default dump puts (not prints) obj.to_s.
|
53
|
+
def dump(input, io)
|
54
|
+
io.puts input.to_s
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
require 'tap/task'
|
2
|
+
require 'stringio'
|
3
|
+
|
4
|
+
module Tap
|
5
|
+
module Tasks
|
6
|
+
# :startdoc::task the default load task
|
7
|
+
#
|
8
|
+
# Loads data from $stdin. String data may be passed directly. Load
|
9
|
+
# is typically used as a gateway to other tasks.
|
10
|
+
#
|
11
|
+
# % tap run -- load string --: dump
|
12
|
+
# string
|
13
|
+
#
|
14
|
+
# Load facilitates normal redirection:
|
15
|
+
#
|
16
|
+
# % echo goodnight moon | tap run -- load --: dump
|
17
|
+
# goodnight moon
|
18
|
+
#
|
19
|
+
# % tap run -- load --: dump < somefile.txt
|
20
|
+
# contents of somefile
|
21
|
+
#
|
22
|
+
# :startdoc::task-
|
23
|
+
#
|
24
|
+
# Load serves as a baseclass for more complicated loads. A YAML load
|
25
|
+
# (see {tap-tasks}[http://tap.rubyforge.org/tap-tasks]) looks like this:
|
26
|
+
#
|
27
|
+
# class Yaml < Tap::Load
|
28
|
+
# def load(io)
|
29
|
+
# YAML.load(io)
|
30
|
+
# end
|
31
|
+
# end
|
32
|
+
#
|
33
|
+
class Load < Tap::Task
|
34
|
+
|
35
|
+
config :file, false, &c.flag # opens the input as a file
|
36
|
+
|
37
|
+
# The default process simply reads the input data and returns it.
|
38
|
+
# See load.
|
39
|
+
def process(io=$stdin)
|
40
|
+
# read on an empty stdin ties up the command line;
|
41
|
+
# this facilitates the intended behavior
|
42
|
+
if io.kind_of?(IO) && io.stat.size == 0
|
43
|
+
io = ''
|
44
|
+
end
|
45
|
+
|
46
|
+
if io.kind_of?(String)
|
47
|
+
io = StringIO.new(io)
|
48
|
+
end unless file
|
49
|
+
|
50
|
+
open_io(io) do |data|
|
51
|
+
load(data)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
# Loads data from the io; the return of load is the return of process. By
|
56
|
+
# default load simply reads data from io.
|
57
|
+
def load(io)
|
58
|
+
io.read
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.17.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Simon Chiang
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-05-25 00:00:00 -06:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -20,7 +20,7 @@ dependencies:
|
|
20
20
|
requirements:
|
21
21
|
- - ">="
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: 0.
|
23
|
+
version: 0.5.0
|
24
24
|
version:
|
25
25
|
description:
|
26
26
|
email: simon.a.chiang@gmail.com
|
@@ -32,93 +32,50 @@ extra_rdoc_files:
|
|
32
32
|
- README
|
33
33
|
- MIT-LICENSE
|
34
34
|
- History
|
35
|
+
- doc/API
|
35
36
|
- doc/Class Reference
|
36
|
-
- doc/Command
|
37
|
-
- doc/
|
38
|
-
- doc/Tutorial
|
37
|
+
- doc/Examples/Command Line
|
38
|
+
- doc/Examples/Workflow
|
39
39
|
files:
|
40
40
|
- cmd/console.rb
|
41
|
-
- cmd/destroy.rb
|
42
|
-
- cmd/generate.rb
|
43
41
|
- cmd/manifest.rb
|
44
42
|
- cmd/run.rb
|
45
|
-
- bin/tap
|
46
43
|
- lib/tap.rb
|
47
44
|
- lib/tap/app.rb
|
45
|
+
- lib/tap/app/node.rb
|
46
|
+
- lib/tap/app/queue.rb
|
47
|
+
- lib/tap/app/stack.rb
|
48
|
+
- lib/tap/app/state.rb
|
48
49
|
- lib/tap/constants.rb
|
50
|
+
- lib/tap/tasks/dump.rb
|
49
51
|
- lib/tap/env.rb
|
52
|
+
- lib/tap/env/constant.rb
|
53
|
+
- lib/tap/env/gems.rb
|
54
|
+
- lib/tap/env/manifest.rb
|
55
|
+
- lib/tap/env/minimap.rb
|
56
|
+
- lib/tap/env/string_ext.rb
|
50
57
|
- lib/tap/exe.rb
|
51
|
-
- lib/tap/
|
52
|
-
- lib/tap/
|
53
|
-
- lib/tap/
|
54
|
-
- lib/tap/
|
55
|
-
- lib/tap/
|
56
|
-
- lib/tap/generator/generators/command/command_generator.rb
|
57
|
-
- lib/tap/generator/generators/command/templates/command.erb
|
58
|
-
- lib/tap/generator/generators/config/config_generator.rb
|
59
|
-
- lib/tap/generator/generators/generator/generator_generator.rb
|
60
|
-
- lib/tap/generator/generators/generator/templates/task.erb
|
61
|
-
- lib/tap/generator/generators/generator/templates/test.erb
|
62
|
-
- lib/tap/generator/generators/root/root_generator.rb
|
63
|
-
- lib/tap/generator/generators/root/templates/MIT-LICENSE
|
64
|
-
- lib/tap/generator/generators/root/templates/README
|
65
|
-
- lib/tap/generator/generators/root/templates/Rakefile
|
66
|
-
- lib/tap/generator/generators/root/templates/Rapfile
|
67
|
-
- lib/tap/generator/generators/root/templates/gemspec
|
68
|
-
- lib/tap/generator/generators/root/templates/test/tap_test_helper.rb
|
69
|
-
- lib/tap/generator/generators/task/task_generator.rb
|
70
|
-
- lib/tap/generator/generators/task/templates/task.erb
|
71
|
-
- lib/tap/generator/generators/task/templates/test.erb
|
72
|
-
- lib/tap/generator/manifest.rb
|
73
|
-
- lib/tap/generator/preview.rb
|
58
|
+
- lib/tap/join.rb
|
59
|
+
- lib/tap/joins.rb
|
60
|
+
- lib/tap/joins/switch.rb
|
61
|
+
- lib/tap/joins/sync.rb
|
62
|
+
- lib/tap/tasks/load.rb
|
74
63
|
- lib/tap/root.rb
|
75
|
-
- lib/tap/
|
76
|
-
- lib/tap/
|
77
|
-
- lib/tap/
|
78
|
-
- lib/tap/
|
79
|
-
- lib/tap/
|
80
|
-
- lib/tap/support/dependencies.rb
|
81
|
-
- lib/tap/support/dependency.rb
|
82
|
-
- lib/tap/support/executable.rb
|
83
|
-
- lib/tap/support/executable_queue.rb
|
84
|
-
- lib/tap/support/gems.rb
|
64
|
+
- lib/tap/root/utils.rb
|
65
|
+
- lib/tap/root/versions.rb
|
66
|
+
- lib/tap/schema.rb
|
67
|
+
- lib/tap/schema/parser.rb
|
68
|
+
- lib/tap/schema/utils.rb
|
85
69
|
- lib/tap/support/intern.rb
|
86
|
-
- lib/tap/support/join.rb
|
87
|
-
- lib/tap/support/joins.rb
|
88
|
-
- lib/tap/support/joins/switch.rb
|
89
|
-
- lib/tap/support/joins/sync_merge.rb
|
90
|
-
- lib/tap/support/manifest.rb
|
91
|
-
- lib/tap/support/minimap.rb
|
92
|
-
- lib/tap/support/node.rb
|
93
|
-
- lib/tap/support/parser.rb
|
94
|
-
- lib/tap/support/schema.rb
|
95
|
-
- lib/tap/support/shell_utils.rb
|
96
|
-
- lib/tap/support/string_ext.rb
|
97
70
|
- lib/tap/support/templater.rb
|
98
|
-
- lib/tap/support/versions.rb
|
99
71
|
- lib/tap/task.rb
|
100
|
-
- lib/tap/dump.rb
|
101
|
-
- lib/tap/load.rb
|
102
|
-
- lib/tap/test.rb
|
103
|
-
- lib/tap/test/assertions.rb
|
104
|
-
- lib/tap/test/env_vars.rb
|
105
|
-
- lib/tap/test/extensions.rb
|
106
|
-
- lib/tap/test/file_test.rb
|
107
|
-
- lib/tap/test/file_test_class.rb
|
108
|
-
- lib/tap/test/regexp_escape.rb
|
109
|
-
- lib/tap/test/script_test.rb
|
110
|
-
- lib/tap/test/script_tester.rb
|
111
|
-
- lib/tap/test/subset_test.rb
|
112
|
-
- lib/tap/test/subset_test_class.rb
|
113
|
-
- lib/tap/test/tap_test.rb
|
114
|
-
- lib/tap/test/utils.rb
|
115
72
|
- README
|
116
73
|
- MIT-LICENSE
|
117
74
|
- History
|
75
|
+
- doc/API
|
118
76
|
- doc/Class Reference
|
119
|
-
- doc/Command
|
120
|
-
- doc/
|
121
|
-
- doc/Tutorial
|
77
|
+
- doc/Examples/Command Line
|
78
|
+
- doc/Examples/Workflow
|
122
79
|
has_rdoc: true
|
123
80
|
homepage: http://tap.rubyforge.org
|
124
81
|
post_install_message:
|
@@ -149,6 +106,6 @@ rubyforge_project: tap
|
|
149
106
|
rubygems_version: 1.3.1
|
150
107
|
signing_key:
|
151
108
|
specification_version: 2
|
152
|
-
summary: A
|
109
|
+
summary: A configurable, distributable workflow framework.
|
153
110
|
test_files: []
|
154
111
|
|
data/cmd/destroy.rb
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
# usage: tap destroy GENERATOR ...
|
2
|
-
#
|
3
|
-
# Runs a generator in reverse. Each generator works a little differently; the
|
4
|
-
# best way to figure out what a generator does is to use --help. For example:
|
5
|
-
#
|
6
|
-
# % tap generate root --help
|
7
|
-
#
|
8
|
-
|
9
|
-
require 'tap/generator/base'
|
10
|
-
require 'tap/generator/destroy'
|
11
|
-
|
12
|
-
env = Tap::Env.instance
|
13
|
-
|
14
|
-
if ARGV.empty? || ARGV == ['--help']
|
15
|
-
puts Lazydoc.usage(__FILE__)
|
16
|
-
puts
|
17
|
-
puts "generators:"
|
18
|
-
puts env.summarize(:generators)
|
19
|
-
exit
|
20
|
-
end
|
21
|
-
|
22
|
-
name = ARGV.shift
|
23
|
-
const = env.generators.search(name) or raise "unknown generator: #{name}"
|
24
|
-
|
25
|
-
generator_class = const.constantize
|
26
|
-
generator, argv = generator_class.parse(ARGV)
|
27
|
-
generator.extend(Tap::Generator::Destroy).process(*argv)
|
data/cmd/generate.rb
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
# usage: tap generate GENERATOR ...
|
2
|
-
#
|
3
|
-
# Runs a generator. Each generator works a little differently; the best way to
|
4
|
-
# figure out what a generator does is to use --help. For example:
|
5
|
-
#
|
6
|
-
# % tap generate root --help
|
7
|
-
#
|
8
|
-
|
9
|
-
require 'tap/generator/base'
|
10
|
-
require 'tap/generator/generate'
|
11
|
-
|
12
|
-
env = Tap::Env.instance
|
13
|
-
|
14
|
-
if ARGV.empty? || ARGV == ['--help']
|
15
|
-
puts Lazydoc.usage(__FILE__)
|
16
|
-
puts
|
17
|
-
puts "generators:"
|
18
|
-
puts env.summarize(:generators)
|
19
|
-
exit
|
20
|
-
end
|
21
|
-
|
22
|
-
name = ARGV.shift
|
23
|
-
const = env.generators.search(name) or raise "unknown generator: #{name}"
|
24
|
-
|
25
|
-
generator_class = const.constantize
|
26
|
-
generator, argv = generator_class.parse(ARGV)
|
27
|
-
generator.extend(Tap::Generator::Generate).process(*argv)
|
data/doc/Command Reference
DELETED
@@ -1,105 +0,0 @@
|
|
1
|
-
= Command Reference
|
2
|
-
|
3
|
-
Tap comes the tap executable. For help on the command line, type:
|
4
|
-
|
5
|
-
% tap --help
|
6
|
-
|
7
|
-
== console
|
8
|
-
|
9
|
-
Console opens an irb session after loading the tap environment. Console
|
10
|
-
defines variables 'app' and 'env' referencing Tap::App.instance and
|
11
|
-
Tap::Env.instance, for easy access.
|
12
|
-
|
13
|
-
% tap console
|
14
|
-
irb(main):001:0> app.log(:hello)
|
15
|
-
I[17:18:53] hello
|
16
|
-
=> true
|
17
|
-
irb(main):002:0>
|
18
|
-
|
19
|
-
== generate/destroy
|
20
|
-
|
21
|
-
Generate and destroy launch generator scripts, similar to those in
|
22
|
-
{Rails}[http://www.rubyonrails.org/]. By default Tap provides generators for:
|
23
|
-
|
24
|
-
{command}[link:classes/Tap/Generator/Generators/CommandGenerator.html]:: a new command
|
25
|
-
{config}[link:classes/Tap/Generator/Generators/ConfigGenerator.html]:: a static config file for the specified task
|
26
|
-
{generator}[link:classes/Tap/Generator/Generators/GeneratorGenerator.html]:: a new generator
|
27
|
-
{root}[link:classes/Tap/Generator/Generators/RootGenerator.html]:: the basic directory structure
|
28
|
-
{task}[link:classes/Tap/Generator/Generators/TaskGenerator.html]:: a task class and test
|
29
|
-
|
30
|
-
For example:
|
31
|
-
|
32
|
-
% tap generate root .
|
33
|
-
% tap generate task sample_task
|
34
|
-
% tap generate config sample_task
|
35
|
-
|
36
|
-
% tap destroy config sample_task
|
37
|
-
% tap destroy task sample_task
|
38
|
-
% tap destroy root .
|
39
|
-
|
40
|
-
Each generator works a little differently. For help:
|
41
|
-
|
42
|
-
% tap generate --help
|
43
|
-
% tap generate <generator> --help
|
44
|
-
|
45
|
-
== manifest
|
46
|
-
|
47
|
-
Manifest prints a list of all resources (commands, tasks, generators, etc)
|
48
|
-
available to tap. Environments are listed in the same order as they are
|
49
|
-
searched, and at the end a tree diagram is printed showing how the
|
50
|
-
environments are nested.
|
51
|
-
|
52
|
-
% tap manifest
|
53
|
-
--------------------------------------------------------------------------------
|
54
|
-
Desktop: (/Users/username/Desktop)
|
55
|
-
--------------------------------------------------------------------------------
|
56
|
-
tap: (/Library/Ruby/Gems/1.8/gems/tap-0.10.8)
|
57
|
-
generators
|
58
|
-
command (lib/tap/generator/generators/command/command_generator.rb)
|
59
|
-
config (lib/tap/generator/generators/config/config_generator.rb)
|
60
|
-
generator (lib/tap/generator/generators/generator/generator_generator.rb)
|
61
|
-
root (lib/tap/generator/generators/root/root_generator.rb)
|
62
|
-
task (lib/tap/generator/generators/task/task_generator.rb)
|
63
|
-
commands
|
64
|
-
console (cmd/console.rb)
|
65
|
-
destroy (cmd/destroy.rb)
|
66
|
-
generate (cmd/generate.rb)
|
67
|
-
manifest (cmd/manifest.rb)
|
68
|
-
run (cmd/run.rb)
|
69
|
-
tasks
|
70
|
-
dump (lib/tap/tasks/dump.rb)
|
71
|
-
load (lib/tap/tasks/load.rb)
|
72
|
-
rake (lib/tap/tasks/rake.rb)
|
73
|
-
--------------------------------------------------------------------------------
|
74
|
-
|
75
|
-
Desktop
|
76
|
-
`- tap
|
77
|
-
|
78
|
-
== run
|
79
|
-
|
80
|
-
Run configures, enqueues, and executes tasks. Run has a rich syntax allowing
|
81
|
-
the specification of any number of tasks with configurations and inputs, but
|
82
|
-
simplifies under most circumstances. The run syntax is detailed in the {Syntax Reference}[link:files/doc/Syntax%20Reference.html], but a couple examples
|
83
|
-
illustrate the key points:
|
84
|
-
|
85
|
-
% tap run sample/task
|
86
|
-
% tap run -- sample/task --key=value input_one -- another/task input_two
|
87
|
-
|
88
|
-
The second statement specifies two tasks with inputs, and specifies a
|
89
|
-
configuration for sample/task. As can be seen, run separates tasks using a
|
90
|
-
double-dash, the standard option break. Options for the run command can be
|
91
|
-
specified before the first break.
|
92
|
-
|
93
|
-
% tap run --debug -- sample/task --key=value
|
94
|
-
|
95
|
-
Here run receives the <tt>--debug</tt> option and sample/task receives the
|
96
|
-
<tt>--key=value</tt> option. Inputs work the same way. For example:
|
97
|
-
|
98
|
-
% tap run -- sample/task --key=value one -- another/task two three
|
99
|
-
|
100
|
-
Specifies the following:
|
101
|
-
|
102
|
-
Sample::Task.new(:key => 'value').enq('one')
|
103
|
-
Another::Task.new.enq('two', 'three')
|
104
|
-
|
105
|
-
Any number of tasks, configurations, and inputs may be specified in this way.
|
data/doc/Syntax Reference
DELETED
@@ -1,234 +0,0 @@
|
|
1
|
-
= Syntax Reference
|
2
|
-
|
3
|
-
Tap uses several domain-specific languages to declare tasks and workflows.
|
4
|
-
This is a reference for:
|
5
|
-
|
6
|
-
* class definitions
|
7
|
-
* workflows
|
8
|
-
|
9
|
-
== Task Classes
|
10
|
-
|
11
|
-
This is a verbose prototype for Tap::Task subclasses:
|
12
|
-
|
13
|
-
# <ClassName>::manifest summary description
|
14
|
-
#
|
15
|
-
# Extended documentation...
|
16
|
-
#
|
17
|
-
class ClassName < Tap::Task
|
18
|
-
|
19
|
-
# Sets up a configuration and makes the 'key' and 'key=' accessors.
|
20
|
-
#
|
21
|
-
# This documentation appears in static config files, and in RDoc.
|
22
|
-
#
|
23
|
-
config :key, 'default value' do |value| # config summary
|
24
|
-
"the config is set to the return value"
|
25
|
-
end
|
26
|
-
|
27
|
-
# Subclasses BaseClass with the specified configs, using the block
|
28
|
-
# to override process.
|
29
|
-
#
|
30
|
-
# Also creates the methods 'name', 'name_config', 'name_config='.
|
31
|
-
# The first will access an instance-specific instance of the
|
32
|
-
# subclass, the other two are accessors for the instance configs.
|
33
|
-
#
|
34
|
-
# Primarily used in conjunction with workflow.
|
35
|
-
#
|
36
|
-
define :name, <BaseClass>, {<configs>} do |*args|
|
37
|
-
# this is the process block
|
38
|
-
end
|
39
|
-
|
40
|
-
# Causes each instance to depend on DependencyClass.instance.
|
41
|
-
#
|
42
|
-
# Also defines a reader 'name' which will access the results
|
43
|
-
# of the dependency.
|
44
|
-
depends_on :name, <DependencyClass>
|
45
|
-
|
46
|
-
def process(*args)
|
47
|
-
# the method defining what this task does
|
48
|
-
end
|
49
|
-
|
50
|
-
protected
|
51
|
-
|
52
|
-
def workflow
|
53
|
-
# a hook to setup joins between various tasks used
|
54
|
-
# by the current instance. workflow is called
|
55
|
-
# during initialize
|
56
|
-
end
|
57
|
-
|
58
|
-
def before_execute()
|
59
|
-
# a hook to execute code before process
|
60
|
-
# (only works in workflows)
|
61
|
-
end
|
62
|
-
|
63
|
-
def after_execute()
|
64
|
-
# a hook to execute code after process
|
65
|
-
# (only works in workflows)
|
66
|
-
end
|
67
|
-
|
68
|
-
def on_execute_error(err)
|
69
|
-
# a hook to handle errors during process
|
70
|
-
# (only works in workflows)
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
== Workflows
|
75
|
-
|
76
|
-
The tap workflow syntax is designed to specify an arbitrary number of tasks,
|
77
|
-
inputs, configurations, and joins. The syntax works both as text and as YAML;
|
78
|
-
'tap run' uses it to specify which tasks to execute. Basically, the syntax
|
79
|
-
uses double-dash delimiters to separate task vectors and modified delimiters
|
80
|
-
to specify joins for the tasks.
|
81
|
-
|
82
|
-
These both specify three tasks (x,y,z) joined in a sequence:
|
83
|
-
|
84
|
-
% tap run -- x --: y --: z
|
85
|
-
% tap run -- x -- y -- z --0:1:2
|
86
|
-
|
87
|
-
The modified delimiters use numbers to indicate which tasks participate in a
|
88
|
-
join and punctuation to indicate the join type. In the first example, the
|
89
|
-
numbers are implicitly added for the preceding and following task. A variety
|
90
|
-
of joins are supported:
|
91
|
-
|
92
|
-
delimiter function syntax example meaning
|
93
|
-
-- delimiter a -- b -- c enques/configures tasks a, b, c
|
94
|
-
--* dependency --* a enques dependency instance
|
95
|
-
--+ round --+ a --++ b enques a to round one, b to round two
|
96
|
-
--+[] round shorthand +round[targets] --+2[0,1] enques (a,b) to round two
|
97
|
-
|
98
|
-
--: sequence source:target --0:1:2 sequence a, b, c
|
99
|
-
--[] fork source[targets...] --0[1,2] fork a to (b,c)
|
100
|
-
--{} merge target{sources...} --2{0,1} merge (a,b) to c
|
101
|
-
--() sync_merge target(sources...) --2(0,1) synchronize merge (a,b) to c
|
102
|
-
|
103
|
-
Inputs may be specified between delimiters:
|
104
|
-
|
105
|
-
% tap run -- x alpha beta --: y gamma --: z delta
|
106
|
-
|
107
|
-
As may be configurations, in a variety of formats:
|
108
|
-
|
109
|
-
% tap run -- x alpha beta -k --: y gamma --key value --: z delta --key=value
|
110
|
-
|
111
|
-
These are the corresponding task vectors:
|
112
|
-
|
113
|
-
['x', 'alpha', 'beta', '-k']
|
114
|
-
['y', 'gamma', '--key', 'value']
|
115
|
-
['z', 'delta', '--key=value']
|
116
|
-
|
117
|
-
This is how it would look as YAML:
|
118
|
-
|
119
|
-
- - x
|
120
|
-
- alpha
|
121
|
-
- beta
|
122
|
-
- -k
|
123
|
-
- - y
|
124
|
-
- gamma
|
125
|
-
- key: value
|
126
|
-
- - z
|
127
|
-
- delta
|
128
|
-
- --key=value
|
129
|
-
- 0:1:2
|
130
|
-
|
131
|
-
The task vectors are converted into a task and an argument vector by first
|
132
|
-
looking up a task class and then calling TaskClass.parse. The parse method
|
133
|
-
returns a configured instance of the task and an argv to be executed by the
|
134
|
-
task. Once the task are instantiated, instances are joined and enqued to
|
135
|
-
Tap::App for execution (see Tap::Support::Schema#build).
|
136
|
-
|
137
|
-
==== Class Lookup
|
138
|
-
|
139
|
-
Tap looks up classes via Tap::Env. Tap can find tasks from multiple
|
140
|
-
environments; by adding in environments for gems, Tap can find tasks
|
141
|
-
within a gem.
|
142
|
-
|
143
|
-
During lookup, classes are treated like filepaths which match from the
|
144
|
-
basename up:
|
145
|
-
|
146
|
-
class lookup matched by
|
147
|
-
Sample::Task sample/task task, sample/task
|
148
|
-
A::Nested::Task a/nested/task task, nested/task, a/nested/task
|
149
|
-
|
150
|
-
In the event of a name conflict, the path of the environment may also be
|
151
|
-
specified. It seems like this could get confusing, but the tap executable
|
152
|
-
produces manifests that specify the minimal path required to uniquely
|
153
|
-
identify a class. Fragments of the minimized paths will be resolved in order
|
154
|
-
from top to bottom within the specified environment. For example:
|
155
|
-
|
156
|
-
% tap run -T
|
157
|
-
one:
|
158
|
-
sample/task # some sample task
|
159
|
-
another/task # another task
|
160
|
-
two:
|
161
|
-
sample/task # a conflicting sample task
|
162
|
-
|
163
|
-
Runs the 'one' sample/task:
|
164
|
-
|
165
|
-
% tap run -- sample/task
|
166
|
-
% tap run -- one:sample/task
|
167
|
-
|
168
|
-
Runs the 'two' sample/task:
|
169
|
-
|
170
|
-
% tap run -- two:sample/task
|
171
|
-
|
172
|
-
Runs the 'one' sample/task:
|
173
|
-
|
174
|
-
% tap run -- task
|
175
|
-
|
176
|
-
Runs the 'two' sample/task:
|
177
|
-
|
178
|
-
% tap run -- two:task
|
179
|
-
|
180
|
-
Runs another/task:
|
181
|
-
|
182
|
-
% tap run -- another/task
|
183
|
-
% tap run -- one:another/task
|
184
|
-
|
185
|
-
Notice that the full minimized path ('another/task') is required because simply
|
186
|
-
using 'task' will be matched to sample/task. The order of tasks is obviously
|
187
|
-
not alphabetical -- rather it corresponds to the order in which Tap::Env
|
188
|
-
discovers the tasks.
|
189
|
-
|
190
|
-
==== Dependencies (--*)
|
191
|
-
|
192
|
-
Normally each task vector specifies a new instance of a task. This specifies
|
193
|
-
three instance of the 'a' task.
|
194
|
-
|
195
|
-
% tap run -- a -- a -- a
|
196
|
-
|
197
|
-
When you want to specify a 'singleton' instance of a task, the instance
|
198
|
-
specified by TaskClass.instance, use the dependency delimiter '--*'.
|
199
|
-
|
200
|
-
% tap run --* a
|
201
|
-
|
202
|
-
The dependency instance will be configured and enqued with the arguments.
|
203
|
-
Dependency instances will be executed first, even if they are specified at the
|
204
|
-
end of a workflow, they cannot participate in workflows, and any single
|
205
|
-
dependency may only be specified once in a workflow. These are equivalent:
|
206
|
-
|
207
|
-
% tap run --* a -- b -- c
|
208
|
-
% tap run b -- c --* a
|
209
|
-
|
210
|
-
While these raise errors:
|
211
|
-
|
212
|
-
% tap run --* a --* a
|
213
|
-
% tap run --* a --: b
|
214
|
-
|
215
|
-
==== Rounds (--+)
|
216
|
-
|
217
|
-
The workflow syntax allows multiple execution rounds to be specified All tasks
|
218
|
-
in a round are run to completion before the next round begins. Rounds are
|
219
|
-
specified by adding '+' characters after the double-dash break.
|
220
|
-
|
221
|
-
% tap run -- round_one_task --+ round_two_task
|
222
|
-
|
223
|
-
Tasks may be added to rounds in any order and may use the shorthand for multiple
|
224
|
-
tasks. These are equivalents:
|
225
|
-
|
226
|
-
% tap run -- a --+ b --+ c --++ d
|
227
|
-
% tap run --+ b --++ d -- a --+ c
|
228
|
-
% tap run -- a -- b -- c -- d --+1[1,2] --+2[3]
|
229
|
-
|
230
|
-
Rounds are particularly useful for dump tasks; add a dump task as a final round
|
231
|
-
to capture all results from previous rounds:
|
232
|
-
|
233
|
-
% tap run -- task -- task --+ dump
|
234
|
-
|