rbbt-rest 1.3.1 → 1.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2e55cf49281298b1246307255c0a12b1d21ed9c7
4
- data.tar.gz: f1c82dbd4fbcfa7aa7319a062572d7e2668a372e
3
+ metadata.gz: 7c3bfc548ebb34eaabf50cfcf9393b93f5eb889a
4
+ data.tar.gz: 7dad0127b8830e498db504f0ab74fc5ad0478fbc
5
5
  SHA512:
6
- metadata.gz: 6a115419189c4329aa8a21583470a30aabf4b6df83496ba0c4458b4c82abd69c52735d960dd593e8daf8ff4edb50aa3bd98104c5543e4e8f4e659301d6e30e7a
7
- data.tar.gz: df4116e66c81deda238babf66b90a660b66dd20cd09a61b80a00ad2714a62204fa69752c12e4418e1cdd68569dafe9142af9248487ffdc40ac3b4a63ed98411a
6
+ metadata.gz: 8aaa4bf85659e3b623e241298b2df6b33e7a669ebaea57e0956d8b22bb4c04359f75a96b57906b9f6b37b40fb09885f716f0357fa619d3f46b1756ee3e77a604
7
+ data.tar.gz: ad5cca4ee8c9f51f84102ed95bd0cc64d4dbcebcd9ee4d698419ad74ed93ee2fdb7327e9309cfeb126ce43afc04f00fc53018a23f6d5820700fd0904fe2044ec
@@ -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
@@ -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 == :json
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)
@@ -93,3 +93,4 @@
93
93
  select.format
94
94
  float: right
95
95
  width: auto
96
+
@@ -25,3 +25,8 @@ dd.job_control
25
25
  li a
26
26
 
27
27
 
28
+ .workflow.tasks
29
+ font-size: 1.2em
30
+ p
31
+ max-width: 60em
32
+
@@ -1,20 +1,28 @@
1
- %h3= workflow.to_s
1
+ .workflow.tasks
2
+ %h3= workflow.to_s
2
3
 
3
- - unless workflow.workflow_description.empty?
4
- :markdown
5
- #{workflow.workflow_description}
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
- %ul.tasks.clean_list
11
- - tasks = workflow.exec_exports + workflow.synchronous_exports + workflow.asynchronous_exports
14
+ - unless workflow.documentation[:task_description].empty?
15
+ :markdown
16
+ #{workflow.documentation[:task_description]}
12
17
 
13
- - tasks.sort.each do |task|
14
- %li
15
- //%a(href="#{to(File.join("/", workflow.to_s, task.to_s))}")= task
16
- %a(href="#{File.join("/", workflow.to_s, task.to_s)}")= task
17
- - info = workflow.task_info(task)
18
- - if info[:description]
19
- %p= info[:description].split(/\n\s*\n/).first
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.1
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-02-25 00:00:00.000000000 Z
11
+ date: 2014-03-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake