tap-server 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -2,8 +2,10 @@
2
2
 
3
3
  <ul>
4
4
  <li class="source_file">
5
- <h2>Source File</h2>
6
- <p><%= obj.source_file %><p>
5
+ <h2>Registered As</h2>
6
+ <ul><% Lazydoc::Document[obj.to_s].each_pair do |type, comment| %>
7
+ <li><%= type %> (<%= comment.document.source_file %>)</li><% end %>
8
+ </ul>
7
9
  </li>
8
10
  <li>
9
11
  <h2>Summary</h2>
@@ -0,0 +1,47 @@
1
+ <div>
2
+ <% [:run, :stop, :terminate].each do |signal| %>
3
+ <form action="<%= uri(nil, signal) %>" style="display:inline" method="post">
4
+ <input type="hidden" name="_mode" value="thread" />
5
+ <input type="submit" value="<%= signal %>" />
6
+ </form>
7
+ <% end %>
8
+ <%= app.info %>
9
+ </div>
10
+
11
+ <h3>Build:</h3>
12
+ <% env = app.env %>
13
+ <% objects = app.objects %>
14
+ <form action="<%= uri nil, :build %>" method="post">
15
+ <input type="text" name="set" value="<%= objects.length %>">Variable</input><br/>
16
+ <input type="text" name="type">Type</input><br/>
17
+ <input type="text" name="class">Class</input><br/>
18
+ <input type="submit" value="build" />
19
+ </form>
20
+
21
+ <form method="post" action="<%= uri(nil) %>">
22
+ <h3>Objects:</h3>
23
+
24
+ <% if objects.empty? %>
25
+ <span>(no workflow built)</span>
26
+ <% end %>
27
+ <ul>
28
+ <% objects.each_pair do |id, obj| %>
29
+ <li>
30
+ <input type="checkbox" name="ids[]" value="<%= id %>" />
31
+ <a href="<%= uri(id) %>"><%= id %></a> (<%= obj.class %>)
32
+ </li>
33
+ <% end %>
34
+ </ul>
35
+
36
+ <ul>
37
+ <li><a href="javascript:Tap.Utils.select_all_by_name('ids[]')">All</a></li>
38
+ <li><a href="javascript:Tap.Utils.deselect_all_by_name('ids[]')">None</a></li>
39
+ </ul>
40
+
41
+ <h3>Action</h3>
42
+ <ul>
43
+ <li><input type="radio" name="_method" value="destroy_all">Delete</input></li>
44
+ </ul>
45
+
46
+ <input type="submit" value="Submit" />
47
+ </form>
@@ -2,7 +2,7 @@
2
2
  <input type="hidden" name="_method" value="upload" />
3
3
  <ul>
4
4
  <li><input type="file" name="<%= type %>" /></li>
5
- <li><input type="text" name="id" value="" /> Id (if other than file name)</li>
5
+ <li><input type="text" name="id" value="" /> Name (if other than file name)</li>
6
6
  </ul>
7
7
  <input type="submit" value="Upload" />
8
8
  </form>
@@ -1,14 +1,25 @@
1
1
  <h1><%= type %></h1>
2
+
2
3
  <%= render('_upload.erb') %>
3
- <form id="select_<%= type %>" class="select" method="post" action="<%= uri %>">
4
- <input type="hidden" name="_method" value="select" />
5
-
4
+
5
+ <form method="post" action="<%= uri %>">
6
6
  <ul>
7
7
  <% data.index(type).each do |id| %>
8
- <li><input type="checkbox" name="id[]" value="<%= id %>" /> <%= render('_index_entry.erb', :locals => {:id => id})%></li>
8
+ <li><input type="checkbox" name="id[]" value="<%= id %>" /><%= data.cache[type].include?(id) ? "*" : "" %><a href="<%= uri(id) %>"><%= id %></a></li>
9
9
  <% end %>
10
10
  <li><a href="<%= uri('new') %>">new</a></li>
11
11
  </ul>
12
12
 
13
- <input type="submit" value="Select" />
13
+ <ul>
14
+ <li><a href="javascript:Tap.Utils.select_all_by_name('id[]')">All</a></li>
15
+ <li><a href="javascript:Tap.Utils.deselect_all_by_name('id[]')">None</a></li>
16
+ </ul>
17
+
18
+ <ul>
19
+ <li><input type="radio" name="_method" value="select" checked="true">Select</input></li>
20
+ <li><input type="radio" name="_method" value="deselect">Deselect</input></li>
21
+ <li><input type="radio" name="_method" value="destroy_all">Delete</input></li>
22
+ </ul>
23
+
24
+ <input type="submit" value="Submit" />
14
25
  </form>
