tap-server 0.5.0 → 0.6.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.
Files changed (47) hide show
  1. data/History +4 -0
  2. data/MIT-LICENSE +17 -15
  3. data/README +2 -11
  4. data/cmd/server.rb +27 -41
  5. data/lib/tap/controller.rb +22 -31
  6. data/lib/tap/controllers/app.rb +20 -116
  7. data/lib/tap/controllers/data.rb +16 -1
  8. data/lib/tap/controllers/server.rb +58 -15
  9. data/lib/tap/generator/generators/controller.rb +23 -0
  10. data/lib/tap/server.rb +75 -53
  11. data/lib/tap/tasks/echo.rb +1 -1
  12. data/templates/tap/generator/generators/controller/resource.erb +14 -0
  13. data/templates/tap/generator/generators/controller/test.erb +0 -0
  14. data/templates/tap/generator/generators/controller/view.erb +1 -0
  15. data/views/configurable/configurations.erb +57 -0
  16. data/views/configurable/default.erb +1 -0
  17. data/views/layout.erb +5 -2
  18. data/views/tap/{task → app/api}/help.erb +6 -4
  19. data/views/tap/controller/help.erb +4 -2
  20. data/views/tap/controllers/app/index.erb +47 -0
  21. data/views/tap/controllers/data/_upload.erb +1 -1
  22. data/views/tap/controllers/data/index.erb +16 -5
  23. data/views/tap/controllers/server/index.erb +10 -33
  24. data/views/tap/signals/signal/get.erb +1 -0
  25. data/views/tap/signals/signal/index.erb +4 -0
  26. data/views/tap/signals/signal/post.erb +1 -0
  27. metadata +18 -26
  28. data/lib/tap/controllers/schema.rb +0 -202
  29. data/lib/tap/server/runner.rb +0 -71
  30. data/public/javascripts/prototype.js +0 -4221
  31. data/public/javascripts/tap.js +0 -112
  32. data/views/configurable/_configs.erb +0 -33
  33. data/views/configurable/_flag.erb +0 -2
  34. data/views/configurable/_list_select.erb +0 -6
  35. data/views/configurable/_select.erb +0 -5
  36. data/views/configurable/_switch.erb +0 -2
  37. data/views/tap/controllers/app/_action.erb +0 -3
  38. data/views/tap/controllers/app/build.erb +0 -18
  39. data/views/tap/controllers/app/enque.erb +0 -13
  40. data/views/tap/controllers/app/info.erb +0 -21
  41. data/views/tap/controllers/app/tail.erb +0 -8
  42. data/views/tap/controllers/data/_index_entry.erb +0 -1
  43. data/views/tap/controllers/schema/_build.erb +0 -6
  44. data/views/tap/controllers/schema/_index_entry.erb +0 -6
  45. data/views/tap/controllers/schema/entry.erb +0 -144
  46. data/views/tap/task/input.erb +0 -17
  47. data/views/tap/tasks/load/input.erb +0 -11
