tap 0.19.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History +100 -45
- data/MIT-LICENSE +1 -1
- data/README +95 -51
- data/bin/tap +11 -57
- data/bin/tapexe +84 -0
- data/doc/API +91 -139
- data/doc/Configuration +93 -0
- data/doc/Examples/Command Line +10 -42
- data/doc/Examples/Tapfile +124 -0
- data/doc/Ruby to Ruby +87 -0
- data/doc/Workflow Syntax +185 -0
- data/lib/tap.rb +74 -5
- data/lib/tap/app.rb +217 -310
- data/lib/tap/app/api.rb +44 -23
- data/lib/tap/app/queue.rb +11 -12
- data/lib/tap/app/stack.rb +4 -4
- data/lib/tap/declarations.rb +200 -0
- data/lib/tap/declarations/context.rb +31 -0
- data/lib/tap/declarations/description.rb +33 -0
- data/lib/tap/env.rb +133 -779
- data/lib/tap/env/cache.rb +87 -0
- data/lib/tap/env/constant.rb +94 -39
- data/lib/tap/env/path.rb +71 -0
- data/lib/tap/join.rb +42 -78
- data/lib/tap/joins/gate.rb +85 -0
- data/lib/tap/joins/switch.rb +4 -2
- data/lib/tap/joins/sync.rb +3 -3
- data/lib/tap/middleware.rb +5 -5
- data/lib/tap/middlewares/debugger.rb +18 -58
- data/lib/tap/parser.rb +115 -183
- data/lib/tap/root.rb +162 -239
- data/lib/tap/signal.rb +72 -0
- data/lib/tap/signals.rb +20 -2
- data/lib/tap/signals/class_methods.rb +38 -43
- data/lib/tap/signals/configure.rb +19 -0
- data/lib/tap/signals/help.rb +5 -7
- data/lib/tap/signals/load.rb +49 -0
- data/lib/tap/signals/module_methods.rb +1 -0
- data/lib/tap/task.rb +46 -275
- data/lib/tap/tasks/dump.rb +21 -16
- data/lib/tap/tasks/list.rb +184 -0
- data/lib/tap/tasks/load.rb +4 -4
- data/lib/tap/tasks/prompt.rb +128 -0
- data/lib/tap/tasks/signal.rb +42 -0
- data/lib/tap/tasks/singleton.rb +35 -0
- data/lib/tap/tasks/stream.rb +64 -0
- data/lib/tap/utils.rb +83 -0
- data/lib/tap/version.rb +2 -2
- data/lib/tap/workflow.rb +124 -0
- data/tap.yml +0 -0
- metadata +59 -24
- data/cmd/console.rb +0 -43
- data/cmd/manifest.rb +0 -118
- data/cmd/run.rb +0 -145
- data/doc/Examples/Workflow +0 -40
- data/lib/tap/app/node.rb +0 -29
- data/lib/tap/env/context.rb +0 -61
- data/lib/tap/env/gems.rb +0 -63
- data/lib/tap/env/manifest.rb +0 -179
- data/lib/tap/env/minimap.rb +0 -308
- data/lib/tap/intern.rb +0 -50
- data/lib/tap/joins.rb +0 -9
- data/lib/tap/prompt.rb +0 -36
- data/lib/tap/root/utils.rb +0 -220
- data/lib/tap/root/versions.rb +0 -138
- data/lib/tap/signals/signal.rb +0 -68
data/History
CHANGED
@@ -1,11 +1,76 @@
|
|
1
|
+
== 1.3.0 / 2010-04-02
|
2
|
+
|
3
|
+
* various improvements to declarations
|
4
|
+
* moved env methods from ShellTest to Utils
|
5
|
+
|
6
|
+
== 1.0.0 - 1.2.4 / 2010-03 - 2010-04
|
7
|
+
|
8
|
+
Continued rework of Tap internals. Implementation of new Env setup scheme
|
9
|
+
based largely on signals. Updated the Declarations DSL with significantly more
|
10
|
+
flexibility. Numerous cleanups to the API. Simplification and standardization
|
11
|
+
of the tap syntax for defining command-line workflows.
|
12
|
+
|
13
|
+
These releases were created for internal use and debugged in fairly rapid
|
14
|
+
succession. The transition from 0.* to 1.* marks significant changes that,
|
15
|
+
aside from the basic API, are not backwards-compatible. Going forward Tap
|
16
|
+
should be much more stable, and the various APIs should be stable.
|
17
|
+
|
18
|
+
The tasks among the various modules in the tap suite may still be reorganizd
|
19
|
+
and the Declarations DSL is still under development.
|
20
|
+
|
21
|
+
Also, about this time numerous tags were deleted to cleanup the repo. Rap
|
22
|
+
was removed entirely as a separate gem, as was the tap-suite. These are
|
23
|
+
the old tag names and their corresponding shas:
|
24
|
+
|
25
|
+
all: 5f609e24147587692303d3654f1386958f476f59
|
26
|
+
rap-0.12.0: 2a988dbbacac45b6b8bf0fc7c74e7d3639e64f56
|
27
|
+
rap-0.12.1: a1e0f3605f6937326b258038812fba775c7616bd
|
28
|
+
rap-0.12.2: 03dc3dfc3b365901847ef70dbf1b92d297642b00
|
29
|
+
rap-0.12.3: 6ce756f1f4783787f54d0f8332899972a9b4b863
|
30
|
+
rap-0.13.0: 6db8026cd7dabb1ff407470a9c793796b4ea6126
|
31
|
+
rap-0.13.1: c512db583aad0453ab5e23d54fe5ef4b3c28992c
|
32
|
+
rap-0.15.0: 981bae18210008c5cabc108592d3bc6a44f49530
|
33
|
+
tap-0.10.0: f0c4ae53e5136364f0f6c4c3b2b587daa4eaeefe
|
34
|
+
tap-0.10.1: 6ec15db9a9043e3eca285227b77e6e562bb2ff35
|
35
|
+
tap-0.11.0: 359383266c572bc8e124a751dc3097fec806e16b
|
36
|
+
tap-0.11.1: 5079dcb5ef33c0d5f6def81f4767925be0e8b8c5
|
37
|
+
tap-0.12.0: f8c97e2efbbe9e8699d20b63d29e975cd91a8c57
|
38
|
+
tap-0.12.1: f6ac7f29834804eafd654200096696821f698290
|
39
|
+
tap-0.12.2: ad7fc99d028c6c682c2eb1e7c069bea520641bdb
|
40
|
+
tap-0.12.3: 5cba176fcc5e8e098ed1d9165139bd9a99e097c9
|
41
|
+
tap-0.12.4: 9148452b903f64c1fa170048fa9fa2dfc299414f
|
42
|
+
tap-0.17.0: e23074c52ac656e42904b58d829e82150d76c66a
|
43
|
+
tap-0.17.1: 6139af4e890d55f956d6a61de31396a623b03fec
|
44
|
+
tap-gen-0.1.0: 25f69b6fc788c2aa302bb5623c76e7325e3391fc
|
45
|
+
tap-gen-0.1.1: 8f5614336350942615add73b3fe79075b54a93c1
|
46
|
+
tap-gen-0.1.2: 621ce1fdb7ab0d966a32a34637e39fa5221247f1
|
47
|
+
tap-gen-0.1.3: 60e44d4cf6ac837e28d8b4138e1e4779656341d9
|
48
|
+
tap-gen-0.3.0: 0b12752589ff6cf7bb081d06347fa5d74c7b6eb4
|
49
|
+
tap-server-0.1.0: f08a40b83e370d37adf54ab322f153c2392de9ce
|
50
|
+
tap-server-0.1.1: dada4c9ca83191e9990eaaf7215c049cc7dc88a9
|
51
|
+
tap-server-0.2.0: 45b0d1fb7381ba824b5234079441e8f252a9d28d
|
52
|
+
tap-server-0.3.0: 861fd836b7d19422c7bbb4e3b65981f409130b3d
|
53
|
+
tap-server-0.4.0: 4f2b8c6e146bdca781f30f35d608815544f96e3e
|
54
|
+
tap-server-0.6.0: bfce08a4a73aeffe3b873f9d2bd1b36db4489598
|
55
|
+
tap-suite-0.1.0: 8ab253ee8f72f79a5f7b9b7928831affbcfacda9
|
56
|
+
tap-suite-0.2.0: 76afbec380f6faf7fbec386f2f40c1cbd074b6d9
|
57
|
+
tap-suite-0.3.0: bbfe80400f6d5e988dea9ad1fa3b25851f5aa8e7
|
58
|
+
tap-tasks-0.1.0: fb4d357010a321ab31bf689d3794889f36487059
|
59
|
+
tap-tasks-0.2.0: c0a561780b49de3eaa2a4ef7c69070a47d0b902b
|
60
|
+
tap-tasks-0.5.0: 357d793a78808a26438b4b66c4f6c471a23d05f8
|
61
|
+
tap-test-0.1.0: b533809da134fda0f9fd685c766fe8f26da7f0f3
|
62
|
+
tap-test-0.3.0: 140580cf49bc58cd1e64b5eb9ef7cc8066fa9410
|
63
|
+
|
64
|
+
We'll see if I can't keep this under control a little better.
|
65
|
+
|
1
66
|
== 0.19.0 / 2009-12-05
|
2
67
|
|
3
68
|
Significant rework of Tap internals.
|
4
69
|
|
5
70
|
* extracted task/join/middleware code to make Api base class
|
6
|
-
* some changes to semantics of Minimap; entry_to_minikey is
|
7
|
-
|
8
|
-
|
71
|
+
* some changes to semantics of Minimap; entry_to_minikey is now entry_to_path.
|
72
|
+
Likewise entries now specify their own path using entry.path rather than
|
73
|
+
entry.minikey
|
9
74
|
* added Signals implemented with the Dsl pattern
|
10
75
|
|
11
76
|
== 0.18.1
|
@@ -21,21 +86,19 @@ Significant rework of Tap internals.
|
|
21
86
|
|
22
87
|
== 0.18.0 / 2009-06-17
|
23
88
|
|
24
|
-
Several updates to simplify Tap.
|
25
|
-
|
26
|
-
|
27
|
-
in situations that require them (ex rap).
|
89
|
+
Several updates to simplify Tap. Most significantly, dependencies have been
|
90
|
+
removed because their general utility is quite doubtful, and it it easy to
|
91
|
+
implement in situations that require them (ex rap).
|
28
92
|
|
29
|
-
* bug fix in console (app now refers to Tap::App.
|
93
|
+
* bug fix in console (app now refers to Tap::App.current)
|
30
94
|
* bug fix in load for recurrently loading from a file
|
31
95
|
* fixed a mistake in run help
|
32
|
-
* made load only load once by default, stream loading must
|
33
|
-
|
96
|
+
* made load only load once by default, stream loading must be enabled in
|
97
|
+
subclasses
|
34
98
|
* dump now returns the input, not the io
|
35
99
|
* removed dependencies from tap
|
36
100
|
* removed intern method on Task (now use app.task)
|
37
|
-
* removed Support module (ie refactored Templater to
|
38
|
-
Tap::Templater)
|
101
|
+
* removed Support module (ie refactored Templater to Tap::Templater)
|
39
102
|
* removed Task.help method
|
40
103
|
* added Middleware baseclass
|
41
104
|
* Task.parse now yields opts to block for modifications
|
@@ -52,27 +115,23 @@ in situations that require them (ex rap).
|
|
52
115
|
|
53
116
|
== 0.17.0 / 2009-05-25
|
54
117
|
|
55
|
-
Significant reorganization and update to Tap internals.
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
work without alteration.
|
118
|
+
Significant reorganization and update to Tap internals. The workflow syntax
|
119
|
+
for joins has changed in incompatible ways, and several key methods have been
|
120
|
+
renamed. Obviously not backwards compatible but most tasks will work without
|
121
|
+
alteration.
|
60
122
|
|
61
123
|
Upgrade Notes:
|
62
124
|
|
63
|
-
* Tasks now are identified by "::task" rather than "::manifest"
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
*
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
* refactored on_complete_block to join
|
74
|
-
* callbacks in Task have been removed
|
75
|
-
* schema syntax no longer supports rounds, globals
|
125
|
+
* Tasks now are identified by "::task" rather than "::manifest" The manifest
|
126
|
+
identifier still works for now but will be removed by 1.0.
|
127
|
+
* Root#filepath and Root#relative_filepath have been renamed Root#path and
|
128
|
+
Root#relative_path
|
129
|
+
* Audits have been removed
|
130
|
+
* Generators, FileTask, and test modules have been removed to separate modules
|
131
|
+
(tap-gen, tap-tasks, tap-test). Install tap-suite to get them all back.
|
132
|
+
* switched const_name, name on Constant * refactored on_complete_block to join
|
133
|
+
* callbacks in Task have been removed * schema syntax no longer supports
|
134
|
+
rounds, globals
|
76
135
|
|
77
136
|
Changes:
|
78
137
|
|
@@ -88,11 +147,10 @@ Changes:
|
|
88
147
|
|
89
148
|
* fixed bug in App#inspect
|
90
149
|
* documentation updates
|
91
|
-
* changed the default load/dump configs to load and
|
92
|
-
|
150
|
+
* changed the default load/dump configs to load and dump data without
|
151
|
+
serialization
|
93
152
|
* made stdin the default input to load
|
94
|
-
* updated run syntax to allow arguments to be passed
|
95
|
-
to saved workflows
|
153
|
+
* updated run syntax to allow arguments to be passed to saved workflows
|
96
154
|
* updates to RootGenerator
|
97
155
|
|
98
156
|
== 0.12.3 / 2009-03-05
|
@@ -155,8 +213,7 @@ Upgrade note:
|
|
155
213
|
|
156
214
|
== 0.11.0 / 2008-10-20
|
157
215
|
|
158
|
-
Significant update to Tap with many internal reworks.
|
159
|
-
Major changes include:
|
216
|
+
Significant update to Tap with many internal reworks. Major changes include:
|
160
217
|
|
161
218
|
* Addition of Parser/Schema
|
162
219
|
* Addition of rap and task declarations
|
@@ -167,8 +224,7 @@ Major changes include:
|
|
167
224
|
|
168
225
|
== 0.10.1 / 2008-08-21
|
169
226
|
|
170
|
-
Update of Tap with a few improvements to manifests
|
171
|
-
and a new manifest command.
|
227
|
+
Update of Tap with a few improvements to manifests and a new manifest command.
|
172
228
|
|
173
229
|
* Fixed some bugs and extended manifests
|
174
230
|
* Bug fixes in generators
|
@@ -176,16 +232,15 @@ and a new manifest command.
|
|
176
232
|
|
177
233
|
== 0.10.0 / 2008-08-08
|
178
234
|
|
179
|
-
Major revision.
|
180
|
-
|
181
|
-
Development is now on GitHub.
|
235
|
+
Major revision. Reworked configurations and the execution environment. Added
|
236
|
+
Lazydoc documentation. Backwards incompatible. Development is now on GitHub.
|
182
237
|
|
183
238
|
== 0.9.1 / 2008-04-26 revision 253
|
184
239
|
|
185
|
-
Relatively minor update, but with one important refactoring that
|
186
|
-
|
187
|
-
|
188
|
-
|
240
|
+
Relatively minor update, but with one important refactoring that removes the
|
241
|
+
Tap::Script module. This breaks backward compatibility but only should affect
|
242
|
+
people who have made their own commands. Simply sub Tap::Support::CommandLine
|
243
|
+
for Tap::Script to fix.
|
189
244
|
|
190
245
|
* Added constants methods (ex try_constantize) to String
|
191
246
|
* Added gem discovery when no tap.yml file is present
|
data/MIT-LICENSE
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Copyright (c) 2006-2009, Regents of the University of Colorado.
|
2
2
|
|
3
|
-
Copyright (c) 2009, Simon Chiang.
|
3
|
+
Copyright (c) 2009-2010, Simon Chiang.
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
data/README
CHANGED
@@ -10,12 +10,11 @@ Tap allows the construction of workflows that may be defined, configured, and
|
|
10
10
|
run from the command line. The tasks and joins composing a workflow are easy
|
11
11
|
to test, subclass, and distribute as gems.
|
12
12
|
|
13
|
-
Tap
|
14
|
-
{Tap-Suite}[http://tap.rubyforge.org/tap-suite/index.html]
|
15
|
-
which provides a standard library of
|
13
|
+
Tap provides a standard library of
|
16
14
|
{tasks}[http://tap.rubyforge.org/tap-tasks/index.html],
|
17
|
-
{generators}[http://tap.rubyforge.org/tap-gen/index.html], and
|
18
|
-
|
15
|
+
{generators}[http://tap.rubyforge.org/tap-gen/index.html], and {test
|
16
|
+
modules}[http://tap.rubyforge.org/tap-test/index.html] to expedite
|
17
|
+
development.
|
19
18
|
|
20
19
|
* Website[http://tap.rubyforge.org]
|
21
20
|
* Github[http://github.com/bahuvrihi/tap/tree/master]
|
@@ -26,8 +25,9 @@ which provides a standard library of
|
|
26
25
|
Tasks are defined as subclasses of Tap::Task.
|
27
26
|
|
28
27
|
[lib/goodnight.rb]
|
28
|
+
require 'tap/task'
|
29
29
|
|
30
|
-
#
|
30
|
+
# ::task your basic goodnight moon task
|
31
31
|
# Says goodnight with a configurable message.
|
32
32
|
class Goodnight < Tap::Task
|
33
33
|
config :message, 'goodnight' # a goodnight message
|
@@ -37,74 +37,118 @@ Tasks are defined as subclasses of Tap::Task.
|
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
|
-
Tap
|
41
|
-
|
42
|
-
% tap
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
40
|
+
Tap discovers tasks.
|
41
|
+
|
42
|
+
% tap list
|
43
|
+
task:
|
44
|
+
dump # dump data
|
45
|
+
goodnight # your basic goodnight moon task
|
46
|
+
list # list resources
|
47
|
+
load # load data
|
48
|
+
prompt # open a prompt
|
49
|
+
signal # signal via a task
|
50
|
+
join:
|
51
|
+
gate # collects results
|
52
|
+
join # unsyncrhonized multi-way join
|
53
|
+
sync # synchronized multi-way join
|
54
|
+
middleware:
|
55
|
+
debugger # default debugger
|
56
|
+
|
57
|
+
Generates command-line documentation.
|
58
|
+
|
59
|
+
% tap goodnight --help
|
52
60
|
Goodnight -- your basic goodnight moon task
|
53
61
|
--------------------------------------------------------------------------------
|
54
62
|
Says goodnight with a configurable message.
|
55
63
|
--------------------------------------------------------------------------------
|
56
|
-
usage: tap
|
64
|
+
usage: tap goodnight NAME
|
57
65
|
|
58
66
|
configurations:
|
59
67
|
--message MESSAGE a goodnight message
|
60
68
|
|
61
69
|
options:
|
62
70
|
--help Print this help
|
63
|
-
--enque Manually enques self
|
64
71
|
--config FILE Specifies a config file
|
65
72
|
|
66
|
-
|
67
|
-
|
68
|
-
|
73
|
+
And provides a robust
|
74
|
+
{syntax}[http://tap.rubyforge.org/rdoc/files/doc/Workflow%20Syntax.html] for
|
75
|
+
building both simple and complex workflows. This joins a goodnight task to a
|
76
|
+
dump task in order to print the goodnight message.
|
69
77
|
|
70
|
-
% tap
|
78
|
+
% tap goodnight moon -: dump
|
71
79
|
goodnight moon
|
72
80
|
|
73
|
-
% tap
|
81
|
+
% tap goodnight world --message hello -: dump
|
74
82
|
hello world
|
75
83
|
|
76
|
-
|
77
|
-
|
78
|
-
Workflows are specified on the command line using argument vectors separated
|
79
|
-
by option breaks (ie '--'). The argument vectors define the tasks while
|
80
|
-
modifications to the breaks specify joins.
|
81
|
-
|
82
|
-
A simple sequence.
|
83
|
-
|
84
|
-
% tap run -- load 'goodnight moon' --: dump
|
85
|
-
goodnight moon
|
86
|
-
|
87
|
-
A more formal way of specifying a sequence.
|
84
|
+
Workflows support the use of middleware to wrap the execution of each task,
|
85
|
+
most commonly for logging and/or debugging.
|
88
86
|
|
89
|
-
% tap
|
87
|
+
% tap goodnight moon -: dump --/use debugger
|
88
|
+
21:06:53 0 << ["moon"] (Goodnight)
|
89
|
+
21:06:53 0 >> "goodnight moon" (Goodnight)
|
90
|
+
21:06:53 1 << "goodnight moon" (Tap::Tasks::Dump)
|
90
91
|
goodnight moon
|
92
|
+
21:06:53 1 >> "goodnight moon" (Tap::Tasks::Dump)
|
91
93
|
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
goodnight moon
|
94
|
+
Tap provides a set of {test
|
95
|
+
modules}[http://tap.rubyforge.org/tap-test/index.html] to simplify testing of
|
96
|
+
workflows both off and on the command-line (this documentation is tested, for
|
97
|
+
example):
|
97
98
|
|
98
|
-
|
99
|
+
require 'tap/test/unit'
|
100
|
+
|
101
|
+
class ShellTestTest < Test::Unit::TestCase
|
102
|
+
acts_as_shell_test
|
103
|
+
|
104
|
+
def test_goodnight_moon
|
105
|
+
sh_test %q{
|
106
|
+
% tap load 'goodnight moon' -: dump
|
107
|
+
goodnight moon
|
108
|
+
}
|
109
|
+
end
|
110
|
+
end
|
99
111
|
|
100
|
-
|
101
|
-
|
102
|
-
|
112
|
+
Tasks can be packaged into gems like any other code. Tap automatically finds
|
113
|
+
tasks in gems containing a tap.yml file so that distribution feels normal and
|
114
|
+
unobtrusive.
|
103
115
|
|
104
|
-
|
116
|
+
% tap load/yaml
|
117
|
+
unresolvable constant: "load/yaml"
|
118
|
+
|
119
|
+
% gem install tap-tasks
|
120
|
+
...
|
121
|
+
|
122
|
+
% tap load/yaml "[1, 2, 3]" -: dump/yaml
|
123
|
+
---
|
124
|
+
- 1
|
125
|
+
- 2
|
126
|
+
- 3
|
127
|
+
|
128
|
+
For local tasks that don't need to be distributed, Tap provides declarations
|
129
|
+
a-la {Rake}[http://rake.rubyforge.org/]. By default any tasks in a tapfile are
|
130
|
+
available for use.
|
131
|
+
|
132
|
+
[tapfile]
|
133
|
+
desc "concat file contents"
|
134
|
+
task :cat do |config, *files|
|
135
|
+
files.collect {|file| File.read(file) }.join
|
136
|
+
end
|
137
|
+
|
138
|
+
desc "grep lines"
|
139
|
+
task :grep, :e => '.' do |config, str|
|
140
|
+
str.split("\n").grep(/#{config.e}/)
|
141
|
+
end
|
142
|
+
|
143
|
+
% tap cat tapfile -:a grep -e task -:i dump
|
144
|
+
task :cat do |config, *files|
|
145
|
+
task :grep, :e => '.' do |config, str|
|
105
146
|
|
106
|
-
|
107
|
-
|
147
|
+
See the documentation for a greater explanation of the {workflow
|
148
|
+
syntax}[http://tap.rubyforge.org/rdoc/files/doc/Workflow%20Syntax.html],
|
149
|
+
several common
|
150
|
+
{patterns}[http://tap.rubyforge.org/rdoc/files/doc/Examples.html], and the
|
151
|
+
underlying {APIs}[http://tap.rubyforge.org/rdoc/files/doc/API.html].
|
108
152
|
|
109
153
|
== Installation
|
110
154
|
|
@@ -115,4 +159,4 @@ Tap is available as a gem on Gemcutter[http://gemcutter.org/gems/tap].
|
|
115
159
|
== Info
|
116
160
|
|
117
161
|
Developer:: {Simon Chiang}[http://bahuvrihi.wordpress.com]
|
118
|
-
License:: {MIT-Style}[
|
162
|
+
License:: {MIT-Style}[http://tap.rubyforge.org/rdoc/files/MIT-LICENSE.html]
|
data/bin/tap
CHANGED
@@ -1,62 +1,16 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
# usage: tap <command> {options} [args]
|
3
2
|
#
|
4
|
-
#
|
3
|
+
# Runs tapexe, first setting the default ENV variables expected
|
4
|
+
# by tap when installed by RubyGems. Splitting the work into
|
5
|
+
# two files like this is a pattern allowing tapexe to be run
|
6
|
+
# without RubyGems or the default ENV (ie 'ruby tapexe').
|
5
7
|
#
|
6
|
-
# examples:
|
7
|
-
# tap generate root . # generates a root dir
|
8
|
-
# tap run taskname --option input # runs the 'taskname' task
|
9
|
-
#
|
10
|
-
# help:
|
11
|
-
# tap --help # prints this help
|
12
|
-
# tap command --help # prints help for 'command'
|
13
|
-
#
|
14
|
-
|
15
|
-
require "#{File.dirname(__FILE__)}/../lib/tap.rb"
|
16
|
-
|
17
|
-
#
|
18
|
-
# setup the application
|
19
|
-
#
|
20
|
-
|
21
|
-
begin
|
22
|
-
app = Tap::App.setup
|
23
|
-
rescue(Tap::Env::ConfigError)
|
24
|
-
# catch errors and exit gracefully
|
25
|
-
# (errors usu from gem loading errors)
|
26
|
-
puts $!.message
|
27
|
-
exit(1)
|
28
|
-
end
|
29
|
-
|
30
|
-
#
|
31
|
-
# launch the command
|
32
|
-
#
|
33
|
-
|
34
|
-
commands = app.env.manifest do |env|
|
35
|
-
env.root.glob(:cmd, "**/*.rb")
|
36
|
-
end
|
37
|
-
|
38
|
-
case command = ARGV.shift.to_s
|
39
|
-
when '', '--help'
|
40
|
-
template = %Q{<% unless minimap.empty? || count <= 1 %>
|
41
|
-
<%= env_key %>:
|
42
|
-
<% end %>
|
43
|
-
<% minimap.each do |key, path| %>
|
44
|
-
<%= key.ljust(width) %>
|
45
|
-
<% end %>}
|
46
8
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
else
|
54
|
-
if path = commands.seek(command)
|
55
|
-
load path
|
56
|
-
else
|
57
|
-
puts "Unknown command: '#{command}'"
|
58
|
-
puts "Type 'tap --help' for usage information."
|
59
|
-
end
|
60
|
-
end
|
9
|
+
ENV['TAP_GEMS'] ||= '.'
|
10
|
+
ENV['TAP_PATH'] ||= '.'
|
11
|
+
ENV['TAPENV'] ||= 'tapenv'
|
12
|
+
ENV['TAPRC'] ||= '~/.taprc:taprc'
|
13
|
+
ENV['TAPFILE'] ||= 'tapfile'
|
14
|
+
ENV['TAP_CACHE'] ||= '~/.tap'
|
61
15
|
|
62
|
-
|
16
|
+
load File.expand_path('../tapexe', __FILE__)
|