@@ -3,40 +3,17 @@
3
3
  </div>
4
4
 
5
5
  <div id="content_main">
6
- <ol id="envs" class="manifest">
7
- <% env_keys = server.env.minihash(true) %>
8
- <% server.env.each do |env| %>
9
- <% root = env.root %>
10
- <% env_key = env_keys[env] %>
11
- <% controllers = env.manifest(:controller) %>
12
- <% tasks = env.manifest(:task) %>
13
- <% next if controllers.empty? && tasks.empty? %>
6
+ <ol id="envs" class="manifest"><% manifests.each do |(env_key, types)| %>
7
+ <li>
8
+ <h2><%= env_key %></h2>
9
+ <ul><% types.each do |(type, minimap)| %>
14
10
  <li>
15
- <h2><%= env_key %></h2>
16
- <ul>
17
- <% unless controllers.empty? %>
18
- <li>
19
- <h3>controllers</h3>
20
- <ul>
21
- <% controllers.minimap.each do |(key, const)| %>
22
- <li><a href="<%= escape(key) %>"><%= key %></a> (<a href="<%= help_uri('controller', key) %>">?</a>)</li>
23
- <% end %>
24
- </ul>
25
- </li>
26
- <% end %>
27
-
28
- <% unless tasks.empty? %>
29
- <li>
30
- <h3>tasks</h3>
31
- <ul>
32
- <% tasks.minimap.each do |(key, const)| %>
33
- <li><%= key %> (<a href="<%= help_uri('task', key) %>">?</a>)</li>
34
- <% end %>
35
- </ul>
36
- </li>
37
- <% end %>
11
+ <h3><%= type %></h3>
12
+ <ul><% minimap.each do |key, entry| %>
13
+ <li><%= key %> (<a href="help/<%= key %>">?</a>)</li><% end %>
38
14
  </ul>
39
- </li>
40
- <% end %>
15
+ </li><% end %>
16
+ </ul>
17
+ </li><% end %>
41
18
  </ol>
42
19
  </div>
@@ -0,0 +1 @@
1
+ "Got"
@@ -0,0 +1,4 @@
1
+ <h2><%= sig %> (<%= obj.class %>)</h2>
2
+ <form action="<%= uri(var, sig) %>" method="post">
3
+ Arguments: <input type="text" name="args"></input> <input type="submit" value="Send" />
4
+ </form>
@@ -0,0 +1 @@
1
+ "Post"
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.5.0
4
+ version: 0.6.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-06-17 00:00:00 -06:00
12
+ date: 2009-12-05 00:00:00 -07: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.18.0
23
+ version: 0.19.0
24
24
  version:
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rack
@@ -50,52 +50,44 @@ files:
50
50
  - lib/tap/controller/utils.rb
51
51
  - lib/tap/controllers/app.rb
52
52
  - lib/tap/controllers/data.rb
53
- - lib/tap/controllers/schema.rb
54
53
  - lib/tap/controllers/server.rb
55
- - lib/tap/server/runner.rb
54
+ - lib/tap/generator/generators/controller.rb
56
55
  - lib/tap/server.rb
57
56
  - lib/tap/server/data.rb
58
57
  - lib/tap/server/server_error.rb
59
58
  - lib/tap/tasks/echo.rb
60
59
  - lib/tap/tasks/render.rb
61
- - public/javascripts/prototype.js
62
- - public/javascripts/tap.js
63
60
  - public/stylesheets/tap.css
64
61
  - tap.yml
62
+ - templates/tap/generator/generators/controller/resource.erb
63
+ - templates/tap/generator/generators/controller/test.erb
64
+ - templates/tap/generator/generators/controller/view.erb
65
65
  - views/404.erb
66
66
  - views/500.erb
67
- - views/configurable/_configs.erb
68
- - views/configurable/_flag.erb
69
- - views/configurable/_list_select.erb
70
- - views/configurable/_select.erb
71
- - views/configurable/_switch.erb
67
+ - views/configurable/configurations.erb
68
+ - views/configurable/default.erb
72
69
  - views/layout.erb
73
70
  - views/object/obj.erb
71
+ - views/tap/app/api/help.erb
74
72
  - views/tap/controller/help.erb
75
- - views/tap/controllers/app/_action.erb
76
- - views/tap/controllers/app/build.erb
77
- - views/tap/controllers/app/enque.erb
78
- - views/tap/controllers/app/info.erb
79
- - views/tap/controllers/app/tail.erb
73
+ - views/tap/controllers/app/index.erb
80
74
  - views/tap/controllers/data/_controls.erb
81
- - views/tap/controllers/data/_index_entry.erb
82
75
  - views/tap/controllers/data/_upload.erb
83
76
  - views/tap/controllers/data/entry.erb
84
77
  - views/tap/controllers/data/index.erb
85
- - views/tap/controllers/schema/_build.erb
86
- - views/tap/controllers/schema/_index_entry.erb
87
- - views/tap/controllers/schema/entry.erb
88
78
  - views/tap/controllers/server/access.erb
89
79
  - views/tap/controllers/server/admin.erb
90
80
  - views/tap/controllers/server/index.erb
91
- - views/tap/task/help.erb
92
- - views/tap/task/input.erb
93
- - views/tap/tasks/load/input.erb
81
+ - views/tap/signals/signal/get.erb
82
+ - views/tap/signals/signal/index.erb
83
+ - views/tap/signals/signal/post.erb
94
84
  - README
95
85
  - MIT-LICENSE
96
86
  - History
97
87
  has_rdoc: true
98
88
  homepage: http://tap.rubyforge.org
89
+ licenses: []
90
+
99
91
  post_install_message:
100
92
  rdoc_options:
101
93
  - --main
@@ -121,9 +113,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
121
113
  requirements: []
122
114
 
123
115
  rubyforge_project: tap
124
- rubygems_version: 1.3.1
116
+ rubygems_version: 1.3.5
125
117
  signing_key:
126
- specification_version: 2
118
+ specification_version: 3
127
119
  summary: A web interface for tap.
128
120
  test_files: []
129
121
 
@@ -1,202 +0,0 @@
1
- require 'tap/controllers/data'
2
-
3
- module Tap
4
- module Controllers
5
- class Schema < Data
6
-
7
- # Adds to the specified schema. Parameters:
8
- #
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
19
- #
20
- def add(id)
21
- if id == "new"
22
- id = data.next_id(type).to_s
23
- end
24
-
25
- update_schema(id) do |schema|
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}
32
- end
33
- end
34
-
35
- # inputs[] outputs[] join
36
- inputs = request['inputs'] || []
37
- outputs = request['outputs'] || []
38
- if !inputs.empty? && !outputs.empty?
39
- schema.joins << [inputs, outputs, {'id' => request['join'] || 'join'}]
40
- end
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
54
- end
55
- end
56
-
57
- redirect uri(id)
58
- end
59
-
60
- # Removes tasks or joins from a schema. Parameters:
61
- #
62
- # tasks[]:: An array of task keys to remove.
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.
66
- #
67
- def remove(id)
68
- if id == "new"
69
- id = data.next_id(type).to_s
70
- end
71
-
72
- tasks = request['tasks'] || []
73
- joins = request['joins'] || []
74
- queue = request['queue'] || []
75
- middleware = request['middleware'] || []
76
-
77
- update_schema(id) do |schema|
78
- tasks.each {|key| schema.tasks.delete(key) }
79
-
80
- joins.each {|index| schema.joins[index.to_i] = nil }
81
- schema.joins.compact!
82
-
83
- queue.each {|index| schema.queue[index.to_i] = nil }
84
- schema.queue.compact!
85
-
86
- middleware.each {|index| schema.middleware[index.to_i] = nil }
87
- schema.middleware.compact!
88
-
89
- schema.cleanup!
90
- end
91
-
92
- redirect uri(id)
93
- end
94
-
95
- def save(id)
96
- if id == "new"
97
- id = data.next_id(type).to_s
98
- end
99
-
100
- data.create_or_update(type, id) do |io|
101
- io << yamlize(request['schema'] || '')
102
- end
103
-
104
- redirect uri(id)
105
- end
106
-
107
- # Helper methods
108
- protected
109
-
110
- def env
111
- server.env
112
- end
113
-
114
- def type
115
- :schema
116
- end
117
-
118
- def display(id)
119
- schema = if path = data.find(type, id)
120
- Tap::Schema.load_file(path)
121
- else
122
- Tap::Schema.new
123
- end
124
-
125
- schema.resolve! do |type, key|
126
- env[type][key]
127
- end
128
-
129
- render "entry.erb", :locals => {
130
- :id => id,
131
- :schema => schema
132
- }, :layout => true
133
- end
134
-
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
- }
149
- end
150
-
151
- def default_config(configs)
152
- Configurable::DelegateHash.new(configs).to_hash
153
- end
154
-
155
- def format_yaml(object)
156
- object == nil ? "~" : YAML.dump(object)[4...-1].strip
157
- end
158
-
159
- def update_schema(id)
160
- path = data.find(type, id) || data.create(type, id)
161
- schema = Tap::Schema.load_file(path)
162
-
163
- yield(schema)
164
-
165
- data.update(type, id) do |io|
166
- io << schema.dump
167
- end
168
-
169
- id
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
200
- end
201
- end
202
- end