rbbt-rest 1.3.1 → 1.3.2
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.
- checksums.yaml +4 -4
- data/lib/rbbt/rest/client.rb +40 -0
- data/lib/rbbt/rest/workflow.rb +12 -1
- data/share/views/compass/rbbt/form.sass +1 -0
- data/share/views/compass/workflow.sass +5 -0
- data/share/views/tasks.haml +22 -14
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c3bfc548ebb34eaabf50cfcf9393b93f5eb889a
|
4
|
+
data.tar.gz: 7dad0127b8830e498db504f0ab74fc5ad0478fbc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8aaa4bf85659e3b623e241298b2df6b33e7a669ebaea57e0956d8b22bb4c04359f75a96b57906b9f6b37b40fb09885f716f0357fa619d3f46b1756ee3e77a604
|
7
|
+
data.tar.gz: ad5cca4ee8c9f51f84102ed95bd0cc64d4dbcebcd9ee4d698419ad74ed93ee2fdb7327e9309cfeb126ce43afc04f00fc53018a23f6d5820700fd0904fe2044ec
|
data/lib/rbbt/rest/client.rb
CHANGED
@@ -189,6 +189,10 @@ class WorkflowRESTClient
|
|
189
189
|
WorkflowRESTClient.get_raw(File.join(url, 'description'))
|
190
190
|
end
|
191
191
|
|
192
|
+
def documentation
|
193
|
+
@documention ||= IndiferentHash.setup(WorkflowRESTClient.get_json(File.join(url, "documentation"),{}))
|
194
|
+
end
|
195
|
+
|
192
196
|
def task_info(task)
|
193
197
|
@task_info ||= {}
|
194
198
|
@task_info[task]
|
@@ -327,4 +331,40 @@ class WorkflowRESTClient
|
|
327
331
|
task.doc(dependencies)
|
328
332
|
end
|
329
333
|
end
|
334
|
+
|
335
|
+
def doc(task = nil)
|
336
|
+
|
337
|
+
if task.nil?
|
338
|
+
puts Log.color :magenta, self.to_s
|
339
|
+
puts Log.color :magenta, "=" * self.to_s.length
|
340
|
+
if self.documentation[:description] and not self.documentation[:description].empty?
|
341
|
+
puts
|
342
|
+
puts Misc.format_paragraph self.documentation[:description]
|
343
|
+
end
|
344
|
+
puts
|
345
|
+
|
346
|
+
puts Log.color :magenta, "## TASKS"
|
347
|
+
if self.documentation[:task_description] and not self.documentation[:task_description].empty?
|
348
|
+
puts
|
349
|
+
puts Misc.format_paragraph self.documentation[:task_description]
|
350
|
+
end
|
351
|
+
puts
|
352
|
+
|
353
|
+
tasks.each do |name,task|
|
354
|
+
puts Misc.format_definition_list_item(name.to_s, task.description || "", 80, 30, :yellow)
|
355
|
+
end
|
356
|
+
|
357
|
+
else
|
358
|
+
|
359
|
+
if Task === task
|
360
|
+
task_name = task.name
|
361
|
+
else
|
362
|
+
task_name = task
|
363
|
+
task = self.tasks[task_name]
|
364
|
+
end
|
365
|
+
dependencies = self.rec_dependencies(task_name).collect{|dep_name| self.tasks[dep_name.to_sym]}
|
366
|
+
|
367
|
+
task.doc(dependencies)
|
368
|
+
end
|
369
|
+
end
|
330
370
|
end
|
data/lib/rbbt/rest/workflow.rb
CHANGED
@@ -55,6 +55,17 @@ module Sinatra
|
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
58
|
+
get "/#{workflow.to_s}/documentation" do
|
59
|
+
case format
|
60
|
+
when :html
|
61
|
+
workflow_render('tasks', workflow)
|
62
|
+
when :json
|
63
|
+
content_type "application/json"
|
64
|
+
workflow.documentation.to_json
|
65
|
+
else
|
66
|
+
raise "Unsupported format specified: #{ format }"
|
67
|
+
end
|
68
|
+
end
|
58
69
|
get "/#{workflow.to_s}/:task/info" do
|
59
70
|
task = consume_parameter(:task)
|
60
71
|
|
@@ -94,7 +105,7 @@ module Sinatra
|
|
94
105
|
|
95
106
|
task_parameters = consume_task_parameters(workflow, task, params)
|
96
107
|
|
97
|
-
if complete_input_set(workflow, task, task_parameters) or format
|
108
|
+
if complete_input_set(workflow, task, task_parameters) or format != :html
|
98
109
|
issue_job(workflow, task, jobname, task_parameters)
|
99
110
|
else
|
100
111
|
workflow_render('form', workflow, task, task_parameters)
|
data/share/views/tasks.haml
CHANGED
@@ -1,20 +1,28 @@
|
|
1
|
-
|
1
|
+
.workflow.tasks
|
2
|
+
%h3= workflow.to_s
|
2
3
|
|
3
|
-
- unless workflow.
|
4
|
-
|
5
|
-
|
4
|
+
- unless workflow.documentation[:title].empty?
|
5
|
+
:markdown
|
6
|
+
#{workflow.documentation[:title]}
|
7
|
+
- unless workflow.documentation[:description].empty?
|
8
|
+
:markdown
|
9
|
+
#{workflow.documentation[:description]}
|
6
10
|
|
7
11
|
|
8
|
-
%h5 Tasks
|
12
|
+
%h5 Tasks
|
9
13
|
|
10
|
-
|
11
|
-
|
14
|
+
- unless workflow.documentation[:task_description].empty?
|
15
|
+
:markdown
|
16
|
+
#{workflow.documentation[:task_description]}
|
12
17
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
%
|
18
|
+
%ul.tasks.clean_list
|
19
|
+
- tasks = workflow.exec_exports + workflow.synchronous_exports + workflow.asynchronous_exports
|
20
|
+
|
21
|
+
- tasks.sort.each do |task|
|
22
|
+
%li
|
23
|
+
//%a(href="#{to(File.join("/", workflow.to_s, task.to_s))}")= task
|
24
|
+
%a(href="#{File.join("/", workflow.to_s, task.to_s)}")= task
|
25
|
+
- info = workflow.task_info(task)
|
26
|
+
- if info[:description]
|
27
|
+
%p= info[:description].split(/\n\s*\n/).first
|
20
28
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbbt-rest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miguel Vazquez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-03-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|