rbbt-util 5.43.0 → 5.44.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (121) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rbbt/association/util.rb +1 -1
  3. data/lib/rbbt/hpc/batch.rb +19 -17
  4. data/lib/rbbt/tsv/accessor.rb +6 -11
  5. data/lib/rbbt/tsv/dumper.rb +21 -10
  6. data/lib/rbbt/tsv/index.rb +2 -1
  7. data/lib/rbbt/util/misc/math.rb +0 -1
  8. data/lib/rbbt/util/open.rb +1 -1
  9. data/lib/rbbt/workflow/step/info.rb +1 -0
  10. data/lib/rbbt/workflow/step.rb +2 -1
  11. data/python/rbbt/__init__.py +2 -2
  12. data/share/rbbt_commands/workflow/task +1 -1
  13. metadata +4 -220
  14. data/test/rbbt/annotations/test_util.rb +0 -43
  15. data/test/rbbt/association/test_database.rb +0 -87
  16. data/test/rbbt/association/test_index.rb +0 -127
  17. data/test/rbbt/association/test_item.rb +0 -15
  18. data/test/rbbt/association/test_open.rb +0 -63
  19. data/test/rbbt/association/test_util.rb +0 -108
  20. data/test/rbbt/entity/test_identifiers.rb +0 -34
  21. data/test/rbbt/hpc/orchestrate/test_batches.rb +0 -70
  22. data/test/rbbt/hpc/orchestrate/test_chains.rb +0 -108
  23. data/test/rbbt/hpc/orchestrate/test_rules.rb +0 -59
  24. data/test/rbbt/hpc/test_batch.rb +0 -64
  25. data/test/rbbt/hpc/test_hpc_test_workflows.rb +0 -0
  26. data/test/rbbt/hpc/test_orchestrate.rb +0 -144
  27. data/test/rbbt/hpc/test_pbs.rb +0 -43
  28. data/test/rbbt/hpc/test_slurm.rb +0 -28
  29. data/test/rbbt/knowledge_base/test_enrichment.rb +0 -50
  30. data/test/rbbt/knowledge_base/test_entity.rb +0 -62
  31. data/test/rbbt/knowledge_base/test_query.rb +0 -46
  32. data/test/rbbt/knowledge_base/test_registry.rb +0 -74
  33. data/test/rbbt/knowledge_base/test_syndicate.rb +0 -48
  34. data/test/rbbt/knowledge_base/test_traverse.rb +0 -133
  35. data/test/rbbt/persist/test_tsv.rb +0 -88
  36. data/test/rbbt/persist/tsv/test_cdb.rb +0 -18
  37. data/test/rbbt/persist/tsv/test_kyotocabinet.rb +0 -27
  38. data/test/rbbt/persist/tsv/test_leveldb.rb +0 -18
  39. data/test/rbbt/persist/tsv/test_lmdb.rb +0 -20
  40. data/test/rbbt/persist/tsv/test_sharder.rb +0 -164
  41. data/test/rbbt/persist/tsv/test_tokyocabinet.rb +0 -262
  42. data/test/rbbt/resource/test_path.rb +0 -49
  43. data/test/rbbt/test_annotations.rb +0 -167
  44. data/test/rbbt/test_association.rb +0 -103
  45. data/test/rbbt/test_entity.rb +0 -252
  46. data/test/rbbt/test_fix_width_table.rb +0 -135
  47. data/test/rbbt/test_knowledge_base.rb +0 -226
  48. data/test/rbbt/test_monitor.rb +0 -11
  49. data/test/rbbt/test_packed_index.rb +0 -68
  50. data/test/rbbt/test_persist.rb +0 -85
  51. data/test/rbbt/test_resource.rb +0 -110
  52. data/test/rbbt/test_tsv.rb +0 -669
  53. data/test/rbbt/test_workflow.rb +0 -609
  54. data/test/rbbt/tsv/parallel/test_through.rb +0 -40
  55. data/test/rbbt/tsv/parallel/test_traverse.rb +0 -456
  56. data/test/rbbt/tsv/test_accessor.rb +0 -319
  57. data/test/rbbt/tsv/test_attach.rb +0 -715
  58. data/test/rbbt/tsv/test_change_id.rb +0 -61
  59. data/test/rbbt/tsv/test_csv.rb +0 -49
  60. data/test/rbbt/tsv/test_excel.rb +0 -171
  61. data/test/rbbt/tsv/test_field_index.rb +0 -19
  62. data/test/rbbt/tsv/test_filter.rb +0 -187
  63. data/test/rbbt/tsv/test_index.rb +0 -308
  64. data/test/rbbt/tsv/test_manipulate.rb +0 -334
  65. data/test/rbbt/tsv/test_marshal.rb +0 -24
  66. data/test/rbbt/tsv/test_matrix.rb +0 -20
  67. data/test/rbbt/tsv/test_parallel.rb +0 -7
  68. data/test/rbbt/tsv/test_parser.rb +0 -101
  69. data/test/rbbt/tsv/test_stream.rb +0 -253
  70. data/test/rbbt/tsv/test_util.rb +0 -52
  71. data/test/rbbt/util/R/test_eval.rb +0 -43
  72. data/test/rbbt/util/R/test_model.rb +0 -128
  73. data/test/rbbt/util/R/test_plot.rb +0 -38
  74. data/test/rbbt/util/concurrency/processes/test_socket.rb +0 -70
  75. data/test/rbbt/util/concurrency/test_processes.rb +0 -192
  76. data/test/rbbt/util/concurrency/test_threads.rb +0 -40
  77. data/test/rbbt/util/log/test_progress.rb +0 -111
  78. data/test/rbbt/util/misc/test_bgzf.rb +0 -48
  79. data/test/rbbt/util/misc/test_communication.rb +0 -13
  80. data/test/rbbt/util/misc/test_development.rb +0 -26
  81. data/test/rbbt/util/misc/test_format.rb +0 -10
  82. data/test/rbbt/util/misc/test_indiferent_hash.rb +0 -14
  83. data/test/rbbt/util/misc/test_lock.rb +0 -77
  84. data/test/rbbt/util/misc/test_multipart_payload.rb +0 -202
  85. data/test/rbbt/util/misc/test_omics.rb +0 -116
  86. data/test/rbbt/util/misc/test_pipes.rb +0 -343
  87. data/test/rbbt/util/misc/test_serialize.rb +0 -24
  88. data/test/rbbt/util/python/test_util.rb +0 -25
  89. data/test/rbbt/util/simpleopt/test_get.rb +0 -12
  90. data/test/rbbt/util/simpleopt/test_parse.rb +0 -10
  91. data/test/rbbt/util/simpleopt/test_setup.rb +0 -76
  92. data/test/rbbt/util/test_R.rb +0 -37
  93. data/test/rbbt/util/test_chain_methods.rb +0 -22
  94. data/test/rbbt/util/test_cmd.rb +0 -87
  95. data/test/rbbt/util/test_colorize.rb +0 -22
  96. data/test/rbbt/util/test_concurrency.rb +0 -6
  97. data/test/rbbt/util/test_config.rb +0 -69
  98. data/test/rbbt/util/test_excel2tsv.rb +0 -10
  99. data/test/rbbt/util/test_filecache.rb +0 -36
  100. data/test/rbbt/util/test_log.rb +0 -52
  101. data/test/rbbt/util/test_migrate.rb +0 -34
  102. data/test/rbbt/util/test_misc.rb +0 -728
  103. data/test/rbbt/util/test_open.rb +0 -200
  104. data/test/rbbt/util/test_procpath.rb +0 -23
  105. data/test/rbbt/util/test_python.rb +0 -144
  106. data/test/rbbt/util/test_semaphore.rb +0 -36
  107. data/test/rbbt/util/test_simpleDSL.rb +0 -55
  108. data/test/rbbt/util/test_simpleopt.rb +0 -11
  109. data/test/rbbt/util/test_ssh.rb +0 -10
  110. data/test/rbbt/util/test_tmpfile.rb +0 -32
  111. data/test/rbbt/workflow/step/test_dependencies.rb +0 -295
  112. data/test/rbbt/workflow/step/test_save_load_inputs.rb +0 -136
  113. data/test/rbbt/workflow/test_doc.rb +0 -30
  114. data/test/rbbt/workflow/test_remote_workflow.rb +0 -99
  115. data/test/rbbt/workflow/test_schedule.rb +0 -0
  116. data/test/rbbt/workflow/test_step.rb +0 -231
  117. data/test/rbbt/workflow/test_task.rb +0 -85
  118. data/test/rbbt/workflow/util/test_archive.rb +0 -27
  119. data/test/rbbt/workflow/util/test_data.rb +0 -67
  120. data/test/rbbt/workflow/util/test_orchestrator.rb +0 -263
  121. data/test/test_helper.rb +0 -114
@@ -1,12 +0,0 @@
1
- require File.join(File.expand_path(File.dirname(__FILE__)), '../../..', 'test_helper.rb')
2
- require 'rbbt/util/simpleopt/parse'
3
- require 'rbbt/util/simpleopt/get'
4
-
5
- class TestSOPTParse < Test::Unit::TestCase
6
- def test_consume
7
- SOPT.parse("-f--first* first arg:-f--fun")
8
- args = "-f myfile --fun".split(" ")
9
- assert_equal "myfile", SOPT.consume(args)[:first]
10
- end
11
- end
12
-
@@ -1,10 +0,0 @@
1
- require File.join(File.expand_path(File.dirname(__FILE__)), '../../..', 'test_helper.rb')
2
- require 'rbbt/util/simpleopt/parse'
3
-
4
- class TestSOPTParse < Test::Unit::TestCase
5
- def test_parse
6
- SOPT.parse("-f--first* first arg:-f--fun")
7
- assert_equal "fun", SOPT.shortcuts["fu"]
8
- end
9
- end
10
-
@@ -1,76 +0,0 @@
1
- require File.join(File.expand_path(File.dirname(__FILE__)), '../../..', 'test_helper.rb')
2
- require 'rbbt/util/simpleopt/setup'
3
-
4
- class TestSOPTSetup < Test::Unit::TestCase
5
- def setup
6
- SOPT.inputs = nil
7
- SOPT.input_types = nil
8
- SOPT.input_descriptions = nil
9
- SOPT.input_shortcuts = nil
10
- end
11
-
12
- def test_setup
13
- SOPT.setup <<-EOF
14
- Test application
15
-
16
- $ test cmd -arg 1
17
-
18
- It does some imaginary stuff
19
-
20
- -a--arg* Argument
21
- -a2--arg2* Argument
22
-
23
- EOF
24
-
25
- assert_equal "test cmd -arg 1", SOPT.synopsys
26
- assert SOPT.inputs.include? "arg"
27
- assert SOPT.inputs.include? "arg2"
28
- end
29
-
30
- def test_setup_alt
31
- SOPT.setup <<-EOF
32
- Test application
33
-
34
- It does some imaginary stuff
35
-
36
- -a--arg* Argument
37
- -a2--arg2* Argument
38
-
39
- EOF
40
-
41
- assert SOPT.inputs.include? "arg"
42
- assert SOPT.inputs.include? "arg2"
43
- end
44
-
45
- def test_setup_alt2
46
- SOPT.setup <<-EOF
47
- Test application
48
-
49
- -a--arg* Argument
50
- -a2--arg2* Argument
51
-
52
- EOF
53
-
54
- assert SOPT.inputs.include? "arg"
55
- assert SOPT.inputs.include? "arg2"
56
- end
57
-
58
- def test_setup_alt3
59
- SOPT.setup <<-EOF
60
- Pulls the values from a tsv colum
61
-
62
- $ rbbt tsv values [options] <filename.tsv|->
63
-
64
- Use - to read from STDIN
65
-
66
- -tch--tokyocabinet File is a tokyocabinet hash database
67
- -tcb--tokyocabinet_bd File is a tokyocabinet B database
68
- -h--help Print this help
69
- EOF
70
-
71
- assert SOPT.inputs.include? "tokyocabinet"
72
- end
73
-
74
- end
75
-
76
-
@@ -1,37 +0,0 @@
1
- require File.join(File.expand_path(File.dirname(__FILE__)), '../..', 'test_helper.rb')
2
- require 'rbbt/util/R'
3
-
4
- class TestR < Test::Unit::TestCase
5
- def test_sum
6
- assert_equal "6", R.run('cat(3+3)').read.split(/\n/).last
7
- end
8
-
9
- def test_tsv_R
10
- tsv = TSV.setup({:a => 1, :b => 2})
11
- tsv2 = tsv.R <<-EOF
12
- str(data)
13
- data = data + 1
14
- EOF
15
- assert_equal "2", tsv2["a"].first
16
- end
17
-
18
- def test_format_tsv
19
- tsv = TSV.setup({"a" => [1], "b" => [2]}, :type => :list, :key_field => "Letter", :fields => ["Number"])
20
- assert tsv.transpose("Field").include? "Number"
21
- end
22
-
23
- def test_error
24
- assert_raise ProcessFailed do
25
- R.run <<-EOF
26
- fadsfasdf
27
- EOF
28
- end
29
- end
30
-
31
- def test_hash2Rargs
32
- hash = {:verbose => false, :iter => 1000, :method => 'kmeans'}
33
- str = R.hash2Rargs(hash)
34
- assert_equal "verbose=FALSE, iter=1000, method='kmeans'", str
35
- end
36
- end
37
-
@@ -1,22 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')
2
- require 'rbbt/util/chain_methods'
3
- require 'test/unit'
4
-
5
- module TestChainedModule
6
- extend ChainMethods
7
-
8
- def test_chain_get_brackets(value)
9
- self.test_chain_clean_get_brackets(value).reverse
10
- end
11
-
12
- self.chain_prefix = :test_chain
13
- end
14
-
15
- class TestChaimMethods < Test::Unit::TestCase
16
- def test_chained_reverse_get
17
- a = ["test", "TEST"]
18
- a.extend TestChainedModule
19
- assert_equal "test".reverse, a[0]
20
- assert_equal "TEST".reverse, a[1]
21
- end
22
- end
@@ -1,87 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')
2
- require 'rbbt/util/cmd'
3
- require 'test/unit'
4
-
5
- class TestCmd < Test::Unit::TestCase
6
-
7
- def test_cmd_option_string
8
- assert_equal("--user-agent 'firefox'", CMD.process_cmd_options("--user-agent" => "firefox"))
9
- assert_equal("--user-agent='firefox'", CMD.process_cmd_options("--user-agent=" => "firefox"))
10
- assert_equal("-q", CMD.process_cmd_options("-q" => true))
11
- assert_equal("", CMD.process_cmd_options("-q" => nil))
12
- assert_equal("", CMD.process_cmd_options("-q" => false))
13
-
14
- assert(CMD.process_cmd_options("--user-agent" => "firefox", "-q" => true) =~ /--user-agent 'firefox'/)
15
- assert(CMD.process_cmd_options("--user-agent" => "firefox", "-q" => true) =~ /-q/)
16
- end
17
-
18
- def test_cmd
19
- assert_equal("test\n", CMD.cmd("echo '{opt}' test").read)
20
- assert_equal("test", CMD.cmd("echo '{opt}' test", "-n" => true).read)
21
- assert_equal("test2\n", CMD.cmd("cut", "-f" => 2, "-d" => ' ', :in => "test1 test2").read)
22
- end
23
-
24
- def test_pipe
25
- assert_equal("test\n", CMD.cmd("echo test", :pipe => true).read)
26
- assert_equal("test\n", CMD.cmd("echo '{opt}' test", :pipe => true).read)
27
- assert_equal("test", CMD.cmd("echo '{opt}' test", "-n" => true, :pipe => true).read)
28
- assert_equal("test2\n", CMD.cmd("cut", "-f" => 2, "-d" => ' ', :in => "test1 test2", :pipe => true).read)
29
- end
30
-
31
- def test_error
32
- assert_raise ProcessFailed do CMD.cmd('fake-command') end
33
- assert_raise ProcessFailed do CMD.cmd('ls -fake_option') end
34
-
35
- assert_raise ProcessFailed do CMD.cmd('fake-command', :stderr => true) end
36
- assert_raise ProcessFailed do CMD.cmd('ls -fake_option', :stderr => true) end
37
-
38
- assert_nothing_raised ProcessFailed do CMD.cmd('fake-command', :no_fail => true, :pipe => true) end
39
- assert_nothing_raised ProcessFailed do CMD.cmd('ls -fake_option', :no_fail => true, :pipe => true) end
40
-
41
- assert_raise ProcessFailed do CMD.cmd('fake-command', :stderr => true, :pipe => true).join end
42
- assert_raise ConcurrentStreamProcessFailed do CMD.cmd('ls -fake_option', :stderr => true, :pipe => true).join end
43
- end
44
-
45
- def test_pipes
46
- text = <<-EOF
47
- line1
48
- line2
49
- line3
50
- line11
51
- line22
52
- line33
53
- EOF
54
-
55
- TmpFile.with_file(text * 100) do |file|
56
-
57
- Open.open(file) do |f|
58
- io = CMD.cmd('tail -n 10', :in => f, :pipe => true)
59
- io2 = CMD.cmd('head -n 10', :in => io, :pipe => true)
60
- io3 = CMD.cmd('head -n 10', :in => io2, :pipe => true)
61
- assert_equal 10, io3.read.split(/\n/).length
62
- end
63
- end
64
- end
65
-
66
- def test_STDIN_close
67
- TmpFile.with_file("Hello") do |file|
68
- STDIN.close
69
- Open.open(file) do |f|
70
- io = CMD.cmd("tr 'e' 'E'", :in => f, :pipe => true)
71
- txt = io.read
72
- io.join
73
- assert_equal "HEllo", txt
74
- end
75
- end
76
- end
77
-
78
- def test_bash
79
- puts CMD.bash("awk 'test'")
80
- end
81
-
82
- def test_cmd_error
83
- assert_raise ConcurrentStreamProcessFailed do
84
- CMD.cmd_log("ruby -e 'puts 1; STDERR.puts 1; sleep 2; raise'")
85
- end
86
- end
87
- end
@@ -1,22 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')
2
- require 'rbbt/util/colorize'
3
- require 'test/unit'
4
-
5
- class TestColorize < Test::Unit::TestCase
6
- def test_color_array
7
- a = (1..16).to_a
8
-
9
- assert_equal 16, Colorize.distinct(a).length
10
- assert_equal 16, Colorize.distinct(a).compact.uniq.length
11
- end
12
-
13
- def test_from_name
14
- assert Colorize.from_name('wheat') =~ /^#/
15
- assert Colorize.from_name('green') =~ /^#/
16
- end
17
-
18
- def test_color_continuous
19
- a = (1..16).to_a
20
- assert_equal Colorize.continuous(a).length, Colorize.continuous(a).uniq.length
21
- end
22
- end
@@ -1,6 +0,0 @@
1
- require File.join(File.expand_path(File.dirname(__FILE__)), '../..', 'test_helper.rb')
2
- require 'rbbt/util/concurrency'
3
-
4
- class TestConcurrency < Test::Unit::TestCase
5
- end
6
-
@@ -1,69 +0,0 @@
1
- require File.join(File.expand_path(File.dirname(__FILE__)), '../..', 'test_helper.rb')
2
- require 'rbbt/util/config'
3
-
4
- class TestConfig < Test::Unit::TestCase
5
- def setup
6
- Rbbt::Config.set({:cpus => 30}, :test_config, :test)
7
- Rbbt::Config.set(:cpus, 5, "slow::2", :test)
8
- Rbbt::Config.set({:token => "token"}, "token")
9
- Rbbt::Config.set(:notoken, "no_token")
10
- Rbbt::Config.set({:emptytoken => "empty"})
11
- end
12
-
13
- def test_simple
14
- assert_equal 30, Rbbt::Config.get(:cpus, :test_config)
15
- end
16
-
17
- def test_match
18
- assert_equal({20 => ["token"]}, Rbbt::Config.match({["key:token"] => "token"}, "key:token"))
19
- end
20
-
21
- def test_simple_no_token
22
- assert_equal "token", Rbbt::Config.get("token", "token")
23
- assert_equal "no_token", Rbbt::Config.get("notoken", "key:notoken")
24
- assert_equal 'token', Rbbt::Config.get("token", "key:token")
25
- assert_equal 'token', Rbbt::Config.get("token")
26
- assert_equal nil, Rbbt::Config.get("token", "someotherthing")
27
- assert_equal "default_token", Rbbt::Config.get("token", 'unknown', :default => 'default_token')
28
- assert_equal 'empty', Rbbt::Config.get("emptytoken", 'key:emptytoken')
29
- end
30
-
31
- def test_prio
32
- assert_equal 5, Rbbt::Config.get(:cpus, :slow, :test)
33
- end
34
-
35
- def test_with_config
36
- Rbbt::Config.add_entry 'key', 'valueA', 'token'
37
- assert_equal "valueA", Rbbt::Config.get('key', 'token')
38
- assert_equal "default", Rbbt::Config.get('key2', 'token', :default => 'default')
39
-
40
- Rbbt::Config.with_config do
41
- Rbbt::Config.add_entry 'key', 'valueB', 'token'
42
- Rbbt::Config.add_entry 'key2', 'valueB2', 'token'
43
- assert_equal "valueB", Rbbt::Config.get('key', 'token')
44
- assert_equal "valueB2", Rbbt::Config.get('key2', 'token', :default => 'default')
45
- end
46
-
47
- assert_equal "valueA", Rbbt::Config.get('key', 'token')
48
- assert_equal "default", Rbbt::Config.get('key2', 'token', :default => 'default')
49
- end
50
-
51
- def test_order
52
- Rbbt::Config.add_entry 'key', 'V1', 'token1'
53
- Rbbt::Config.add_entry 'key', 'V2', 'token2'
54
- Rbbt::Config.add_entry 'key', 'V3', 'token2'
55
-
56
- assert_equal "V3", Rbbt::Config.get('key', 'token2')
57
- assert_equal "V1", Rbbt::Config.get('key', 'token1')
58
- assert_equal "V3", Rbbt::Config.get('key', 'token2', 'token1')
59
- assert_equal "V1", Rbbt::Config.get('key', 'token1', 'token2')
60
- end
61
-
62
- def test_default
63
- Rbbt::Config.add_entry 'key', 'V1', 'token1'
64
- assert_equal "V3", Rbbt::Config.get('key', 'token2', :default => 'V3')
65
- end
66
-
67
-
68
- end
69
-
@@ -1,10 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')
2
- require 'rbbt/util/excel2tsv'
3
-
4
- class TestTSV < Test::Unit::TestCase
5
- def test_tsv2excel
6
- tsv = TSV.excel2tsv(datafile_test('Test.xls'), :header => true)
7
- assert_equal 'Id', tsv.key_field
8
- end
9
- end
10
-
@@ -1,36 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')
2
- require 'rbbt-util'
3
- require 'rbbt/util/filecache'
4
- require 'test/unit'
5
-
6
- class TestFileCache < Test::Unit::TestCase
7
-
8
- def test_path
9
- assert_equal(File.join(Rbbt.var.cache.filecache.find(:user),'3','2','1','123.ext'), FileCache.path('123.ext'))
10
- end
11
-
12
- def test_add_read
13
- filename = '123.ext'
14
- content = 'test'
15
-
16
- FileCache.add(filename, content)
17
- assert_equal(content, File.open(FileCache.path(filename)).read)
18
- assert_equal(content, FileCache.get(filename).read)
19
-
20
- FileCache.del(filename)
21
- end
22
-
23
- def test_add_io
24
- filename = '123.ext'
25
- content =<<-EOF
26
- test test test
27
- test test test
28
- EOF
29
-
30
- FileCache.add(filename, StringIO.new(content))
31
- assert_equal(content, File.open(FileCache.path(filename)).read)
32
-
33
- FileCache.del(filename)
34
- end
35
-
36
- end
@@ -1,52 +0,0 @@
1
- require File.join(File.expand_path(File.dirname(__FILE__)), '../..', 'test_helper.rb')
2
- require 'rbbt/util/log'
3
-
4
- class TestLog < Test::Unit::TestCase
5
- def test_get_level
6
- assert_equal 0, Log.get_level(:debug)
7
- assert_equal 1, Log.get_level(:low)
8
- assert_equal 1, Log.get_level("LOW")
9
- assert_equal 1, Log.get_level(1)
10
- assert_equal 0, Log.get_level(nil)
11
- end
12
-
13
- def test_color
14
- assert Log.color(:green, "green")
15
- end
16
-
17
- def test_no_stderr
18
- Log.ignore_stderr do
19
- STDERR.puts "NOPRINT"
20
- end
21
- end
22
-
23
- def test_trap_stderr
24
- Log.trap_stderr do
25
- STDERR.puts "NOPRINT"
26
- STDERR.puts "NOPRINT"
27
- STDERR.puts "NOPRINT"
28
- STDOUT.puts "PRINT STDOUT"
29
- STDOUT.puts "PRINT STDOUT"
30
- end
31
- Log.trap_stderr do
32
- STDERR.puts "NOPRINT"
33
- STDOUT.puts "PRINT STDOUT"
34
- end
35
- Log.trap_std do
36
- STDERR.puts "NOPRINT"
37
- STDOUT.puts "NOPRINT STDOUT"
38
- end
39
- end
40
-
41
- def test_trap_std
42
- Log.trap_std do
43
- STDERR.puts "NOPRINT STDERR"
44
- STDOUT.puts "NOPRINT STDOUT"
45
- end
46
- Log.trap_std "OUT", "ERR", 4, 2 do
47
- STDERR.puts "NOPRINT STDERR"
48
- STDOUT.puts "NOPRINT STDOUT"
49
- end
50
- end
51
- end
52
-
@@ -1,34 +0,0 @@
1
- require File.join(File.expand_path(File.dirname(__FILE__)), '../..', 'test_helper.rb')
2
- require 'rbbt-util'
3
- require 'rbbt/util/migrate'
4
-
5
- class TestMigrate < Test::Unit::TestCase
6
- def test_source_locate
7
- assert_equal 'var/jobs/', Rbbt.migrate_source_paths(Rbbt.root['var/jobs'].find(:user)).last
8
- assert_include Rbbt.migrate_source_paths(Rbbt.root['var/jobs'].find(:user))[1], (File.join(ENV["HOME"], '.rbbt/var/jobs'))
9
- end
10
-
11
- def test_migrate
12
- Open.rm_rf Rbbt.tmp.test.migration_test.find(:user)
13
- test_file = Rbbt.tmp.test.migration_test.migration_test_file.find(:user)
14
- Open.write(test_file, "TEST")
15
- TmpFile.with_file do |tmpdir|
16
- Misc.in_dir tmpdir do
17
- Rbbt.migrate('tmp/test/migration_test/migration_test_file', :current)
18
- end
19
- assert_equal "TEST", Open.read(File.join(tmpdir, 'tmp/test/migration_test/migration_test_file'))
20
- end
21
- end
22
-
23
- def __test_migrate_turbo
24
- Log.with_severity 0 do
25
- TmpFile.with_file do |tmpdir|
26
- Misc.in_dir tmpdir do
27
- Rbbt.migrate('etc/config', :current, :source => 'mn1')
28
- end
29
- assert_equal "TEST", Open.read(File.join(tmpdir, 'etc/config'))
30
- end
31
- end
32
- end
33
- end
34
-