bahuvrihi-tap 0.10.7 → 0.10.8
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +0 -2
- data/README +20 -31
- data/bin/rap +18 -8
- data/cgi/run.rb +47 -37
- data/cmd/console.rb +1 -1
- data/cmd/destroy.rb +3 -3
- data/cmd/generate.rb +3 -3
- data/cmd/manifest.rb +61 -53
- data/cmd/run.rb +1 -1
- data/doc/Class Reference +119 -110
- data/doc/Command Reference +76 -123
- data/doc/Syntax Reference +290 -0
- data/doc/Tutorial +307 -237
- data/lib/tap.rb +1 -12
- data/lib/tap/app.rb +46 -71
- data/lib/tap/constants.rb +1 -1
- data/lib/tap/declarations.rb +110 -100
- data/lib/tap/env.rb +141 -173
- data/lib/tap/exe.rb +5 -5
- data/lib/tap/file_task.rb +2 -2
- data/lib/tap/generator/base.rb +0 -4
- data/lib/tap/generator/destroy.rb +8 -12
- data/lib/tap/generator/generate.rb +19 -14
- data/lib/tap/generator/generators/command/command_generator.rb +1 -1
- data/lib/tap/generator/generators/config/config_generator.rb +3 -3
- data/lib/tap/generator/generators/file_task/file_task_generator.rb +1 -1
- data/lib/tap/generator/generators/generator/generator_generator.rb +27 -0
- data/lib/tap/generator/generators/generator/templates/task.erb +27 -0
- data/lib/tap/generator/generators/root/root_generator.rb +12 -12
- data/lib/tap/generator/generators/root/templates/Rakefile +1 -2
- data/lib/tap/generator/generators/root/templates/tapfile +11 -8
- data/lib/tap/generator/generators/task/task_generator.rb +1 -3
- data/lib/tap/generator/generators/task/templates/test.erb +1 -3
- data/lib/tap/root.rb +4 -2
- data/lib/tap/support/aggregator.rb +16 -3
- data/lib/tap/support/assignments.rb +10 -9
- data/lib/tap/support/audit.rb +58 -62
- data/lib/tap/support/class_configuration.rb +32 -43
- data/lib/tap/support/combinator.rb +7 -7
- data/lib/tap/support/configurable.rb +13 -14
- data/lib/tap/support/configurable_class.rb +6 -30
- data/lib/tap/support/configuration.rb +36 -9
- data/lib/tap/support/constant.rb +75 -13
- data/lib/tap/support/constant_manifest.rb +115 -0
- data/lib/tap/support/dependencies.rb +27 -67
- data/lib/tap/support/dependency.rb +44 -0
- data/lib/tap/support/executable.rb +78 -109
- data/lib/tap/support/executable_queue.rb +1 -1
- data/lib/tap/support/gems.rb +6 -0
- data/lib/tap/support/gems/rack.rb +197 -84
- data/lib/tap/support/instance_configuration.rb +29 -3
- data/lib/tap/support/intern.rb +46 -0
- data/lib/tap/support/join.rb +67 -11
- data/lib/tap/support/joins.rb +2 -0
- data/lib/tap/support/joins/fork.rb +1 -0
- data/lib/tap/support/joins/merge.rb +3 -1
- data/lib/tap/support/joins/sequence.rb +2 -2
- data/lib/tap/support/joins/switch.rb +3 -1
- data/lib/tap/support/joins/sync_merge.rb +6 -0
- data/lib/tap/support/lazy_attributes.rb +16 -1
- data/lib/tap/support/lazydoc.rb +21 -21
- data/lib/tap/support/lazydoc/comment.rb +59 -55
- data/lib/tap/support/lazydoc/definition.rb +36 -0
- data/lib/tap/support/lazydoc/document.rb +37 -13
- data/lib/tap/support/manifest.rb +120 -131
- data/lib/tap/support/minimap.rb +90 -0
- data/lib/tap/support/node.rb +4 -6
- data/lib/tap/support/parser.rb +63 -6
- data/lib/tap/support/schema.rb +11 -2
- data/lib/tap/support/shell_utils.rb +3 -5
- data/lib/tap/support/string_ext.rb +60 -0
- data/lib/tap/support/tdoc.rb +2 -2
- data/lib/tap/support/templater.rb +29 -15
- data/lib/tap/support/validation.rb +22 -11
- data/lib/tap/task.rb +155 -156
- data/lib/tap/tasks/load.rb +95 -8
- data/lib/tap/test/extensions.rb +2 -1
- data/lib/tap/test/script_tester.rb +7 -1
- data/template/index.erb +39 -32
- metadata +13 -13
- data/lib/tap/generator/generators/root/templates/test/tapfile_test.rb +0 -15
- data/lib/tap/patches/rake/rake_test_loader.rb +0 -8
- data/lib/tap/patches/rake/testtask.rb +0 -57
- data/lib/tap/patches/ruby19/backtrace_filter.rb +0 -51
- data/lib/tap/patches/ruby19/parsedate.rb +0 -16
- data/lib/tap/spec.rb +0 -42
- data/lib/tap/spec/adapter.rb +0 -25
- data/lib/tap/spec/inheritable_class_test_root.rb +0 -9
- data/lib/tap/support/constant_utils.rb +0 -127
- data/lib/tap/support/summary.rb +0 -30
data/MIT-LICENSE
CHANGED
@@ -1,6 +1,4 @@
|
|
1
1
|
Copyright (c) 2006-2008, Regents of the University of Colorado.
|
2
|
-
Developer:: Simon Chiang, Biomolecular Structure Program, Hansen Lab
|
3
|
-
Support:: CU Denver School of Medicine Deans Academic Enrichment Fund
|
4
2
|
|
5
3
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
6
4
|
software and associated documentation files (the "Software"), to deal in the Software
|
data/README
CHANGED
@@ -5,21 +5,22 @@ A framework for creating configurable, distributable tasks and workflows.
|
|
5
5
|
== Description
|
6
6
|
|
7
7
|
Tap tasks are designed to be easy to test, subclass, use in scripts, and run
|
8
|
-
from the command line. Tap provides methods to
|
9
|
-
|
10
|
-
libraries are readily shared as gems.
|
11
|
-
development, and bug tracking.
|
8
|
+
from the command line. Tap provides methods to join tasks into imperative
|
9
|
+
and dependecy-based workflows, utilize static config files, as well as dump
|
10
|
+
and reuse results. Task libraries are readily shared as gems.
|
12
11
|
|
13
|
-
|
12
|
+
Check out these links for tutorials, development, and bug tracking.
|
13
|
+
|
14
|
+
* {Tutorial}[link:files/doc/Tutorial.html], {Class}[link:files/doc/Class%20Reference.html], {Command}[link:files/doc/Command%20Reference.html], and {Syntax}[link:files/doc/Syntax%20Reference.html] References
|
14
15
|
* Website[http://tap.rubyforge.org]
|
15
|
-
* Lighthouse[http://bahuvrihi.lighthouseapp.com/projects/9908-tap-task-application/
|
16
|
+
* Lighthouse[http://bahuvrihi.lighthouseapp.com/projects/9908-tap-task-application/tickets]
|
16
17
|
* Github[http://github.com/bahuvrihi/tap/tree/master]
|
17
18
|
* {Google Group}[http://groups.google.com/group/ruby-on-tap]
|
18
19
|
|
19
|
-
===
|
20
|
+
=== Features
|
20
21
|
|
21
22
|
- Tap and Rake[http://rake.rubyforge.org/] are targeted at different problems,
|
22
|
-
but play well together. See
|
23
|
+
but play well together. See the {Tutorial}[link:files/doc/Tutorial.html].
|
23
24
|
- Tap is tested on MRI (the standard Ruby interpreter, versions 1.8.6 and
|
24
25
|
1.9.0) and JRuby[http://jruby.codehaus.org/].
|
25
26
|
|
@@ -46,6 +47,7 @@ Tap pulls documentation out of task classes to generate manifests:
|
|
46
47
|
goodnight # your basic goodnight moon task
|
47
48
|
tap:
|
48
49
|
dump # the default dump task
|
50
|
+
load # the default load task
|
49
51
|
rake # run rake tasks
|
50
52
|
|
51
53
|
And help:
|
@@ -66,39 +68,26 @@ And help:
|
|
66
68
|
--use FILE Loads inputs from file
|
67
69
|
|
68
70
|
|
69
|
-
Tasks are immediately available to run:
|
71
|
+
Tasks are immediately available to run through tap or rap:
|
70
72
|
|
71
73
|
% tap run -- goodnight moon
|
72
74
|
I[00:09:55] goodnight moon
|
73
75
|
|
74
|
-
|
75
|
-
% tap run -- goodnight moon --message hello
|
76
|
+
% rap goodnight moon --message hello
|
76
77
|
I[00:10:01] hello moon
|
77
|
-
|
78
|
-
Tap comes with generators and allows distribution of task libraries as gems.
|
79
|
-
This can be illustrated by installing the
|
80
|
-
{sample_tasks}[http://tap.rubyforge.org/sample_tasks] gem:
|
81
78
|
|
82
|
-
|
83
|
-
|
84
|
-
sample
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
copy # copies files
|
89
|
-
grep # search for lines matching a pattern
|
90
|
-
print_tree # print a directory tree
|
91
|
-
tap:
|
92
|
-
dump # the default dump task
|
93
|
-
rake # run rake tasks
|
79
|
+
Tap comes with generators. To get started:
|
80
|
+
|
81
|
+
% tap generate root sample
|
82
|
+
% cd sample
|
83
|
+
% tap generate task goodnight
|
84
|
+
% rap goodnight moon
|
94
85
|
|
95
86
|
=== Bugs/Known Issues
|
96
87
|
|
97
88
|
- Some inconsequential tests on JRuby fail due to bugs in JRuby itself.
|
98
|
-
-
|
99
|
-
|
100
|
-
- Despite the talk of workflows, the Workflow class should still be considered
|
101
|
-
in progress. Tasks themselves are stable.
|
89
|
+
- Joins, Parser, and Schema require additional documentation and may be
|
90
|
+
internally reworked. The workflow syntax should remain the same.
|
102
91
|
|
103
92
|
== Installation
|
104
93
|
|
data/bin/rap
CHANGED
@@ -10,12 +10,12 @@ begin
|
|
10
10
|
# handle super options
|
11
11
|
$DEBUG = true if ARGV.delete('-d-')
|
12
12
|
env = Tap::Exe.instantiate
|
13
|
-
|
14
|
-
|
13
|
+
env.unshift(Tap::Declarations.env)
|
14
|
+
|
15
15
|
task_file = File.expand_path('Tapfile')
|
16
16
|
if File.exists?(task_file)
|
17
17
|
env.loads.unshift(task_file)
|
18
|
-
env.
|
18
|
+
env.tasks.register(Dir.pwd, task_file)
|
19
19
|
end
|
20
20
|
|
21
21
|
rescue(Tap::Env::ConfigError)
|
@@ -66,14 +66,24 @@ begin
|
|
66
66
|
|
67
67
|
case ARGV[0]
|
68
68
|
when '--help', nil, '-T'
|
69
|
+
rap_template = %Q{<% if count > 1 && !entries.empty? %>
|
70
|
+
<%= env_name %>:
|
71
|
+
<% end %>
|
72
|
+
<% entries.each do |name, const| %>
|
73
|
+
<% desc = if const.require_path == nil # should be a declaration %>
|
74
|
+
<% manifest = const.constantize.lazydoc[const.name]['manifest'] %>
|
75
|
+
<% next if manifest == nil || manifest.subject.empty? %>
|
76
|
+
<% manifest.subject %>
|
77
|
+
<% else %>
|
78
|
+
<% const.document[const.name]['manifest'] %>
|
79
|
+
<% end %>
|
80
|
+
<%= name.ljust(width) %><%= desc.empty? ? '' : ' # ' %><%= desc %>
|
81
|
+
<% end %>}
|
82
|
+
|
69
83
|
puts Tap::Support::Lazydoc.usage(__FILE__)
|
70
84
|
puts
|
71
85
|
puts "=== tap tasks ==="
|
72
|
-
|
73
|
-
const.document.resolve
|
74
|
-
const.document[const.name]['manifest'].subject
|
75
|
-
end
|
76
|
-
puts str
|
86
|
+
puts env.summarize(:tasks, rap_template)
|
77
87
|
puts
|
78
88
|
puts "=== rake tasks ==="
|
79
89
|
Tap::Tasks::Rake.new.enq('-T')
|
data/cgi/run.rb
CHANGED
@@ -6,52 +6,62 @@
|
|
6
6
|
############################
|
7
7
|
require 'cgi'
|
8
8
|
require "#{File.dirname(__FILE__)}/../vendor/url_encoded_pair_parser"
|
9
|
-
require "tap/support/parsers/server"
|
10
9
|
|
11
|
-
|
10
|
+
env = Tap::Env.instance
|
12
11
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
12
|
+
module Tap
|
13
|
+
module Support
|
14
|
+
module Server
|
15
|
+
module_function
|
16
|
+
|
17
|
+
def pair_parse(params)
|
18
|
+
pairs = {}
|
19
|
+
params.each_pair do |key, values|
|
20
|
+
key = key.chomp("%w") if key =~ /%w$/
|
21
|
+
|
22
|
+
slot = pairs[key] ||= []
|
23
|
+
values.each do |value|
|
24
|
+
value = value.respond_to?(:read) ? value.read : value
|
25
|
+
if $~
|
26
|
+
slot.concat(Shellwords.shellwords(value))
|
27
|
+
else
|
28
|
+
slot << value
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
UrlEncodedPairParser.new(pairs).result
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
19
38
|
|
20
39
|
cgi = CGI.new("html3") # add HTML generation methods
|
21
40
|
cgi.out() do
|
22
41
|
case cgi.request_method
|
23
42
|
when /GET/i
|
24
|
-
|
25
|
-
:server => server,
|
26
|
-
:workflow => {},
|
27
|
-
:tasks => [task_attributes])
|
28
|
-
|
29
|
-
when /POST/i
|
30
|
-
argh = UrlEncodedPairParser.new(cgi.params.to_a).result
|
31
|
-
argh = Tap::Support::Parsers::Server.compact(argh)
|
32
|
-
parser = Tap::Support::Parsers::Server.new(argh)
|
43
|
+
env.render('run.erb', :env => env, :tascs => [] )
|
33
44
|
|
34
|
-
|
35
|
-
|
36
|
-
|
45
|
+
when /POST/i
|
46
|
+
action = cgi.params['action'][0]
|
47
|
+
case action
|
48
|
+
when 'add'
|
49
|
+
index = cgi.params['index'][0].to_i - 1
|
50
|
+
cgi.params['selected_tasks'].collect do |task|
|
51
|
+
index += 1
|
52
|
+
tasc = env.tasks.search(task).constantize
|
53
|
+
env.render('run/task.erb', :tasc => tasc, :index => index )
|
54
|
+
end.join("\n")
|
37
55
|
|
38
|
-
when
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
# if queues.empty?
|
47
|
-
# end
|
48
|
-
|
49
|
-
# queues.each_with_index do |queue, i|
|
50
|
-
# app.queue.concat(queue)
|
51
|
-
# app.run
|
52
|
-
# end
|
53
|
-
else raise ArgumentError, "unhandled request action: #{cgi['action']}"
|
56
|
+
when 'remove'
|
57
|
+
when 'update'
|
58
|
+
else
|
59
|
+
cgi.pre do
|
60
|
+
argh = Tap::Support::Server.pair_parse(cgi.params)
|
61
|
+
Tap::Support::Schema.parse(argh['schema']).dump.to_yaml
|
62
|
+
end
|
54
63
|
end
|
55
|
-
else
|
64
|
+
else
|
65
|
+
raise ArgumentError, "unhandled request method: #{cgi.request_method}"
|
56
66
|
end
|
57
67
|
end
|
data/cmd/console.rb
CHANGED
data/cmd/destroy.rb
CHANGED
@@ -3,13 +3,13 @@ require 'tap/generator/destroy'
|
|
3
3
|
|
4
4
|
env = Tap::Env.instance
|
5
5
|
|
6
|
-
if ARGV.empty? || ARGV == ['
|
7
|
-
puts env.summarize(:generators)
|
6
|
+
if ARGV.empty? || ARGV == ['--help']
|
7
|
+
puts env.summarize(:generators)
|
8
8
|
exit
|
9
9
|
end
|
10
10
|
|
11
11
|
name = ARGV.shift
|
12
|
-
const = env.search(
|
12
|
+
const = env.generators.search(name) or raise "unknown generator: #{name}"
|
13
13
|
|
14
14
|
generator_class = const.constantize
|
15
15
|
generator, argv = generator_class.parse(ARGV)
|
data/cmd/generate.rb
CHANGED
@@ -3,13 +3,13 @@ require 'tap/generator/generate'
|
|
3
3
|
|
4
4
|
env = Tap::Env.instance
|
5
5
|
|
6
|
-
if ARGV.empty? || ARGV == ['
|
7
|
-
puts env.summarize(:generators)
|
6
|
+
if ARGV.empty? || ARGV == ['--help']
|
7
|
+
puts env.summarize(:generators)
|
8
8
|
exit
|
9
9
|
end
|
10
10
|
|
11
11
|
name = ARGV.shift
|
12
|
-
const = env.search(
|
12
|
+
const = env.generators.search(name) or raise "unknown generator: #{name}"
|
13
13
|
|
14
14
|
generator_class = const.constantize
|
15
15
|
generator, argv = generator_class.parse(ARGV)
|
data/cmd/manifest.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# tap manifest
|
2
2
|
#
|
3
|
-
# Prints information about
|
3
|
+
# Prints information about the current tap environment.
|
4
4
|
#
|
5
5
|
|
6
6
|
options = {}
|
@@ -10,85 +10,93 @@ OptionParser.new do |opts|
|
|
10
10
|
opts.separator "options:"
|
11
11
|
|
12
12
|
opts.on("-h", "--help", "Show this message") do
|
13
|
-
opts.banner =
|
13
|
+
opts.banner = Tap::Support::Lazydoc.usage(__FILE__)
|
14
14
|
puts opts
|
15
15
|
exit
|
16
16
|
end
|
17
17
|
|
18
|
-
opts.on("-
|
19
|
-
|
20
|
-
end
|
18
|
+
# opts.on("-t", "--tree", "Just print the env tree.") do
|
19
|
+
# options[:tree] = true
|
20
|
+
# end
|
21
21
|
|
22
|
-
opts.on("-r", "--require FILEPATH", "Require the specified file") do |value|
|
23
|
-
|
24
|
-
end
|
22
|
+
# opts.on("-r", "--require FILEPATH", "Require the specified file") do |value|
|
23
|
+
# require value
|
24
|
+
# end
|
25
25
|
|
26
26
|
end.parse!(ARGV)
|
27
27
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
map = manifest.minimize.collect do |(key, path)|
|
33
|
-
path = case path
|
34
|
-
when Tap::Support::Constant then path.require_path
|
35
|
-
else path
|
36
|
-
end
|
37
|
-
|
38
|
-
width = key.length if width < key.length
|
39
|
-
[key, env.root.relative_filepath(:root, path) || path]
|
40
|
-
end.collect do |args|
|
41
|
-
"%-#{width}s (%s)" % args
|
42
|
-
end
|
43
|
-
|
44
|
-
map.unshift("") unless map.empty?
|
45
|
-
map
|
28
|
+
env = Tap::Env.instance
|
29
|
+
env_names = {}
|
30
|
+
env.manifest(:envs, true).minimize.each do |name, environment|
|
31
|
+
env_names[environment] = name
|
46
32
|
end
|
47
33
|
|
48
|
-
|
49
|
-
|
50
|
-
envs_manifest = if ARGV.empty?
|
51
|
-
env.manifest(:envs, true).minimize
|
34
|
+
filter = case
|
35
|
+
when ARGV.empty? then env_names.keys
|
52
36
|
else
|
53
37
|
ARGV.collect do |name|
|
54
|
-
entry = env.find(:envs, name, false)
|
55
|
-
|
56
|
-
|
38
|
+
unless entry = env.find(:envs, name, false)
|
39
|
+
raise "could not find an env matching: #{name}"
|
40
|
+
end
|
41
|
+
|
42
|
+
entry[1]
|
57
43
|
end
|
58
44
|
end
|
59
45
|
|
60
|
-
|
61
|
-
|
62
|
-
|
46
|
+
template = %Q{#{'-' * 80}
|
47
|
+
<%= (env_name + ':').ljust(width) %> (<%= env.root.root %>)
|
48
|
+
<% manifests.each do |manifest_name, entries| %>
|
49
|
+
<%= manifest_name %>
|
50
|
+
<% entries.each do |name, path| %>
|
51
|
+
<%= name.ljust(width-4) %> (<%= path %>)
|
52
|
+
<% end %>
|
53
|
+
<% end %>
|
54
|
+
}
|
63
55
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
puts '-' * 80 unless options[:envs_only]
|
69
|
-
puts "%-#{width}s (%s)" % [env_name + ':', current.root.root]
|
70
|
-
|
71
|
-
next if options[:envs_only]
|
56
|
+
width = 10
|
57
|
+
summary = env.inspect(template) do |templater, share|
|
58
|
+
current = templater.env
|
59
|
+
next unless filter.include?(current)
|
72
60
|
|
73
61
|
manifest_keys = (Tap::Env.manifests.keys + current.manifests.keys).uniq
|
74
|
-
manifest_keys.
|
62
|
+
manifests = manifest_keys.collect do |name|
|
75
63
|
next if name == :envs
|
64
|
+
|
76
65
|
manifest = current.manifest(name, true)
|
77
66
|
next if manifest.empty?
|
78
67
|
|
79
|
-
|
68
|
+
entries = manifest.minimize.collect do |(entry, path)|
|
69
|
+
path = case path
|
70
|
+
when Tap::Support::Constant then path.require_path
|
71
|
+
else path
|
72
|
+
end
|
73
|
+
|
74
|
+
width = entry.length if width < entry.length
|
75
|
+
[entry, current.root.relative_filepath(:root, path) || path]
|
76
|
+
end
|
77
|
+
|
78
|
+
[name, entries]
|
80
79
|
end
|
80
|
+
templater.manifests = manifests.compact
|
81
|
+
templater.env_name = env_names[current]
|
82
|
+
|
83
|
+
width = templater.env_name.length if width < templater.env_name.length
|
84
|
+
share[:width] = width + 2
|
81
85
|
end
|
86
|
+
puts summary
|
82
87
|
|
83
88
|
if ARGV.empty?
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
puts("#{leader}#{env_name}")
|
89
|
+
tree = env.recursive_inspect("<%= leader %><%= env_name %> \n", 0, nil) do |templater, share, nesting_depth, last|
|
90
|
+
current = templater.env
|
91
|
+
|
92
|
+
templater.leader = nesting_depth == 0 ? "" : '| ' * (nesting_depth - 1) + (last == current ? "`- " : "|- ")
|
93
|
+
templater.env_name = env_names[current]
|
94
|
+
|
91
95
|
[nesting_depth + 1, current.envs[-1]]
|
92
96
|
end
|
97
|
+
|
98
|
+
puts '-' * 80
|
99
|
+
puts
|
100
|
+
puts tree
|
93
101
|
puts
|
94
102
|
end
|
data/cmd/run.rb
CHANGED