@@ -1,112 +0,0 @@
1
- var Tap = {
2
- App: {},
3
- Schema: {},
4
- };
5
-
6
- Tap.App = {
7
- /* Performs a tail update to target at the specified interval as long as
8
- * checkbox is checked. A tail update posts to action and inserts the
9
- * response at the bottom of target.
10
- */
11
- tail: function(action, checkbox, target, interval) {
12
- if($(checkbox).checked) {
13
- new Ajax.Request(action, {
14
- method: 'post',
15
- parameters: {
16
- pos: $(target).innerHTML.length
17
- },
18
- onSuccess: function(transport) {
19
- new Insertion.Bottom(target, transport.responseText);
20
- },
21
- onFailure: function(transport) {
22
- alert(transport.responseText);
23
- $(checkbox).checked = false;
24
- }
25
- });
26
-
27
- var update = "Tap.App.tail('" + action + "', '" + checkbox + "', '" + target + "', " + interval + ");"
28
- setTimeout(update, interval);
29
- }
30
- },
31
-
32
- /* Performs a info update to target at the specified interval as long as
33
- * checkbox is checked. An info update posts to action and replaces the
34
- * inner html of target with the response.
35
- */
36
- info: function(action, checkbox, target, interval) {
37
- if($(checkbox).checked) {
38
- new Ajax.Request(action, {
39
- method: 'post',
40
- onSuccess: function(transport) {
41
- $(target).update(transport.responseText);
42
- },
43
- onFailure: function(transport) {
44
- alert(transport.responseText);
45
- $(checkbox).checked = false;
46
- }
47
- });
48
-
49
- var update = "Tap.App.info('" + action + "', '" + checkbox + "', '" + target + "', " + interval + ");"
50
- setTimeout(update, interval);
51
- }
52
- },
53
- };
54
-
55
- Tap.Schema = {
56
- /* Collects schema parameters in the specified element (ie source and target
57
- * nodes that are checked, and the currently selected tasc, etc.). These
58
- * parameters are used by the server to determine how to respond to actions
59
- * on a form.
60
- */
61
- parameters: function(id) {
62
- // Lookup elements
63
- element = document.getElementById(id)
64
- nodes = element.select('.node');
65
- manifests = element.select('.manifest');
66
-
67
- // Determine the indicies of source and target nodes
68
- sources = []
69
- targets = []
70
- for (i=0;i<nodes.length;i++) {
71
- source = nodes[i].getElementsByClassName('source_checkbox')[0];
72
- if(source.checked) {
73
- source.checked = false;
74
- sources.push(i);
75
- };
76
-
77
- target = nodes[i].getElementsByClassName('target_checkbox')[0];
78
- if(target.checked) {
79
- target.checked = false;
80
- targets.push(i);
81
- };
82
- };
83
-
84
- // Determine tascs selected by manifests
85
- tascs = []
86
- for (i=0;i<manifests.length;i++) {
87
- manifest = manifests[i];
88
- tascs.push(manifest.value);
89
- manifest.value = "";
90
- };
91
-
92
- parameters = {
93
- index: nodes.length,
94
- sources: sources,
95
- targets: targets,
96
- tascs: tascs
97
- };
98
- return parameters;
99
- },
100
-
101
- /* Performs an update to the specified element. Update posts to action with
102
- * the Schema.parameters for element and inserts the response at the bottom
103
- * of the element.
104
- */
105
- update: function(id, action) {
106
- new Ajax.Updater(id, action, {
107
- method: 'post',
108
- insertion: Insertion.Bottom,
109
- parameters: Tap.Schema.parameters(id)
110
- });
111
- },
112
- };
@@ -1,33 +0,0 @@
1
- <dl class="configs">
2
- <% configs.each_pair do |key, config| %>
3
- <% next if config[:type] == :hidden %>
4
- <% config_name = "#{name}[#{key.inspect}]" %>
5
- <% value = values[key] %>
6
- <% if config.is_nest? %>
7
- <dt class="name"><%= key %></dt>
8
- <dd class="nested-configs">
9
- <% configurations = config.default(false).delegates %>
10
- <%= module_render("_configs.erb", obj, :locals => {
11
- :name => config_name,
12
- :configs => configurations,
13
- :values => value || default_config(configurations)
14
- }) %>
15
- </dd>
16
- <% else %>
17
- <dt><%= key %></dt>
18
- <dd class="config">
19
- <% if config_template = module_path("_#{config[:type]}.erb", obj) %>
20
- <%= render(
21
- :file => config_template,
22
- :locals => {
23
- :obj => obj,
24
- :name => config_name,
25
- :config => config,
26
- :value => value}) %>
27
- <% else%>
28
- <input name="<%= config_name %>" type="text" value="<%= format_yaml(value) %>" />
29
- <% end %>
30
- </dd>
31
- <% end %>
32
- <% end %>
33
- </dl>
@@ -1,2 +0,0 @@
1
- <input name="<%= name %>" type="hidden" value="false" />
2
- <input name="<%= name %>" type="checkbox" value="true" <%= value ? 'checked="true"' : '' %> />
@@ -1,6 +0,0 @@
1
- <input type="hidden" name="<%= name %>[]" value="#" />
2
- <select name="<%= name %>[]" multiple="true">
3
- <% (config[:options] || []).each do |option| %>
4
- <option value="<%= format_yaml(option) %>" <%= value && value.include?(option) ? "selected='true' " : ""%>><%= option %></option>
5
- <% end %>
6
- </select>
@@ -1,5 +0,0 @@
1
- <select name="<%= name %>">
2
- <% (config[:options] || []).each do |option| %>
3
- <option value="<%= format_yaml(option) %>" <%= value == option ? "selected='true' " : ""%>><%= option %></option>
4
- <% end %>
5
- </select>
@@ -1,2 +0,0 @@
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>
@@ -1,3 +0,0 @@
1
- <form action="<%= uri action %>" style="display:inline" method="post">
2
- <input type="submit" value="<%= action %>" />
3
- </form>
@@ -1,18 +0,0 @@
1
- <form action="<%= uri :build %>" method="post">
2
- <textarea rows="10" cols="40" name="schema">
3
- tasks:
4
- load:
5
- id: load
6
- dump:
7
- id: dump
8
- joins:
9
- - - [load]
10
- - [dump]
11
- </textarea><br/>
12
- <input type="checkbox" name="reset">reset</input>
13
- <input type="checkbox" name="run">run</input>
14
- <input type="submit" value="build" />
15
- </form>
16
- <ul>
17
- <li><a href="<%= uri :info %>">Info</a></li>
18
- </ul>
@@ -1,13 +0,0 @@
1
- <form action="<%= uri :enque %>" method="post">
2
- <textarea rows="10" cols="40" name="queue">
3
- - - load
4
- - - goodnight moon
5
- - - load
6
- - - hello world
7
- </textarea><br/>
8
- <input type="hidden" name="load" value="on" />
9
- <input type="submit" value="enque" />
10
- </form>
11
- <ul>
12
- <li><a href="<%= uri :info %>">Info</a></li>
13
- </ul>
@@ -1,21 +0,0 @@
1
- <div>
2
- <% actions.each do |action| %>
3
- <%= render "_action.erb", :locals => {:action => action } %>
4
- <% end %>
5
- <%= app.info %>
6
- </div>
7
- <ul>
8
- <li><a href="<%= uri :schema %>">Build</a> (<a href="<%= uri :build %>">manual</a>)</li>
9
- <li><a href="<%= uri :data %>">Enque</a> (<a href="<%= uri :enque %>">manual</a>)</li>
10
- </ul>
11
-
12
- <h3>Current Build:</h3>
13
- <% if tasks.empty? %>
14
- <span>(no workflow built)</span>
15
- <% end %>
16
- <dl>
17
- <% tasks.each_pair do |key, task| %>
18
- <dt><%= key %></dt>
19
- <dd><%= task.class %></dd>
20
- <% end %>
21
- </dl>
@@ -1,8 +0,0 @@
1
- <% update_tail = "Tap.App.tail('/app/tail/#{id}', 'update-#{id}', 'content-#{id}', 1000);" %>
2
- <div class="tail" id="tail-<%= id %>">
3
- <input class="update" id="update-<%= id %>" type="checkbox" <%= update ? "checked='true' " : "" %>onchange="<%= update_tail %>" />
4
- <a href="/app/tail/<%= id %>">update</a>
5
- <span class="path" id="path-<%= id %>"><%= path %></span>
6
- <pre class="content" id="content-<%= id %>"><%= content %></pre>
7
- </div>
8
- <script type="text/javascript"><%= update ? update_tail : "" %></script>
@@ -1 +0,0 @@
1
- <%= data.cache[type].include?(id) ? "*" : "" %><a href="<%= uri(id) %>"><%= id %></a>
@@ -1,6 +0,0 @@
1
- <form id="build_<%= id %>" class="build" method="post" action="<%= uri("../build") %>">
2
- <input type="hidden" name="_method" value="build" />
3
- <input type="hidden" name="id" value="<%= id %>" />
4
- <input type="hidden" name="reset" value="on" />
5
- <input type="submit" value="Build" />
6
- </form>
@@ -1,6 +0,0 @@
1
- <%= data.cache[type].include?(id) ? "*" : "" %><%= id %>
2
- <ul>
3
- <li><a href="<%= uri(id) %>">edit</a></li>
4
- <li><a href="<%= uri(id, :as => :preview) %>">preview</a></li>
5
- <li><a href="<%= uri(id, :as => :download) %>">download</a></li>
6
- </ul>
@@ -1,144 +0,0 @@
1
- <%= render('_build.erb', :locals => {:id => id}) %>
2
- <%= render('_controls.erb', :locals => {:id => id}) %>
3
-
4
- <!-- add form -->
5
- <% summary = summarize(schema) %>
6
- <form id="add_<%= id %>" class="add" method="post" action="<%= uri(id) %>">
7
- <input type="hidden" name="_method" value="add" />
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>
26
- <table>
27
- <% summary.each do |(key, inputs, outputs)| %>
28
- <tr>
29
- <td><input name="outputs[]" value="<%= key %>" type="checkbox" /></td>
30
- <td><a href="#task_<%= key %>"><%= key %></a></td>
31
- <td><input name="inputs[]" value="<%= key %>" type="checkbox" /></td>
32
- <td>[<% inputs.each do |index| %><a href="#join_<%= index %>"><%= index %></a> <% end %>]</td>
33
- <td>[<% outputs.each do |index| %><a href="#join_<%= index %>"><%= index %></a> <% end %>]</td>
34
- </tr>
35
- <% end %>
36
- </table>
37
- <ul>
38
- <% server.env.minimap.each do |(env_name, env)| %>
39
- <% env.manifest(:join).minimap.each do |(name, const)| %>
40
- <% key = "#{env_name}:#{name}" %>
41
- <li><input name="join" value="<%= key %>" type="radio"><%= key %></input></li>
42
- <% end %>
43
- <% end %>
44
- </ul>
45
-
46
- <h3>Middleware</h3>
47
- <ul>
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)| %>
59
- <li><input name="queue[]" value="<%= key %>" type="checkbox"><%= key %></input></li>
60
- <% end %>
61
- </ul>
62
-
63
- <input type="submit" value="Add" />
64
- </form>
65
-
66
- <!-- remove form -->
67
- <form id="remove_<%= id %>" class="remove" method="post" action="<%= uri(id) %>">
68
- <input type="hidden" name="_method" value="remove" />
69
-
70
- <h2>Remove:</h2>
71
- <p>
72
- Select resources to remove.
73
- </p>
74
-
75
- <h3>Tasks</h3>
76
- <ul>
77
- <% summary.each do |(key, inputs, outputs)| %>
78
- <li><input name="tasks[]" value="<%= key %>" type="checkbox"><%= key %></input></li>
79
- <% end %>
80
- </ul>
81
-
82
- <h3>Joins</h3>
83
- <ul>
84
- <% schema.joins.each_index do |index| %>
85
- <li><input name="joins[]" value="<%= index %>" type="checkbox"><%= index %></input></li>
86
- <% end %>
87
- </ul>
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>
97
- <ul>
98
- <% schema.queue.each_index do |index| %>
99
- <li><input name="queue[]" value="<%= index %>" type="checkbox"><%= index %></input></li>
100
- <% end %>
101
- </ul>
102
-
103
- <input type="submit" value="Remove" />
104
- </form>
105
-
106
- <!-- configure form -->
107
- <form id="configure_<%= id %>" class="configure" method="post" action="<%= uri(id) %>">
108
- <input type="hidden" name="_method" value="save" />
109
-
110
- <h2>Configure:</h2>
111
-
112
- <h3>Tasks</h3>
113
- <ul class="tasks">
114
- <% schema.tasks.each_pair do |key, task| %>
115
- <% name = "schema[:tasks][#{key}]" %>
116
- <li id="task_<%= key %>">
117
- <h3><a href="#add_<%= id %>"><%= key %></a></h3>
118
-
119
- <input type="hidden" name="<%= name %>[:id]" value="<%= task[:id] %>">
120
- <%= render_config(task, "#{name}[:config]") %>
121
- </li>
122
- <% end %>
123
- </ul>
124
-
125
- <h3>Joins</h3>
126
- <ul class="joins">
127
- <% schema.joins.each_with_index do |(inputs, outputs, join), index| %>
128
- <% name = "schema[:joins][]" %>
129
- <li id="join_<%= index %>">
130
- <h3><a href="#add_<%= id %>"><%= index %></a></h3>
131
- <% inputs.each do |input| %>
132
- <input type="hidden" name="<%= name %>[0][]" value="<%= input %>">
133
- <% end %>
134
- <% outputs.each do |output| %>
135
- <input type="hidden" name="<%= name %>[1][]" value="<%= output %>">
136
- <% end %>
137
- <input type="hidden" name="<%= name %>[2][:id]" value="<%= join[:id] || 'join' %>">
138
- <%= render_config(join, "#{name}[2][:config]") %>
139
- </li>
140
- <% end %>
141
- </ul>
142
-
143
- <input type="submit" value="Save" />
144
- </form>
@@ -1,17 +0,0 @@
1
- <ul>
2
- <% obj.args.arguments.each do |argument| %>
3
- <li class="input">
4
- <input name="<%= name %>[]" value="<%= args.shift %>" />
5
- <span><%= argument %></span>
6
- <% if argument =~ /\.{3}\z/ %>
7
- <% args << '' %>
8
- <% args.each do |arg| %>
9
- </li>
10
- <li class="input">
11
- <input name="<%= name %>[]" value="<%= arg %>" />
12
- <span>...</span>
13
- <% end %>
14
- <% end %>
15
- </li>
16
- <% end %>
17
- </ul>
@@ -1,11 +0,0 @@
1
- <ul>
2
- <li class="input">
3
- <% config = task['config'] %>
4
- <% if config && config['file'] == 'true' %>
5
- <input name="<%= name %>[]" value="<%= args[0] %>" />
6
- <% else %>
7
- <textarea name="<%= name %>[]"><%= args[0] %></textarea>
8
- <% end %>
9
- <span>Data</span>
10
- </li>
11
- </ul>