rbbt-util 5.8.4 → 5.8.6

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: 4c797873ae505de56e3946d6effdb0cabd417c6a
4
- data.tar.gz: f191e7f6bd071f97dd3147d0b7c5b672a708c69d
3
+ metadata.gz: aea518df37bf55a5cb14bb009dc3c3125807563d
4
+ data.tar.gz: 3d532e26ea01b630418ab2e004c3d6a516c97643
5
5
  SHA512:
6
- metadata.gz: da7d7f21f11c5564514be72b81734958f0a46b742f40a50252f62442dd4089a96c41da2b0d714c8d135d3851699d519c1f4b95fd3a2830dd89d452453cc4ca2e
7
- data.tar.gz: e38d5a7d439fda5310a8db460337414e808762a5996fbc7f6413da71c7506b57d91f5b4d6fab28d2f774652614848a20d4016a8476f58f72d5e91e648d66d90b
6
+ metadata.gz: 1959de32e8e47f670369dfc897986b4c0dd47f2be68239e23c9d09e35beb71cf68cf578ffd9bc47c3ad1f81f040097a1d333108c6ad32404cc045df8128cfca7
7
+ data.tar.gz: faedb2e24d5dc400f57802a1fb2c377f421d1b8e42c820bc8e117e5e7d361787ac0e5a5948f086ac1654ff42c55e782d4d766c2779cd1e50a7105850f4000505
data/lib/rbbt/util/log.rb CHANGED
@@ -27,6 +27,10 @@ module Log
27
27
  SEVERITY_COLOR = [reset, cyan, green, magenta, blue, yellow, red] #.collect{|e| "\033[#{e}"}
28
28
  HIGHLIGHT = "\033[1m"
29
29
 
30
+ def self.uncolor(str)
31
+ Term::ANSIColor.uncolor(str)
32
+ end
33
+
30
34
  def self.color(severity, str = nil)
31
35
  return str || "" if nocolor
32
36
  color = SEVERITY_COLOR[severity] if Fixnum === severity
@@ -31,6 +31,48 @@ end
31
31
  Lockfile.refresh = false if ENV["RBBT_NO_LOCKFILE_REFRESH"] == "true"
32
32
  module Misc
33
33
 
34
+ def self.format_paragraph(text, size = 80, indent = 0, offset = 0)
35
+ words = text.gsub(/\s+/, "\s").split(" ")
36
+ lines = []
37
+ line = " "*offset
38
+ word = words.shift
39
+ while word
40
+ while word and line.length + word.length < size
41
+ line << word << " "
42
+ word = words.shift
43
+ end
44
+ lines << ((" " * indent) << line[0..-2])
45
+ line = ""
46
+ end
47
+ (lines * "\n")
48
+ end
49
+
50
+ def self.format_definition_list_item(dt, dd, size = 80, indent = 20, color = :yellow)
51
+ dt = dt.to_s + ":" unless dd.empty?
52
+ dt = Log.color color, dt if color
53
+ len = Log.uncolor(dt).length
54
+
55
+ if indent < 0
56
+ text = format_paragraph(dd, size, indent.abs+1, 0)
57
+ text = dt << "\n" << text
58
+ else
59
+ offset = len - indent
60
+ offset = 0 if offset < 0
61
+ text = format_paragraph(dd, size, indent.abs+1, offset)
62
+ text[0..len-1] = dt
63
+ end
64
+ text
65
+ end
66
+
67
+ def self.format_definition_list(defs, size = 80, indent = 20, color = :yellow)
68
+ entries = []
69
+ defs.each do |dt,dd|
70
+ text = format_definition_list_item(dt,dd,size,indent, color)
71
+ entries << text
72
+ end
73
+ entries * "\n\n"
74
+ end
75
+
34
76
  def self.read_stream(stream, size)
35
77
  str = nil
36
78
  while not str = stream.read(size)
@@ -26,20 +26,22 @@ module SOPT
26
26
  end
27
27
 
