rbbt-util 5.21.54 → 5.21.55
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rbbt/util/log.rb +9 -5
- data/lib/rbbt/util/misc/format.rb +4 -0
- data/lib/rbbt/workflow.rb +13 -0
- data/lib/rbbt/workflow/annotate.rb +7 -0
- data/lib/rbbt/workflow/definition.rb +1 -0
- data/lib/rbbt/workflow/task.rb +1 -1
- data/lib/rbbt/workflow/usage.rb +6 -0
- data/share/rbbt_commands/workflow/task +5 -1
- 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: d5af3a00bb7cefa94e0d6e2ee3fade766193c5c1
|
4
|
+
data.tar.gz: 5f9e807ae6ec9edad6891b07bc8f54d0ecea87e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8d14056a7f5ed61f56dab6d36803e78c5ef077656523fed4daf23bf574d4c6e93ed5e98570bd51c52f059563d93c1440dcaf9761fc871dc79bcda5f56eec2ea9
|
7
|
+
data.tar.gz: 76d58d3d25f4ba8f8793d2852dfc2b3c1c00c6369f2314b4ec193d3874669a17514662ec79ef883a7961528a7ee710fe5d70fa966c7db2244892a895e481a7a5
|
data/lib/rbbt/util/log.rb
CHANGED
@@ -33,10 +33,9 @@ module Log
|
|
33
33
|
line ||= caller.first
|
34
34
|
end
|
35
35
|
|
36
|
-
def self.
|
37
|
-
|
38
|
-
|
39
|
-
File.open('/dev/null', 'w') do |f|
|
36
|
+
def self._ignore_stderr
|
37
|
+
backup_stderr = STDERR.dup
|
38
|
+
File.open('/dev/null', 'w') do |f|
|
40
39
|
STDERR.reopen(f)
|
41
40
|
begin
|
42
41
|
yield
|
@@ -44,7 +43,12 @@ module Log
|
|
44
43
|
STDERR.reopen backup_stderr
|
45
44
|
backup_stderr.close
|
46
45
|
end
|
47
|
-
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def self.ignore_stderr(&block)
|
50
|
+
LOG_MUTEX.synchronize do
|
51
|
+
_ignore_stderr &block
|
48
52
|
end
|
49
53
|
end
|
50
54
|
|
data/lib/rbbt/workflow.rb
CHANGED
@@ -310,6 +310,19 @@ module Workflow
|
|
310
310
|
task_inputs = task_info(taskname)[:inputs]
|
311
311
|
defaults = IndiferentHash.setup(task.input_defaults)
|
312
312
|
|
313
|
+
missing_inputs = []
|
314
|
+
task.required_inputs.each do |input|
|
315
|
+
missing_inputs << input if inputs[input].nil?
|
316
|
+
end
|
317
|
+
|
318
|
+
if missing_inputs.length == 1
|
319
|
+
raise ParameterException, "Input #{missing_inputs.first} is required but was not provided or is nil"
|
320
|
+
end
|
321
|
+
|
322
|
+
if missing_inputs.length > 1
|
323
|
+
raise ParameterException, "Inputs #{Misc.humanize_list(missing_inputs)} are required but where not provided or are nil"
|
324
|
+
end
|
325
|
+
|
313
326
|
dependencies = real_dependencies(task, jobname, defaults.merge(inputs), task_dependencies[taskname] || [])
|
314
327
|
|
315
328
|
real_inputs = {}
|
@@ -24,6 +24,7 @@ module AnnotatedModule
|
|
24
24
|
add_consummable_annotation(self,
|
25
25
|
:description => "",
|
26
26
|
:inputs => [],
|
27
|
+
:required_inputs => [],
|
27
28
|
:input_types => {},
|
28
29
|
:input_descriptions => {},
|
29
30
|
:input_defaults => {},
|
@@ -38,11 +39,17 @@ module AnnotatedModule
|
|
38
39
|
@input_descriptions = {} if @input_descriptions.nil?
|
39
40
|
@input_defaults = {} if @input_defaults.nil?
|
40
41
|
@input_options = {} if @input_options.nil?
|
42
|
+
@required_inputs = [] if @required_inputs.nil?
|
43
|
+
|
44
|
+
required = Misc.process_options options, :required if options
|
45
|
+
required, default = true, nil if default == :required
|
46
|
+
@required_inputs << name if required
|
41
47
|
|
42
48
|
@inputs << name
|
43
49
|
@input_types[name] = type unless type.nil?
|
44
50
|
@input_descriptions[name] = desc unless desc.nil?
|
45
51
|
@input_defaults[name] = default unless default.nil?
|
46
52
|
@input_options[name] = options unless options.nil?
|
53
|
+
|
47
54
|
end
|
48
55
|
end
|
@@ -81,6 +81,7 @@ module Workflow
|
|
81
81
|
:result_description => consume_result_description,
|
82
82
|
:input_defaults => consume_input_defaults,
|
83
83
|
:input_descriptions => consume_input_descriptions,
|
84
|
+
:required_inputs => consume_required_inputs,
|
84
85
|
:extension => consume_extension,
|
85
86
|
:input_options => consume_input_options
|
86
87
|
}
|
data/lib/rbbt/workflow/task.rb
CHANGED
@@ -2,7 +2,7 @@ require 'rbbt/util/misc'
|
|
2
2
|
require 'rbbt/persist'
|
3
3
|
|
4
4
|
module Task
|
5
|
-
attr_accessor :inputs, :input_types, :result_type, :input_defaults, :input_descriptions, :input_options, :description, :name, :result_description, :extension
|
5
|
+
attr_accessor :inputs, :input_types, :result_type, :input_defaults, :input_descriptions, :input_options, :required_inputs, :description, :name, :result_description, :extension
|
6
6
|
|
7
7
|
def self.setup(options = {}, &block)
|
8
8
|
block.extend Task
|
data/lib/rbbt/workflow/usage.rb
CHANGED
@@ -60,6 +60,12 @@ module Workflow
|
|
60
60
|
if task.nil?
|
61
61
|
puts Log.color :magenta, self.to_s
|
62
62
|
puts Log.color :magenta, "=" * self.to_s.length
|
63
|
+
|
64
|
+
if self.documentation[:title] and not self.documentation[:title].empty?
|
65
|
+
puts
|
66
|
+
puts Misc.format_paragraph self.documentation[:title]
|
67
|
+
end
|
68
|
+
|
63
69
|
if self.documentation[:description] and not self.documentation[:description].empty?
|
64
70
|
puts
|
65
71
|
puts Misc.format_paragraph self.documentation[:description]
|
@@ -31,9 +31,13 @@ def usage(workflow = nil, task = nil, exception=nil)
|
|
31
31
|
else
|
32
32
|
puts Log.color :magenta, workflow.to_s
|
33
33
|
puts Log.color :magenta, "=" * workflow.to_s.length
|
34
|
+
if workflow.documentation[:title] and not workflow.documentation[:title].empty?
|
35
|
+
puts
|
36
|
+
puts Misc.format_paragraph workflow.documentation[:title]
|
37
|
+
end
|
34
38
|
if workflow.documentation[:description] and not workflow.documentation[:description].empty?
|
35
39
|
puts
|
36
|
-
puts workflow.documentation[:description]
|
40
|
+
puts Misc.format_paragraph workflow.documentation[:description]
|
37
41
|
end
|
38
42
|
puts
|
39
43
|
workflow.doc(task)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbbt-util
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.21.
|
4
|
+
version: 5.21.55
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miguel Vazquez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-11-
|
11
|
+
date: 2016-11-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|