tap-server 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History +5 -0
- data/lib/tap/controller/extname.rb +29 -0
- data/lib/tap/controller/utils.rb +34 -0
- data/lib/tap/controller.rb +41 -15
- data/lib/tap/controllers/data.rb +19 -5
- data/lib/tap/controllers/schema.rb +91 -64
- data/views/configurable/_configs.erb +14 -9
- data/views/configurable/_flag.erb +1 -1
- data/views/configurable/_list_select.erb +2 -4
- data/views/configurable/_select.erb +1 -2
- data/views/configurable/_switch.erb +2 -2
- data/views/tap/controller/help.erb +32 -0
- data/views/tap/controllers/schema/entry.erb +67 -58
- data/views/tap/controllers/server/index.erb +21 -22
- data/views/tap/task/help.erb +49 -0
- metadata +6 -7
- data/views/configurable/_config.erb +0 -1
- data/views/tap/controllers/schema/join.erb +0 -6
- data/views/tap/controllers/schema/task.erb +0 -6
- data/views/tap/controllers/server/help.erb +0 -23
data/History
CHANGED
@@ -0,0 +1,29 @@
|
|
1
|
+
module Tap
|
2
|
+
class Controller
|
3
|
+
|
4
|
+
# Add handling of extnames to controller paths. The extname of a request
|
5
|
+
# is chomped and stored in the extname attribute for use wherever.
|
6
|
+
module Extname
|
7
|
+
|
8
|
+
# Returns the extname for the current request, or nil if no extname
|
9
|
+
# was specified in the paths_info.
|
10
|
+
def extname
|
11
|
+
@extname ||= nil
|
12
|
+
end
|
13
|
+
|
14
|
+
# Overrides route to chomp of the extname from the request path info.
|
15
|
+
# If no extname is specified, extname will be remain nil.
|
16
|
+
def route
|
17
|
+
@extname = File.extname(request.path_info)
|
18
|
+
@extname = nil if @extname.empty?
|
19
|
+
args = super
|
20
|
+
|
21
|
+
unless args.empty? || extname == nil
|
22
|
+
args.last.chomp!(extname)
|
23
|
+
end
|
24
|
+
|
25
|
+
args
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/lib/tap/controller/utils.rb
CHANGED
@@ -24,6 +24,40 @@ module Tap
|
|
24
24
|
|
25
25
|
[200, headers, [content]]
|
26
26
|
end
|
27
|
+
|
28
|
+
def yamlize(obj, indent="")
|
29
|
+
case obj
|
30
|
+
when Hash
|
31
|
+
lines = []
|
32
|
+
obj.each_pair do |key, value|
|
33
|
+
lines << case value
|
34
|
+
when Hash, Array
|
35
|
+
"#{indent}#{key}:\n#{yamlize(value, indent + ' ')}"
|
36
|
+
when '#'
|
37
|
+
next
|
38
|
+
else
|
39
|
+
"#{indent}#{key}: #{value}"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
lines.empty? ? "#{indent}{}" : lines.join("\n")
|
43
|
+
when Array
|
44
|
+
lines = []
|
45
|
+
obj.each do |value|
|
46
|
+
lines << case value
|
47
|
+
when Hash, Array
|
48
|
+
"#{indent}-\n#{yamlize(value, indent + ' ')}"
|
49
|
+
when '#'
|
50
|
+
next
|
51
|
+
else
|
52
|
+
"#{indent}- #{value}"
|
53
|
+
end
|
54
|
+
end
|
55
|
+
lines.empty? ? "#{indent}[]" : lines.join("\n")
|
56
|
+
else
|
57
|
+
obj
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
27
61
|
end
|
28
62
|
end
|
29
63
|
end
|
data/lib/tap/controller.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'erb'
|
2
2
|
require 'tap/server'
|
3
|
+
require 'tap/controller/extname'
|
3
4
|
require 'tap/controller/rest_routes'
|
4
5
|
require 'tap/controller/utils'
|
5
6
|
|
@@ -31,10 +32,11 @@ module Tap
|
|
31
32
|
end
|
32
33
|
|
33
34
|
set_variables.each do |variable|
|
34
|
-
|
35
|
+
value = get(variable)
|
36
|
+
value = value.dup if Configurable::Delegate.duplicable_value?(value)
|
37
|
+
child.set(variable, value)
|
35
38
|
end
|
36
39
|
|
37
|
-
child.set(:actions, actions.dup)
|
38
40
|
child.set(:define_action, true)
|
39
41
|
end
|
40
42
|
|
@@ -52,17 +54,14 @@ module Tap
|
|
52
54
|
|
53
55
|
# Sets an instance variable for self (ie the class), short for:
|
54
56
|
#
|
55
|
-
# instance_variable_set(:@attribute,
|
57
|
+
# instance_variable_set(:@attribute, value)
|
56
58
|
#
|
57
|
-
#
|
58
|
-
#
|
59
|
-
#
|
60
|
-
|
61
|
-
# default_action:: the default action (:index)
|
62
|
-
#
|
63
|
-
def set(variable, input)
|
59
|
+
# Set variables inherited by subclasses. The value is duplicated on
|
60
|
+
# the subclass so the parent and child variable may be modified
|
61
|
+
# independently.
|
62
|
+
def set(variable, value)
|
64
63
|
set_variables << variable
|
65
|
-
instance_variable_set("@#{variable}",
|
64
|
+
instance_variable_set("@#{variable}", value)
|
66
65
|
end
|
67
66
|
|
68
67
|
# Gets the value of an instance variable set via set. Returns nil for
|
@@ -72,7 +71,7 @@ module Tap
|
|
72
71
|
instance_variable_get("@#{variable}")
|
73
72
|
end
|
74
73
|
|
75
|
-
# An array of variables set via set.
|
74
|
+
# An array of variables set via set.
|
76
75
|
def set_variables
|
77
76
|
@set_variables ||= []
|
78
77
|
end
|
@@ -169,8 +168,21 @@ module Tap
|
|
169
168
|
self.class.actions.include?(action.to_sym)
|
170
169
|
end
|
171
170
|
|
172
|
-
# Returns a uri to the specified action on self.
|
173
|
-
|
171
|
+
# Returns a uri to the specified action on self. The parameters will
|
172
|
+
# be built into a query string, if specified. By default the uri will
|
173
|
+
# not specify a protocol or host. Specifying an option hash will add
|
174
|
+
# these to the uri.
|
175
|
+
def uri(action=nil, params=nil, options=nil)
|
176
|
+
if action.kind_of?(Hash)
|
177
|
+
unless params == nil && options == nil
|
178
|
+
raise "extra arguments specified for uri hash syntax"
|
179
|
+
end
|
180
|
+
|
181
|
+
options = action
|
182
|
+
params = options[:params]
|
183
|
+
action = options[:action]
|
184
|
+
end
|
185
|
+
|
174
186
|
uri = []
|
175
187
|
|
176
188
|
if controller_path
|
@@ -183,11 +195,25 @@ module Tap
|
|
183
195
|
uri << action
|
184
196
|
end
|
185
197
|
|
186
|
-
unless params.empty?
|
198
|
+
unless params == nil || params.empty?
|
187
199
|
uri << '?'
|
188
200
|
uri << build_query(params)
|
189
201
|
end
|
190
202
|
|
203
|
+
if options
|
204
|
+
scheme = (options[:scheme] || request.scheme)
|
205
|
+
port = (options[:port] || request.port)
|
206
|
+
|
207
|
+
if scheme == "https" && port != 443 ||
|
208
|
+
scheme == "http" && port != 80
|
209
|
+
uri.unshift ":#{port}"
|
210
|
+
end
|
211
|
+
|
212
|
+
uri.unshift(options[:host] || request.host)
|
213
|
+
uri.unshift("://")
|
214
|
+
uri.unshift(scheme)
|
215
|
+
end
|
216
|
+
|
191
217
|
uri.join
|
192
218
|
end
|
193
219
|
|
data/lib/tap/controllers/data.rb
CHANGED
@@ -3,11 +3,12 @@ require 'tap/controller'
|
|
3
3
|
module Tap
|
4
4
|
module Controllers
|
5
5
|
# ::controller
|
6
|
-
class Data < Tap::Controller
|
6
|
+
class Data < Tap::Controller
|
7
7
|
include RestRoutes
|
8
8
|
include Utils
|
9
9
|
|
10
10
|
set :default_layout, 'layout.erb'
|
11
|
+
set :reserved_ids, ['new']
|
11
12
|
|
12
13
|
# GET /projects
|
13
14
|
def index
|
@@ -39,6 +40,8 @@ module Tap
|
|
39
40
|
def create(id)
|
40
41
|
if id == "new"
|
41
42
|
id = data.next_id(type).to_s
|
43
|
+
else
|
44
|
+
check_id(id)
|
42
45
|
end
|
43
46
|
|
44
47
|
data.create(type, id) {|io| io << parse_entry }
|
@@ -62,7 +65,8 @@ module Tap
|
|
62
65
|
end
|
63
66
|
|
64
67
|
def upload(id=nil)
|
65
|
-
check_id(id)
|
68
|
+
check_id(id) if id
|
69
|
+
|
66
70
|
data.import(type, request[type], id)
|
67
71
|
redirect uri
|
68
72
|
end
|
@@ -74,11 +78,21 @@ module Tap
|
|
74
78
|
|
75
79
|
# Renames id to request['name'] in the schema data.
|
76
80
|
def rename(id)
|
77
|
-
|
81
|
+
if new_id = request['new_id']
|
82
|
+
check_id(new_id)
|
83
|
+
else
|
84
|
+
raise "no new id specified"
|
85
|
+
end
|
86
|
+
|
87
|
+
redirect data.move(type, id, new_id)
|
78
88
|
end
|
79
89
|
|
80
90
|
def duplicate(id)
|
81
|
-
|
91
|
+
if new_id = request['new_id']
|
92
|
+
check_id(new_id)
|
93
|
+
end
|
94
|
+
|
95
|
+
redirect data.copy(type, id, new_id || "#{id}_copy")
|
82
96
|
end
|
83
97
|
|
84
98
|
# Helper methods
|
@@ -123,7 +137,7 @@ module Tap
|
|
123
137
|
end
|
124
138
|
|
125
139
|
def check_id(id)
|
126
|
-
if id
|
140
|
+
if self.class.get(:reserved_ids).include?(id)
|
127
141
|
raise "reserved id: #{id.inspect}"
|
128
142
|
end
|
129
143
|
end
|
@@ -4,41 +4,53 @@ module Tap
|
|
4
4
|
module Controllers
|
5
5
|
class Schema < Data
|
6
6
|
|
7
|
-
# Adds
|
7
|
+
# Adds to the specified schema. Parameters:
|
8
8
|
#
|
9
|
-
# tasks[]::
|
10
|
-
#
|
11
|
-
#
|
9
|
+
# tasks[]:: The specified task ids are added to the schema
|
10
|
+
# queue[]:: Queues with empty inputs are added for the task ids
|
11
|
+
# middleware[]:: Middleware by the specified ids are added
|
12
|
+
#
|
13
|
+
# Joins are a bit more complicated. A join is added if inputs
|
14
|
+
# and outputs are specified.
|
15
|
+
#
|
16
|
+
# inputs[]:: An array inputs to a join
|
17
|
+
# outputs[]:: An array outputs for a join
|
18
|
+
# join:: The join id, 'join' if unspecified
|
12
19
|
#
|
13
20
|
def add(id)
|
14
21
|
if id == "new"
|
15
22
|
id = data.next_id(type).to_s
|
16
23
|
end
|
17
24
|
|
18
|
-
tasks = request['tasks'] || []
|
19
|
-
inputs = request['inputs'] || []
|
20
|
-
outputs = request['outputs'] || []
|
21
|
-
queue = request['queue'] || []
|
22
|
-
|
23
25
|
update_schema(id) do |schema|
|
24
|
-
|
25
|
-
tasks
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
key =
|
30
|
-
i += 1
|
26
|
+
# tasks[]
|
27
|
+
if tasks = request['tasks']
|
28
|
+
tasks.each do |task|
|
29
|
+
key = 0
|
30
|
+
key += 1 while schema.tasks.has_key?(key.to_s)
|
31
|
+
schema.tasks[key.to_s] = {'id' => task}
|
31
32
|
end
|
32
|
-
|
33
|
-
current[key] = {'id' => task}
|
34
33
|
end
|
35
34
|
|
35
|
+
# inputs[] outputs[] join
|
36
|
+
inputs = request['inputs'] || []
|
37
|
+
outputs = request['outputs'] || []
|
36
38
|
if !inputs.empty? && !outputs.empty?
|
37
|
-
schema.joins << [inputs, outputs]
|
39
|
+
schema.joins << [inputs, outputs, {'id' => request['join'] || 'join'}]
|
38
40
|
end
|
39
41
|
|
40
|
-
queue
|
41
|
-
|
42
|
+
# queue[]
|
43
|
+
if queue = request['queue']
|
44
|
+
queue.each do |key|
|
45
|
+
schema.queue << [key, []]
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
# middleware[]
|
50
|
+
if middleware = request['middleware']
|
51
|
+
middleware.each do |middleware|
|
52
|
+
schema.middleware << {'id' => middleware}
|
53
|
+
end
|
42
54
|
end
|
43
55
|
end
|
44
56
|
|
@@ -49,6 +61,8 @@ module Tap
|
|
49
61
|
#
|
50
62
|
# tasks[]:: An array of task keys to remove.
|
51
63
|
# joins[]:: An array of join indicies to remove.
|
64
|
+
# queue[]:: An array of queue indicies to remove.
|
65
|
+
# middleware[]:: An array of middleware indicies to remove.
|
52
66
|
#
|
53
67
|
def remove(id)
|
54
68
|
if id == "new"
|
@@ -58,11 +72,10 @@ module Tap
|
|
58
72
|
tasks = request['tasks'] || []
|
59
73
|
joins = request['joins'] || []
|
60
74
|
queue = request['queue'] || []
|
75
|
+
middleware = request['middleware'] || []
|
61
76
|
|
62
77
|
update_schema(id) do |schema|
|
63
|
-
tasks.each
|
64
|
-
schema.tasks.delete(key)
|
65
|
-
end
|
78
|
+
tasks.each {|key| schema.tasks.delete(key) }
|
66
79
|
|
67
80
|
joins.each {|index| schema.joins[index.to_i] = nil }
|
68
81
|
schema.joins.compact!
|
@@ -70,24 +83,22 @@ module Tap
|
|
70
83
|
queue.each {|index| schema.queue[index.to_i] = nil }
|
71
84
|
schema.queue.compact!
|
72
85
|
|
86
|
+
middleware.each {|index| schema.middleware[index.to_i] = nil }
|
87
|
+
schema.middleware.compact!
|
88
|
+
|
73
89
|
schema.cleanup!
|
74
90
|
end
|
75
91
|
|
76
92
|
redirect uri(id)
|
77
93
|
end
|
78
94
|
|
79
|
-
def
|
95
|
+
def save(id)
|
80
96
|
if id == "new"
|
81
97
|
id = data.next_id(type).to_s
|
82
98
|
end
|
83
99
|
|
84
|
-
schema = Tap::Schema.new(request['schema'] || {})
|
85
|
-
schema.scrub! do |obj|
|
86
|
-
scrub(obj['config'])
|
87
|
-
end
|
88
|
-
|
89
100
|
data.create_or_update(type, id) do |io|
|
90
|
-
io << schema
|
101
|
+
io << yamlize(request['schema'] || '')
|
91
102
|
end
|
92
103
|
|
93
104
|
redirect uri(id)
|
@@ -111,8 +122,8 @@ module Tap
|
|
111
122
|
Tap::Schema.new
|
112
123
|
end
|
113
124
|
|
114
|
-
schema.resolve! do |type, key
|
115
|
-
env
|
125
|
+
schema.resolve! do |type, key|
|
126
|
+
env[type][key]
|
116
127
|
end
|
117
128
|
|
118
129
|
render "entry.erb", :locals => {
|
@@ -121,41 +132,28 @@ module Tap
|
|
121
132
|
}, :layout => true
|
122
133
|
end
|
123
134
|
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
135
|
+
#########################
|
136
|
+
# Helpers
|
137
|
+
#########################
|
138
|
+
|
139
|
+
def render_config(resource, name="")
|
140
|
+
klass = resource[:class]
|
141
|
+
values = resource[:config] || default_config(klass.configurations)
|
142
|
+
|
143
|
+
module_render "_configs.erb", klass,
|
144
|
+
:locals => {
|
145
|
+
:name => name,
|
146
|
+
:configs => klass.configurations,
|
147
|
+
:values => values
|
148
|
+
}
|
137
149
|
end
|
138
150
|
|
139
|
-
def default_config(
|
140
|
-
configs
|
141
|
-
Configurable::DelegateHash.new(configs).to_hash do |hash, key, value|
|
142
|
-
hash[key.to_s] = stringify(value)
|
143
|
-
end
|
151
|
+
def default_config(configs)
|
152
|
+
Configurable::DelegateHash.new(configs).to_hash
|
144
153
|
end
|
145
154
|
|
146
|
-
def
|
147
|
-
|
148
|
-
when Hash
|
149
|
-
obj.delete_if do |key, value|
|
150
|
-
value ? scrub(value) : true
|
151
|
-
end
|
152
|
-
when Array
|
153
|
-
obj.delete_if do |value|
|
154
|
-
value ? scrub(value) : true
|
155
|
-
end
|
156
|
-
end
|
157
|
-
|
158
|
-
false
|
155
|
+
def format_yaml(object)
|
156
|
+
object == nil ? "~" : YAML.dump(object)[4...-1].strip
|
159
157
|
end
|
160
158
|
|
161
159
|
def update_schema(id)
|
@@ -170,6 +168,35 @@ module Tap
|
|
170
168
|
|
171
169
|
id
|
172
170
|
end
|
171
|
+
|
172
|
+
def summarize(schema)
|
173
|
+
summary = {}
|
174
|
+
schema.tasks.each_key do |key|
|
175
|
+
summary[key] = [[],[]]
|
176
|
+
end
|
177
|
+
|
178
|
+
index = 0
|
179
|
+
join_order = []
|
180
|
+
schema.joins.each do |inputs, outputs, join|
|
181
|
+
join_order.concat inputs
|
182
|
+
|
183
|
+
inputs.each do |key|
|
184
|
+
summary[key][1] << index
|
185
|
+
end
|
186
|
+
|
187
|
+
outputs.each do |key|
|
188
|
+
summary[key][0] << index
|
189
|
+
end
|
190
|
+
|
191
|
+
index += 1
|
192
|
+
end
|
193
|
+
|
194
|
+
summary.keys.sort_by do |key|
|
195
|
+
join_order.index(key) || join_order.length
|
196
|
+
end.collect do |key|
|
197
|
+
[key, *summary[key]]
|
198
|
+
end
|
199
|
+
end
|
173
200
|
end
|
174
201
|
end
|
175
202
|
end
|
@@ -1,27 +1,32 @@
|
|
1
1
|
<dl class="configs">
|
2
|
-
<%
|
2
|
+
<% configs.each_pair do |key, config| %>
|
3
3
|
<% next if config[:type] == :hidden %>
|
4
|
+
<% config_name = "#{name}[#{key.inspect}]" %>
|
5
|
+
<% value = values[key] %>
|
4
6
|
<% if config.is_nest? %>
|
5
7
|
<dt class="name"><%= key %></dt>
|
6
8
|
<dd class="nested-configs">
|
9
|
+
<% configurations = config.default(false).delegates %>
|
7
10
|
<%= module_render("_configs.erb", obj, :locals => {
|
8
|
-
:
|
9
|
-
:
|
10
|
-
:
|
11
|
-
:values => values[key.to_s]
|
11
|
+
:name => config_name,
|
12
|
+
:configs => configurations,
|
13
|
+
:values => value || default_config(configurations)
|
12
14
|
}) %>
|
13
15
|
</dd>
|
14
16
|
<% else %>
|
15
17
|
<dt><%= key %></dt>
|
16
18
|
<dd class="config">
|
19
|
+
<% if config_template = module_path("_#{config[:type]}.erb", obj) %>
|
17
20
|
<%= render(
|
18
|
-
:file =>
|
21
|
+
:file => config_template,
|
19
22
|
:locals => {
|
20
|
-
:id => "#{id}_config_#{key}",
|
21
23
|
:obj => obj,
|
22
|
-
:name =>
|
24
|
+
:name => config_name,
|
23
25
|
:config => config,
|
24
|
-
:value =>
|
26
|
+
:value => value}) %>
|
27
|
+
<% else%>
|
28
|
+
<input name="<%= config_name %>" type="text" value="<%= format_yaml(value) %>" />
|
29
|
+
<% end %>
|
25
30
|
</dd>
|
26
31
|
<% end %>
|
27
32
|
<% end %>
|
@@ -1,2 +1,2 @@
|
|
1
1
|
<input name="<%= name %>" type="hidden" value="false" />
|
2
|
-
<input name="<%= name %>" type="checkbox" value="true" <%= value
|
2
|
+
<input name="<%= name %>" type="checkbox" value="true" <%= value ? 'checked="true"' : '' %> />
|
@@ -1,8 +1,6 @@
|
|
1
|
-
<input type="hidden" name="<%= name %>[]
|
1
|
+
<input type="hidden" name="<%= name %>[]" value="#" />
|
2
2
|
<select name="<%= name %>[]" multiple="true">
|
3
|
-
<% value.collect! {|val| stringify(val) } %>
|
4
3
|
<% (config[:options] || []).each do |option| %>
|
5
|
-
|
6
|
-
<option value="<%= escape_html(option) %>" <%= value.include?(option) ? "selected='true' " : ""%>><%= option %></option>
|
4
|
+
<option value="<%= format_yaml(option) %>" <%= value && value.include?(option) ? "selected='true' " : ""%>><%= option %></option>
|
7
5
|
<% end %>
|
8
6
|
</select>
|
@@ -1,6 +1,5 @@
|
|
1
1
|
<select name="<%= name %>">
|
2
2
|
<% (config[:options] || []).each do |option| %>
|
3
|
-
|
4
|
-
<option value="<%= escape_html(option) %>" <%= value == option ? "selected='true' " : ""%>><%= option %></option>
|
3
|
+
<option value="<%= format_yaml(option) %>" <%= value == option ? "selected='true' " : ""%>><%= option %></option>
|
5
4
|
<% end %>
|
6
5
|
</select>
|
@@ -1,2 +1,2 @@
|
|
1
|
-
<input name="<%= name %>" type="radio" value="true" <%= value
|
2
|
-
<input name="<%= name %>" type="radio" value="false" <%= value
|
1
|
+
<input name="<%= name %>" type="radio" value="true" <%= value ? 'checked="true" ' : '' %>>on</input>
|
2
|
+
<input name="<%= name %>" type="radio" value="false" <%= !value ? 'checked="true" ' : '' %>>off</input>
|
@@ -0,0 +1,32 @@
|
|
1
|
+
<h1 class="class"><%= obj %></h1>
|
2
|
+
|
3
|
+
<ul>
|
4
|
+
<li class="source_file">
|
5
|
+
<h2>Source File</h2>
|
6
|
+
<p><%= obj.source_file %><p>
|
7
|
+
</li>
|
8
|
+
<li>
|
9
|
+
<h2>Summary</h2>
|
10
|
+
<%= obj.desc.subject %>
|
11
|
+
</li>
|
12
|
+
<li>
|
13
|
+
<h2>Documentation</h2>
|
14
|
+
<pre class="desc"><%= obj.desc.wrap %></pre>
|
15
|
+
</li>
|
16
|
+
<li class="ancestors">
|
17
|
+
<h2>Actions</h2>
|
18
|
+
<ol>
|
19
|
+
<% obj.actions.each do |action| %>
|
20
|
+
<li><%= action %></li>
|
21
|
+
<% end %>
|
22
|
+
</ol>
|
23
|
+
</li>
|
24
|
+
<li class="ancestors">
|
25
|
+
<h2>Ancestors</h2>
|
26
|
+
<ol>
|
27
|
+
<% obj.ancestors.each do |ancestor| %>
|
28
|
+
<li><%= ancestor %></li>
|
29
|
+
<% end %>
|
30
|
+
</ol>
|
31
|
+
</li>
|
32
|
+
</ul>
|
@@ -1,14 +1,30 @@
|
|
1
1
|
<%= render('_build.erb', :locals => {:id => id}) %>
|
2
2
|
<%= render('_controls.erb', :locals => {:id => id}) %>
|
3
3
|
|
4
|
-
<h2>Design:</h2>
|
5
4
|
<!-- add form -->
|
6
|
-
<%
|
5
|
+
<% summary = summarize(schema) %>
|
7
6
|
<form id="add_<%= id %>" class="add" method="post" action="<%= uri(id) %>">
|
8
7
|
<input type="hidden" name="_method" value="add" />
|
9
8
|
|
9
|
+
<h2>Add:</h2>
|
10
|
+
<p>
|
11
|
+
Select resources to add or enque. To add a join, select the join
|
12
|
+
and the input and output indices for the join in the summary table.
|
13
|
+
</p>
|
14
|
+
|
15
|
+
<h3>Tasks</h3>
|
16
|
+
<ul>
|
17
|
+
<% server.env.minimap.each do |(env_name, env)| %>
|
18
|
+
<% env.manifest(:task).minimap.each do |(name, const)| %>
|
19
|
+
<% key = "#{env_name}:#{name}" %>
|
20
|
+
<li><input name="tasks[]" value="<%= key %>" type="checkbox"><%= key %></input></li>
|
21
|
+
<% end %>
|
22
|
+
<% end %>
|
23
|
+
</ul>
|
24
|
+
|
25
|
+
<h3>Joins</h3>
|
10
26
|
<table>
|
11
|
-
<%
|
27
|
+
<% summary.each do |(key, inputs, outputs)| %>
|
12
28
|
<tr>
|
13
29
|
<td><input name="outputs[]" value="<%= key %>" type="checkbox" /></td>
|
14
30
|
<td><a href="#task_<%= key %>"><%= key %></a></td>
|
@@ -18,22 +34,32 @@
|
|
18
34
|
</tr>
|
19
35
|
<% end %>
|
20
36
|
</table>
|
21
|
-
|
22
37
|
<ul>
|
23
38
|
<% server.env.minimap.each do |(env_name, env)| %>
|
24
|
-
<% env.manifest(:
|
39
|
+
<% env.manifest(:join).minimap.each do |(name, const)| %>
|
25
40
|
<% key = "#{env_name}:#{name}" %>
|
26
|
-
<li><input name="
|
41
|
+
<li><input name="join" value="<%= key %>" type="radio"><%= key %></input></li>
|
27
42
|
<% end %>
|
28
43
|
<% end %>
|
29
44
|
</ul>
|
30
45
|
|
46
|
+
<h3>Middleware</h3>
|
31
47
|
<ul>
|
32
|
-
<%
|
48
|
+
<% server.env.minimap.each do |(env_name, env)| %>
|
49
|
+
<% env.manifest(:middleware).minimap.each do |(name, const)| %>
|
50
|
+
<% key = "#{env_name}:#{name}" %>
|
51
|
+
<li><input name="middleware[]" value="<%= key %>" type="checkbox"><%= key %></input></li>
|
52
|
+
<% end %>
|
53
|
+
<% end %>
|
54
|
+
</ul>
|
55
|
+
|
56
|
+
<h3>Queue</h3>
|
57
|
+
<ul>
|
58
|
+
<% summary.each do |(key, inputs, outputs)| %>
|
33
59
|
<li><input name="queue[]" value="<%= key %>" type="checkbox"><%= key %></input></li>
|
34
60
|
<% end %>
|
35
61
|
</ul>
|
36
|
-
|
62
|
+
|
37
63
|
<input type="submit" value="Add" />
|
38
64
|
</form>
|
39
65
|
|
@@ -41,30 +67,36 @@
|
|
41
67
|
<form id="remove_<%= id %>" class="remove" method="post" action="<%= uri(id) %>">
|
42
68
|
<input type="hidden" name="_method" value="remove" />
|
43
69
|
|
70
|
+
<h2>Remove:</h2>
|
71
|
+
<p>
|
72
|
+
Select resources to remove.
|
73
|
+
</p>
|
74
|
+
|
75
|
+
<h3>Tasks</h3>
|
44
76
|
<ul>
|
45
|
-
<%
|
46
|
-
<li>
|
47
|
-
<input name="tasks[]" value="<%= key %>" type="checkbox" />
|
48
|
-
<a href="#task_<%= key %>"><%= key %></a>
|
49
|
-
</li>
|
77
|
+
<% summary.each do |(key, inputs, outputs)| %>
|
78
|
+
<li><input name="tasks[]" value="<%= key %>" type="checkbox"><%= key %></input></li>
|
50
79
|
<% end %>
|
51
80
|
</ul>
|
52
|
-
|
81
|
+
|
82
|
+
<h3>Joins</h3>
|
53
83
|
<ul>
|
54
84
|
<% schema.joins.each_index do |index| %>
|
55
|
-
<li>
|
56
|
-
<input name="joins[]" value="<%= index %>" type="checkbox" />
|
57
|
-
<a href="#join_<%= index %>"><%= index %></a>
|
58
|
-
</li>
|
85
|
+
<li><input name="joins[]" value="<%= index %>" type="checkbox"><%= index %></input></li>
|
59
86
|
<% end %>
|
60
87
|
</ul>
|
61
88
|
|
89
|
+
<h3>Middleware</h3>
|
90
|
+
<ul>
|
91
|
+
<% schema.middleware.each_index do |index| %>
|
92
|
+
<li><input name="middleware[]" value="<%= index %>" type="checkbox"><%= index %></input></li>
|
93
|
+
<% end %>
|
94
|
+
</ul>
|
95
|
+
|
96
|
+
<h3>Queue</h3>
|
62
97
|
<ul>
|
63
98
|
<% schema.queue.each_index do |index| %>
|
64
|
-
<li>
|
65
|
-
<input name="queue[]" value="<%= index %>" type="checkbox" />
|
66
|
-
<a href="#queue_<%= index %>"><%= index %></a>
|
67
|
-
</li>
|
99
|
+
<li><input name="queue[]" value="<%= index %>" type="checkbox"><%= index %></input></li>
|
68
100
|
<% end %>
|
69
101
|
</ul>
|
70
102
|
|
@@ -73,31 +105,28 @@
|
|
73
105
|
|
74
106
|
<!-- configure form -->
|
75
107
|
<form id="configure_<%= id %>" class="configure" method="post" action="<%= uri(id) %>">
|
76
|
-
<input type="hidden" name="_method" value="
|
108
|
+
<input type="hidden" name="_method" value="save" />
|
77
109
|
|
78
110
|
<h2>Configure:</h2>
|
111
|
+
|
112
|
+
<h3>Tasks</h3>
|
79
113
|
<ul class="tasks">
|
80
114
|
<% schema.tasks.each_pair do |key, task| %>
|
81
|
-
<% name = "schema[tasks][#{key}]" %>
|
82
|
-
|
83
|
-
<li id="task_<%= key %>" class="task">
|
115
|
+
<% name = "schema[:tasks][#{key}]" %>
|
116
|
+
<li id="task_<%= key %>">
|
84
117
|
<h3><a href="#add_<%= id %>"><%= key %></a></h3>
|
85
118
|
|
86
|
-
<input type="hidden" name="<%= name %>[id]" value="<%= task[
|
87
|
-
<%=
|
88
|
-
:id => "#{id}_task_#{key}",
|
89
|
-
:name => name,
|
90
|
-
:values => task['config'] || default_config(task_class),
|
91
|
-
:task => task }) %>
|
119
|
+
<input type="hidden" name="<%= name %>[:id]" value="<%= task[:id] %>">
|
120
|
+
<%= render_config(task, "#{name}[:config]") %>
|
92
121
|
</li>
|
93
122
|
<% end %>
|
94
123
|
</ul>
|
95
124
|
|
125
|
+
<h3>Joins</h3>
|
96
126
|
<ul class="joins">
|
97
127
|
<% schema.joins.each_with_index do |(inputs, outputs, join), index| %>
|
98
|
-
<% name = "schema[joins][]" %>
|
99
|
-
|
100
|
-
<li id="join_<%= index %>" class="join">
|
128
|
+
<% name = "schema[:joins][]" %>
|
129
|
+
<li id="join_<%= index %>">
|
101
130
|
<h3><a href="#add_<%= id %>"><%= index %></a></h3>
|
102
131
|
<% inputs.each do |input| %>
|
103
132
|
<input type="hidden" name="<%= name %>[0][]" value="<%= input %>">
|
@@ -105,31 +134,11 @@
|
|
105
134
|
<% outputs.each do |output| %>
|
106
135
|
<input type="hidden" name="<%= name %>[1][]" value="<%= output %>">
|
107
136
|
<% end %>
|
108
|
-
<input type="hidden" name="<%= name %>[2][id]" value="<%= join[
|
109
|
-
<%=
|
110
|
-
:id => "#{id}_join_#{index}",
|
111
|
-
:name => "#{name}[2]",
|
112
|
-
:values => join['config'] || default_config(join_class),
|
113
|
-
:join => join }) %>
|
114
|
-
</li>
|
115
|
-
<% end %>
|
116
|
-
</ul>
|
117
|
-
|
118
|
-
<h2>Enque:</h2>
|
119
|
-
<ul class="queue">
|
120
|
-
<% schema.queue.each_with_index do |(key, args), index| %>
|
121
|
-
<% name = "schema[queue][]" %>
|
122
|
-
<% task = schema.tasks[key] %>
|
123
|
-
<li id="queue_<%= index %>" class="queue">
|
124
|
-
<h3><%= key %></h3>
|
125
|
-
<input type="hidden" name="<%= name %>[0]" value="<%= key %>">
|
126
|
-
<%= module_render('input.erb', task['class'], :locals => {
|
127
|
-
:id => id,
|
128
|
-
:name => "#{name}[1]",
|
129
|
-
:args => args || [],
|
130
|
-
:task => task }) %>
|
137
|
+
<input type="hidden" name="<%= name %>[2][:id]" value="<%= join[:id] || 'join' %>">
|
138
|
+
<%= render_config(join, "#{name}[2][:config]") %>
|
131
139
|
</li>
|
132
140
|
<% end %>
|
133
141
|
</ul>
|
142
|
+
|
134
143
|
<input type="submit" value="Save" />
|
135
144
|
</form>
|
@@ -3,41 +3,40 @@
|
|
3
3
|
</div>
|
4
4
|
|
5
5
|
<div id="content_main">
|
6
|
-
<
|
6
|
+
<ol id="envs" class="manifest">
|
7
7
|
<% env_keys = server.env.minihash(true) %>
|
8
8
|
<% server.env.each do |env| %>
|
9
9
|
<% root = env.root %>
|
10
10
|
<% env_key = env_keys[env] %>
|
11
|
-
<dt class="key"><%= env_key %> (<%= root.root %>)</dt>
|
12
|
-
<dd class="value">
|
13
11
|
<% controllers = env.manifest(:controller) %>
|
12
|
+
<% tasks = env.manifest(:task) %>
|
13
|
+
<% next if controllers.empty? && tasks.empty? %>
|
14
|
+
<li>
|
15
|
+
<h2><%= env_key %></h2>
|
16
|
+
<ul>
|
14
17
|
<% unless controllers.empty? %>
|
15
|
-
<
|
16
|
-
|
17
|
-
|
18
|
-
<ol>
|
18
|
+
<li>
|
19
|
+
<h3>controllers</h3>
|
20
|
+
<ul>
|
19
21
|
<% controllers.minimap.each do |(key, const)| %>
|
20
|
-
<li><a href="<%= escape(key) %>"><%= key %></a> (<a href="<%= help_uri('controller', key) %>"
|
22
|
+
<li><a href="<%= escape(key) %>"><%= key %></a> (<a href="<%= help_uri('controller', key) %>">?</a>)</li>
|
21
23
|
<% end %>
|
22
|
-
</
|
23
|
-
</
|
24
|
-
</dl>
|
24
|
+
</ul>
|
25
|
+
</li>
|
25
26
|
<% end %>
|
26
27
|
|
27
|
-
<% tasks = env.manifest(:task) %>
|
28
28
|
<% unless tasks.empty? %>
|
29
|
-
<
|
30
|
-
|
31
|
-
|
32
|
-
<ol>
|
29
|
+
<li>
|
30
|
+
<h3>tasks</h3>
|
31
|
+
<ul>
|
33
32
|
<% tasks.minimap.each do |(key, const)| %>
|
34
|
-
<li><%= key %> (<a href="<%= help_uri('task', key) %>"
|
33
|
+
<li><%= key %> (<a href="<%= help_uri('task', key) %>">?</a>)</li>
|
35
34
|
<% end %>
|
36
|
-
</
|
37
|
-
</
|
38
|
-
</dl>
|
35
|
+
</ul>
|
36
|
+
</li>
|
39
37
|
<% end %>
|
40
|
-
|
38
|
+
</ul>
|
39
|
+
</li>
|
41
40
|
<% end %>
|
42
|
-
</
|
41
|
+
</ol>
|
43
42
|
</div>
|
@@ -0,0 +1,49 @@
|
|
1
|
+
<h1 class="class"><%= obj %></h1>
|
2
|
+
|
3
|
+
<ul>
|
4
|
+
<li class="source_file">
|
5
|
+
<h2>Source File</h2>
|
6
|
+
<p><%= obj.source_file %><p>
|
7
|
+
</li>
|
8
|
+
<li>
|
9
|
+
<h2>Summary</h2>
|
10
|
+
<%= obj.desc.subject %>
|
11
|
+
</li>
|
12
|
+
<li>
|
13
|
+
<h2>Documentation</h2>
|
14
|
+
<pre class="desc"><%= obj.desc.wrap %></pre>
|
15
|
+
</li>
|
16
|
+
<li>
|
17
|
+
<h2>Signature</h2>
|
18
|
+
<%= obj.args %>
|
19
|
+
</li>
|
20
|
+
<li class="ancestors">
|
21
|
+
<% unless obj.configurations.empty? %>
|
22
|
+
<h2>Configurations</h2>
|
23
|
+
<table>
|
24
|
+
<tr>
|
25
|
+
<th>Key</th>
|
26
|
+
<th>Default</th>
|
27
|
+
<th>Type</th>
|
28
|
+
<th>Description</th>
|
29
|
+
</tr>
|
30
|
+
<% obj.configurations.each_pair do |key, delegate| %>
|
31
|
+
<tr>
|
32
|
+
<td><%= key %></td>
|
33
|
+
<td><%= delegate.default %></td>
|
34
|
+
<td><%= delegate[:type] %></td>
|
35
|
+
<td><%= delegate[:desc] %></td>
|
36
|
+
</tr>
|
37
|
+
<% end %>
|
38
|
+
</table>
|
39
|
+
<% end %>
|
40
|
+
</li>
|
41
|
+
<li class="ancestors">
|
42
|
+
<h2>Ancestors</h2>
|
43
|
+
<ol>
|
44
|
+
<% obj.ancestors.each do |ancestor| %>
|
45
|
+
<li><%= ancestor %></li>
|
46
|
+
<% end %>
|
47
|
+
</ol>
|
48
|
+
</li>
|
49
|
+
</ul>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tap-server
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.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-06-17 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.18.0
|
24
24
|
version:
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rack
|
@@ -45,6 +45,7 @@ extra_rdoc_files:
|
|
45
45
|
files:
|
46
46
|
- cmd/server.rb
|
47
47
|
- lib/tap/controller.rb
|
48
|
+
- lib/tap/controller/extname.rb
|
48
49
|
- lib/tap/controller/rest_routes.rb
|
49
50
|
- lib/tap/controller/utils.rb
|
50
51
|
- lib/tap/controllers/app.rb
|
@@ -63,7 +64,6 @@ files:
|
|
63
64
|
- tap.yml
|
64
65
|
- views/404.erb
|
65
66
|
- views/500.erb
|
66
|
-
- views/configurable/_config.erb
|
67
67
|
- views/configurable/_configs.erb
|
68
68
|
- views/configurable/_flag.erb
|
69
69
|
- views/configurable/_list_select.erb
|
@@ -71,6 +71,7 @@ files:
|
|
71
71
|
- views/configurable/_switch.erb
|
72
72
|
- views/layout.erb
|
73
73
|
- views/object/obj.erb
|
74
|
+
- views/tap/controller/help.erb
|
74
75
|
- views/tap/controllers/app/_action.erb
|
75
76
|
- views/tap/controllers/app/build.erb
|
76
77
|
- views/tap/controllers/app/enque.erb
|
@@ -83,13 +84,11 @@ files:
|
|
83
84
|
- views/tap/controllers/data/index.erb
|
84
85
|
- views/tap/controllers/schema/_build.erb
|
85
86
|
- views/tap/controllers/schema/_index_entry.erb
|
86
|
-
- views/tap/controllers/schema/join.erb
|
87
87
|
- views/tap/controllers/schema/entry.erb
|
88
|
-
- views/tap/controllers/schema/task.erb
|
89
88
|
- views/tap/controllers/server/access.erb
|
90
89
|
- views/tap/controllers/server/admin.erb
|
91
|
-
- views/tap/controllers/server/help.erb
|
92
90
|
- views/tap/controllers/server/index.erb
|
91
|
+
- views/tap/task/help.erb
|
93
92
|
- views/tap/task/input.erb
|
94
93
|
- views/tap/tasks/load/input.erb
|
95
94
|
- README
|
@@ -1 +0,0 @@
|
|
1
|
-
<input name="<%= name %>" type="text" value="<%= escape_html(value) %>" />
|
@@ -1,23 +0,0 @@
|
|
1
|
-
<h1 class="class"><%= obj %></h1>
|
2
|
-
<span class="summary"><%= obj.desc.subject %></span>
|
3
|
-
|
4
|
-
<h2>Documentation</h2>
|
5
|
-
<pre class="desc"><%= obj.desc.wrap %></pre>
|
6
|
-
|
7
|
-
<h2>Attributes</h2>
|
8
|
-
<table>
|
9
|
-
<tr class="source_file">
|
10
|
-
<td>Source File</td>
|
11
|
-
<td><%= obj.source_file %></td>
|
12
|
-
<tr>
|
13
|
-
<tr class="ancestors">
|
14
|
-
<td>Ancestors</td>
|
15
|
-
<td>
|
16
|
-
<ul>
|
17
|
-
<% obj.ancestors.each do |ancestor| %>
|
18
|
-
<li><%= ancestor %></li>
|
19
|
-
<% end %>
|
20
|
-
</ul>
|
21
|
-
</td>
|
22
|
-
<tr>
|
23
|
-
</table>
|