28
28
  def self.input_format(name, type = nil, default = nil, short = nil)
29
- input_str = (short.nil? or short.empty?) ? Log.color(:blue,"--#{name}") : Log.color(:blue, "-#{short}") << ", " << Log.color(:blue, "--#{name}")
29
+ input_str = (short.nil? or short.empty?) ? "--#{name}" : "-#{short},--#{name}"
30
30
  input_str = Log.color(:blue, input_str)
31
- input_str << case type
31
+ extra = case type
32
32
  when nil
33
- "#{default != nil ? " (default '#{default}')" : ""}:"
33
+ ""
34
34
  when :boolean
35
- "[=false]#{default != nil ? " (default '#{default}')" : ""}:"
35
+ "[=false]"
36
36
  when :tsv, :text
37
- "=<filename.#{type}|->#{default != nil ? " (default '#{default}')" : ""}; Use '-' for STDIN:"
37
+ "=<file|->"
38
38
  when :array
39
- "=<string[,string]*|filename.list|->#{default != nil ? " (default '#{default}')" : ""}; Use '-' for STDIN:"
39
+ "=<list|file|->"
40
40
  else
41
- "=<#{ type }>#{default != nil ? " (default '#{default}')" : ""}:"
41
+ "=<#{ type }>"
42
42
  end
43
+ extra << " (default '#{default}')" if default != nil
44
+ input_str << Log.color(:green, extra)
43
45
  end
44
46
 
45
47
  def self.input_doc(inputs, input_types = nil, input_descriptions = nil, input_defaults = nil, input_shortcuts = nil)
@@ -65,9 +67,9 @@ module SOPT
65
67
  type = :string if type.nil?
66
68
  register(shortcut, name, type, description) unless self.inputs.include? name
67
69
 
68
- str = " * " << SOPT.input_format(name, type.to_sym, default, shortcut)
69
- str << "\n " << description << "\n" if description and not description.empty?
70
- str
70
+ name = SOPT.input_format(name, type.to_sym, default, shortcut)
71
+ description
72
+ Misc.format_definition_list_item(name, description, 80, 31, nil)
71
73
  end * "\n"
72
74
  end
73
75
 
@@ -82,7 +84,7 @@ module SOPT
82
84
 
83
85
  #{ Log.color :magenta, "## DESCRIPTION"}
84
86
 
85
- #{description}
87
+ #{Misc.format_paragraph description}
86
88
 
87
89
  #{ Log.color :magenta, "## OPTIONS"}
88
90
 
data/lib/rbbt/workflow.rb CHANGED
@@ -2,6 +2,7 @@ require 'rbbt/workflow/definition'
2
2
  require 'rbbt/workflow/task'
3
3
  require 'rbbt/workflow/step'
4
4
  require 'rbbt/workflow/accessor'
5
+ require 'rbbt/workflow/doc'
5
6
 
6
7
  module Workflow
7
8
 
@@ -149,16 +150,6 @@ module Workflow
149
150
  @libdir
150
151
  end
151
152
 
152
- def workflow_description
153
- @workflow_description ||= begin
154
- file = @libdir['workflow.md']
155
- if file.exists?
156
- file.read
157
- else
158
- ""
159
- end
160
- end
161
- end
162
153
 
163
154
  def helpers
164
155
  @helpers ||= {}
@@ -0,0 +1,58 @@
1
+ module Workflow
2
+
3
+ def self.doc_parse_first_line(str)
4
+ if str.match(/^([^\n]*)\n\n(.*)/sm)
5
+ str.replace $2
6
+ $1
7
+ else
8
+ ""
9
+ end
10
+ end
11
+
12
+ def self.doc_parse_up_to(str, pattern, keep = false)
13
+ pre, _pat, _post = str.partition pattern
14
+ if _pat
15
+ [pre, (keep ? _pat << _post : _post)]
16
+ else
17
+ _post
18
+ end
19
+ end
20
+
21
+ def self.doc_parse_chunks(str, pattern)
22
+ parts = str.split(pattern)
23
+ return {} if parts.length < 2
24
+ tasks = Hash[*parts[1..-1].collect{|v| v.strip}]
25
+ tasks.delete_if{|t,d| d.empty?}
26
+ tasks
27
+ end
28
+
29
+ def self.parse_workflow_doc(doc)
30
+ title = doc_parse_first_line doc
31
+ description, task_info = doc_parse_up_to doc, /^# Tasks/i
32
+ task_description, tasks = doc_parse_up_to task_info, /^##/, true
33
+ tasks = doc_parse_chunks tasks, /## (.*)/
34
+ {:title => title.strip, :description => description.strip, :task_description => task_description.strip, :tasks => tasks}
35
+ end
36
+
37
+ def documentation_markdown
38
+ file = @libdir['workflow.md'].find
39
+ if file.exists?
40
+ file.read
41
+ else
42
+ ""
43
+ end
44
+ end
45
+
46
+ def load_documentation
47
+ @documentation = Workflow.parse_workflow_doc documentation_markdown
48
+ @documentation[:tasks].each do |task, description|
49
+ tasks[task.to_sym].description = description
50
+ end
51
+ end
52
+
53
+ attr_accessor :documentation
54
+ def documentation
55
+ load_documentation if @documentation.nil?
56
+ @documentation
57
+ end
58
+ end
@@ -4,10 +4,26 @@ module Task
4
4
  def doc(deps = nil)
5
5
  puts Log.color :magenta, "## #{ name }:"
6
6
  puts "\n" << description << "\n" if description and not description.empty?
7
- puts "Returns: " << Log.color(:blue, result_type.to_s) << "\n"
7
+ puts
8
+
9
+ case
10
+ when (input_types.values & [:array]).any?
11
+ puts Log.color(:green, Misc.format_paragraph("Lists are specified as arguments using ',' or '|'. When specified as files the '\\n'
12
+ also works in addition to the others. You may use the '--array_separator' option
13
+ the change this default. Whenever a file is specified it may also accept STDIN using
14
+ the '-' character."))
15
+ puts
16
+
17
+ when (input_types.values & [:text, :tsv]).any?
18
+ puts Log.color(:green, Misc.format_paragraph("Whenever a file is specified it may also accept STDIN using the '-' character."))
19
+ puts
20
+ end
21
+
8
22
  puts SOPT.input_doc(inputs, input_types, input_descriptions, input_defaults, true)
9
23
  puts
10
24
 
25
+ puts "Returns: " << Log.color(:blue, result_type.to_s) << "\n"
26
+ puts
11
27
 
12
28
  if deps and deps.any?
13
29
  puts "From dependencies:"
@@ -28,17 +44,23 @@ module Workflow
28
44
  if task.nil?
29
45
  puts Log.color :magenta, self.to_s
30
46
  puts Log.color :magenta, "=" * self.to_s.length
31
- puts
32
- puts "\n" << workflow_description if workflow_description and not workflow_description.empty?
47
+ if self.documentation[:description] and not self.documentation[:description].empty?
48
+ puts
49
+ puts Misc.format_paragraph self.documentation[:description]
50
+ end
33
51
  puts
34
52
 
35
53
  puts Log.color :magenta, "## TASKS"
54
+ if self.documentation[:task_description] and not self.documentation[:task_description].empty?
55
+ puts
56
+ puts Misc.format_paragraph self.documentation[:task_description]
57
+ end
36
58
  puts
59
+
37
60
  tasks.each do |name,task|
38
- puts " * #{ Log.color :green, name.to_s }:"
39
- puts " " << task.description.split(/\n\s*\n/).first if task.description and not task.description.empty?
40
- puts
61
+ puts Misc.format_definition_list_item(name.to_s, task.description || "", 80, 30, :yellow)
41
62
  end
63
+
42
64
  else
43
65
 
44
66
  if Task === task
@@ -35,7 +35,6 @@ end
35
35
 
36
36
  def usage(workflow = nil, task = nil, exception=nil)
37
37
  puts SOPT.doc
38
- puts Log.color :magenta, "## WORKFLOW"
39
38
  puts
40
39
  if workflow.nil?
41
40
  puts "No workflow specified"
@@ -45,11 +44,13 @@ def usage(workflow = nil, task = nil, exception=nil)
45
44
  if task.nil?
46
45
  workflow.load_tasks if workflow.respond_to? :load_tasks
47
46
  workflow.doc
47
+ puts
48
+ puts "E.g. rbbt workflow task #{workflow.to_s} #{workflow.tasks.keys.first.to_s} -h"
48
49
  else
49
50
  puts Log.color :magenta, workflow.to_s
50
51
  puts Log.color :magenta, "=" * workflow.to_s.length
51
52
  puts
52
- puts workflow.workflow_description
53
+ puts workflow.documentation[:description]
53
54
  puts
54
55
  workflow.doc(task)
55
56
  end
@@ -6,12 +6,59 @@ require 'rbbt/entity'
6
6
 
7
7
  class TestMisc < Test::Unit::TestCase
8
8
 
9
- def test_parse_cmd_params
10
- ddd Misc.parse_cmd_params("workflow task Translation translate -f 'Associated Gene Name' -l -")
9
+ def _test_format_paragraph
10
+ p = <<-EOF
11
+
12
+ Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
13
+ incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis
14
+ nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
15
+ Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
16
+ fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt
17
+ in culpa qui officia deserunt mollit anim id est laborum.
18
+
19
+
20
+ EOF
21
+
22
+ puts Misc.format_paragraph p, 70, 10, 5
23
+ end
24
+
25
+ def test_format_dl
26
+ p1 = <<-EOF
27
+ Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
28
+ incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis
29
+ nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
30
+ Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
31
+ fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt
32
+ in culpa qui officia deserunt mollit anim id est laborum.
33
+ EOF
34
+
35
+ p2 = <<-EOF
36
+
37
+ Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium
38
+ doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore
39
+ veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim
40
+ ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia
41
+ consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque
42
+ porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur,
43
+ adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et
44
+ dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis
45
+ nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex
46
+ ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea
47
+ voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem
48
+ eum fugiat quo voluptas nulla pariatur?"
49
+
50
+ EOF
51
+
52
+ puts Misc.format_definition_list({:paragraph_first => p1, :paragraph_second => p2})
53
+ end
54
+
55
+ def _test_parse_cmd_params
56
+ assert_equal ["workflow", "task", "Translation", "translate", "-f", "Associated Gene Name", "-l", "-"],
57
+ Misc.parse_cmd_params("workflow task Translation translate -f 'Associated Gene Name' -l -")
11
58
  end
12
59
 
13
60
 
14
- def test_fixutf8
61
+ def _test_fixutf8
15
62
  string = "abc\xffdef"
16
63
  string = string.force_encoding("UTF-8") if string.respond_to? :force_encoding
17
64
  assert(! string.valid_encoding?) if string.respond_to? :valid_encoding?
@@ -20,37 +67,37 @@ class TestMisc < Test::Unit::TestCase
20
67
  assert( Misc.fixutf8(string).valid_encoding) if string.respond_to? :valid_encoding
21
68
  end
22
69
 
23
- def test_colors_for
70
+ def _test_colors_for
24
71
  colors, used = Misc.colors_for([1,2,2,1,2,1,2,2,3,3,2,3,2])
25
72
  assert_equal Misc::COLOR_LIST[1], used[2]
26
73
  end
27
74
 
28
- def test_total_length
75
+ def _test_total_length
29
76
  ranges = [(0..100), (50..150), (120..160)]
30
77
  ranges = [(0..100), (50..150), (120..160), (51..70)]
31
78
  assert_equal 161, Misc.total_length(ranges)
32
79
  end
33
80
 
34
- def test_id_filename?
81
+ def _test_id_filename?
35
82
  TmpFile.with_file("") do |file|
36
83
  assert Misc.is_filename?(file)
37
84
  assert ! Misc.is_filename?("TEST STRING")
38
85
  end
39
86
  end
40
87
 
41
- def test_merge_sorted_arrays
88
+ def _test_merge_sorted_arrays
42
89
  assert_equal [1,2,3,4], Misc.merge_sorted_arrays([1,3], [2,4])
43
90
  end
44
91
 
45
- def test_intersect_sorted_arrays
92
+ def _test_intersect_sorted_arrays
46
93
  assert_equal [2,4], Misc.intersect_sorted_arrays([1,2,3,4], [2,4])
47
94
  end
48
95
 
49
- def test_sorted_array_matches
96
+ def _test_sorted_array_matches
50
97
  assert_equal [1,3], Misc.sorted_array_hits(%w(a b c d e), %w(b d))
51
98
  end
52
99
 
53
- def test_binary_include?
100
+ def _test_binary_include?
54
101
  a = %w(a b c d e).sort
55
102
  assert Misc.binary_include?(a, "a")
56
103
  assert(!Misc.binary_include?(a, "z"))
@@ -59,24 +106,24 @@ class TestMisc < Test::Unit::TestCase
59
106
  assert(Misc.binary_include?(a, "d"))
60
107
  end
61
108
 
62
- def test_process_to_hash
109
+ def _test_process_to_hash
63
110
  list = [1,2,3,4]
64
111
  assert_equal 4, Misc.process_to_hash(list){|l| l.collect{|e| e * 2}}[2]
65
112
  end
66
113
 
67
- # def test_pdf2text_example
114
+ # def _test_pdf2text_example
68
115
  # assert PDF2Text.pdf2text(datafile_test('example.pdf')).read =~ /An Example Paper/i
69
116
  # end
70
117
  #
71
- # def test_pdf2text_EPAR
118
+ # def _test_pdf2text_EPAR
72
119
  # assert PDF2Text.pdf2text("http://www.ema.europa.eu/docs/en_GB/document_library/EPAR_-_Scientific_Discussion/human/000402/WC500033103.pdf").read =~ /Tamiflu/i
73
120
  # end
74
121
  #
75
- # def test_pdf2text_wrong
122
+ # def _test_pdf2text_wrong
76
123
  # assert_raise CMD::CMDError do PDF2Text.pdf2text("http://www.ema.europa.eu/docs/en_GB#").read end
77
124
  # end
78
125
 
79
- def test_string2hash
126
+ def _test_string2hash
80
127
  assert(Misc.string2hash("--user-agent=firefox").include? "--user-agent")
81
128
  assert_equal(true, Misc.string2hash(":true")[:true])
82
129
  assert_equal(true, Misc.string2hash("true")["true"])
@@ -87,12 +134,12 @@ class TestMisc < Test::Unit::TestCase
87
134
  assert_equal(:j, Misc.string2hash("a=b#c=d#:h=:j")[:h])
88
135
  end
89
136
 
90
- def test_named_array
137
+ def _test_named_array
91
138
  a = NamedArray.setup([1,2,3,4], %w(a b c d))
92
139
  assert_equal(1, a['a'])
93
140
  end
94
141
 
95
- def test_path_relative_to
142
+ def _test_path_relative_to
96
143
  assert_equal "test/foo", Misc.path_relative_to('/test', '/test/test/foo')
97
144
 
98
145
  Misc.profile do
@@ -102,8 +149,8 @@ class TestMisc < Test::Unit::TestCase
102
149
  end
103
150
  end
104
151
 
105
- # def test_chunk
106
- # test =<<-EOF
152
+ # def _test_chunk
153
+ # _test =<<-EOF
107
154
  #This is an example file. Entries are separated by Entry
108
155
  #-- Entry
109
156
  #1
@@ -118,7 +165,7 @@ class TestMisc < Test::Unit::TestCase
118
165
  # assert_equal "1\n2\n3", Misc.chunk(test, /^-- Entry/).first.strip
119
166
  # end
120
167
 
121
- def test_hash2string
168
+ def _test_hash2string
122
169
  hash = {}
123
170
  assert_equal hash, Misc.string2hash(Misc.hash2string(hash))
124
171
 
@@ -136,14 +183,14 @@ class TestMisc < Test::Unit::TestCase
136
183
 
137
184
  end
138
185
 
139
- def test_merge
186
+ def _test_merge
140
187
  a = [[1],[2]]
141
188
  a = NamedArray.setup a, %w(1 2)
142
189
  a.merge [3,4]
143
190
  assert_equal [1,3], a[0]
144
191
  end
145
192
 
146
- def test_indiferent_hash
193
+ def _test_indiferent_hash
147
194
  a = {:a => 1, "b" => 2}
148
195
  a.extend IndiferentHash
149
196
 
@@ -153,7 +200,7 @@ class TestMisc < Test::Unit::TestCase
153
200
  assert_equal 2, a[:b]
154
201
  end
155
202
 
156
- def test_lockfile
203
+ def _test_lockfile
157
204
 
158
205
  TmpFile.with_file do |tmpfile|
159
206
  pids = []
@@ -177,7 +224,7 @@ class TestMisc < Test::Unit::TestCase
177
224
  end
178
225
  end
179
226
 
180
- def test_positions2hash
227
+ def _test_positions2hash
181
228
  inputs = Misc.positional2hash([:one, :two, :three], 1, :two => 2, :four => 4)
182
229
  assert_equal 1, inputs[:one]
183
230
  assert_equal 2, inputs[:two]
@@ -185,18 +232,18 @@ class TestMisc < Test::Unit::TestCase
185
232
  assert_equal nil, inputs[:four]
186
233
  end
187
234
 
188
- def test_mean
235
+ def _test_mean
189
236
  assert_equal 2, Misc.mean([1,2,3])
190
237
  assert_equal 3, Misc.mean([1,2,3,4,5])
191
238
  end
192
239
 
193
- def test_zip_fields
240
+ def _test_zip_fields
194
241
  current = [[:a,1], [:b,2]]
195
242
  assert_equal [[:a, :b],[1,2]], Misc.zip_fields(current)
196
243
  assert_equal current, Misc.zip_fields(Misc.zip_fields(current))
197
244
  end
198
245
 
199
- def test_add_zipped
246
+ def _test_add_zipped
200
247
  current = [[:a,1], [:b,2]]
201
248
  new = %w(A B)
202
249
  Misc.append_zipped current, new
@@ -207,20 +254,20 @@ class TestMisc < Test::Unit::TestCase
207
254
  assert_equal Math.sqrt(2), Misc.sd([1,3])
208
255
  end
209
256
 
210
- def test_divide
257
+ def _test_divide
211
258
  assert_equal 2, Misc.divide(%w(1 2 3 4 5 6 7 8 9),2).length
212
259
  end
213
260
 
214
- def test_ordered_divide
261
+ def _test_ordered_divide
215
262
  assert_equal 5, Misc.ordered_divide(%w(1 2 3 4 5 6 7 8 9),2).length
216
263
  end
217
264
 
218
- def test_collapse_ranges
265
+ def _test_collapse_ranges
219
266
  ranges = [(0..100), (50..150), (51..61),(200..250), (300..324),(320..350)]
220
267
  assert_equal [(0..150),(200..250), (300..350)], Misc.collapse_ranges(ranges)
221
268
  end
222
269
 
223
- def test_humanize
270
+ def _test_humanize
224
271
  str1 = "test_string"
225
272
  str2 = "TEST_string"
226
273
  str3 = "test"
@@ -232,22 +279,22 @@ class TestMisc < Test::Unit::TestCase
232
279
  assert_equal "mutation_enrichment", Misc.snake_case("MutationEnrichment")
233
280
  end
234
281
 
235
- def test_snake_case
282
+ def _test_snake_case
236
283
  str1 = "ACRONIMTest"
237
284
  str2 = "ACRONIM_test"
238
285
  assert_equal "ACRONIM_test", Misc.snake_case(str1)
239
286
  assert_equal "ACRONIM_test", Misc.snake_case(str2)
240
287
  end
241
288
 
242
- def test_correct_vcf_mutations
289
+ def _test_correct_vcf_mutations
243
290
  assert_equal [737407, ["-----", "-----G", "-----GTTAAT"]], Misc.correct_vcf_mutation(737406, "GTTAAT", "G,GG,GGTTAAT")
244
291
  end
245
292
 
246
- def test_fingerprint
293
+ def _test_fingerprint
247
294
  assert_equal '{a=>1}', Misc.fingerprint({:a => 1})
248
295
  end
249
296
 
250
- def test_tarize
297
+ def _test_tarize
251
298
  path = File.expand_path('/home/mvazquezg/git/rbbt-util/lib')
252
299
  stream = Misc.tarize(path)
253
300
  TmpFile.with_file do |res|
@@ -257,7 +304,7 @@ class TestMisc < Test::Unit::TestCase
257
304
  end
258
305
  end
259
306
 
260
- def test_camel_case
307
+ def _test_camel_case
261
308
  assert_equal "DbSNP", Misc.camel_case("db_SNP")
262
309
  assert_equal "D3Js", Misc.camel_case("D3Js")
263
310
  assert_equal "Structure", Misc.camel_case("Structure")
@@ -265,7 +312,7 @@ class TestMisc < Test::Unit::TestCase
265
312
  assert_equal "COSMIC", Misc.camel_case("COSMIC")
266
313
  end
267
314
 
268
- def test_pipe
315
+ def _test_pipe
269
316
  t = 5
270
317
  stream = Misc.open_pipe do |sin|
271
318
  t.times do |i|
@@ -0,0 +1,29 @@
1
+ require File.join(File.expand_path(File.dirname(__FILE__)), '../..', 'test_helper.rb')
2
+ require 'rbbt/workflow'
3
+
4
+ class TestWorkflowDoc < Test::Unit::TestCase
5
+ TEMPLATE=<<-EOF
6
+ Title of the template
7
+
8
+ Paragraph1
9
+
10
+ Paragraph2
11
+
12
+ # Tasks
13
+
14
+ Paragraph3
15
+
16
+ ## task1
17
+
18
+ Task 1
19
+
20
+ ## task2
21
+
22
+ Task 2
23
+
24
+ EOF
25
+ def test_parse
26
+ ddd Workflow.parse_workflow_doc(TEMPLATE)
27
+ end
28
+ end
29
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbbt-util
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.8.4
4
+ version: 5.8.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Vazquez
@@ -188,6 +188,7 @@ files:
188
188
  - lib/rbbt/workflow/accessor.rb
189
189
  - lib/rbbt/workflow/annotate.rb
190
190
  - lib/rbbt/workflow/definition.rb
191
+ - lib/rbbt/workflow/doc.rb
191
192
  - lib/rbbt/workflow/soap.rb
192
193
  - lib/rbbt/workflow/step.rb
193
194
  - lib/rbbt/workflow/task.rb
@@ -289,6 +290,7 @@ files:
289
290
  - test/rbbt/util/test_simpleDSL.rb
290
291
  - test/rbbt/util/test_simpleopt.rb
291
292
  - test/rbbt/util/test_tmpfile.rb
293
+ - test/rbbt/workflow/test_doc.rb
292
294
  - test/rbbt/workflow/test_step.rb
293
295
  - test/rbbt/workflow/test_task.rb
294
296
  - test/test_helper.rb
@@ -349,6 +351,7 @@ test_files:
349
351
  - test/rbbt/test_tsv.rb
350
352
  - test/rbbt/workflow/test_task.rb
351
353
  - test/rbbt/workflow/test_step.rb
354
+ - test/rbbt/workflow/test_doc.rb
352
355
  - test/rbbt/test_persist.rb
353
356
  - test/rbbt/test_annotations.rb
354
357
  - test/rbbt/persist/test_tsv.rb