scout-gear 10.4.0 → 10.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.vimproject +100 -656
- data/Rakefile +1 -0
- data/VERSION +1 -1
- data/bin/scout +1 -3
- data/lib/scout/association/fields.rb +170 -0
- data/lib/scout/association/index.rb +229 -0
- data/lib/scout/association/item.rb +227 -0
- data/lib/scout/association/util.rb +7 -0
- data/lib/scout/association.rb +100 -0
- data/lib/scout/entity/format.rb +62 -0
- data/lib/scout/entity/identifiers.rb +111 -0
- data/lib/scout/entity/object.rb +20 -0
- data/lib/scout/entity/property.rb +165 -0
- data/lib/scout/entity.rb +40 -0
- data/lib/scout/offsite/step.rb +2 -2
- data/lib/scout/{tsv/persist → persist/engine}/fix_width_table.rb +25 -33
- data/lib/scout/persist/engine/packed_index.rb +100 -0
- data/lib/scout/persist/engine/sharder.rb +219 -0
- data/lib/scout/{tsv/persist → persist/engine}/tkrzw.rb +0 -17
- data/lib/scout/{tsv/persist → persist/engine}/tokyocabinet.rb +55 -31
- data/lib/scout/persist/engine.rb +4 -0
- data/lib/scout/{tsv/persist/adapter.rb → persist/tsv/adapter/base.rb} +80 -51
- data/lib/scout/persist/tsv/adapter/fix_width_table.rb +106 -0
- data/lib/scout/persist/tsv/adapter/packed_index.rb +95 -0
- data/lib/scout/persist/tsv/adapter/sharder.rb +54 -0
- data/lib/scout/persist/tsv/adapter/tkrzw.rb +18 -0
- data/lib/scout/persist/tsv/adapter/tokyocabinet.rb +65 -0
- data/lib/scout/persist/tsv/adapter.rb +6 -0
- data/lib/scout/{tsv/persist → persist/tsv}/serialize.rb +5 -0
- data/lib/scout/persist/tsv.rb +107 -0
- data/lib/scout/tsv/annotation/repo.rb +83 -0
- data/lib/scout/tsv/annotation.rb +169 -0
- data/lib/scout/tsv/attach.rb +95 -19
- data/lib/scout/tsv/change_id/translate.rb +148 -0
- data/lib/scout/tsv/change_id.rb +3 -0
- data/lib/scout/tsv/csv.rb +85 -0
- data/lib/scout/tsv/dumper.rb +113 -25
- data/lib/scout/tsv/entity.rb +5 -0
- data/lib/scout/tsv/index.rb +88 -36
- data/lib/scout/tsv/open.rb +21 -8
- data/lib/scout/tsv/parser.rb +153 -90
- data/lib/scout/tsv/path.rb +7 -2
- data/lib/scout/tsv/stream.rb +48 -6
- data/lib/scout/tsv/transformer.rb +4 -3
- data/lib/scout/tsv/traverse.rb +26 -18
- data/lib/scout/tsv/util/process.rb +7 -0
- data/lib/scout/tsv/util/reorder.rb +25 -15
- data/lib/scout/tsv/util/select.rb +9 -1
- data/lib/scout/tsv/util/sort.rb +90 -2
- data/lib/scout/tsv/util/unzip.rb +56 -0
- data/lib/scout/tsv/util.rb +52 -5
- data/lib/scout/tsv.rb +45 -27
- data/lib/scout/work_queue/socket.rb +8 -0
- data/lib/scout/work_queue/worker.rb +22 -5
- data/lib/scout/work_queue.rb +38 -24
- data/lib/scout/workflow/definition.rb +11 -10
- data/lib/scout/workflow/deployment/orchestrator.rb +20 -3
- data/lib/scout/workflow/deployment/trace.rb +205 -0
- data/lib/scout/workflow/deployment.rb +1 -0
- data/lib/scout/workflow/documentation.rb +1 -1
- data/lib/scout/workflow/step/archive.rb +42 -0
- data/lib/scout/workflow/step/children.rb +51 -0
- data/lib/scout/workflow/step/config.rb +1 -1
- data/lib/scout/workflow/step/dependencies.rb +24 -7
- data/lib/scout/workflow/step/file.rb +19 -0
- data/lib/scout/workflow/step/info.rb +37 -9
- data/lib/scout/workflow/step/progress.rb +11 -2
- data/lib/scout/workflow/step/status.rb +8 -1
- data/lib/scout/workflow/step.rb +80 -25
- data/lib/scout/workflow/task/dependencies.rb +4 -1
- data/lib/scout/workflow/task/inputs.rb +91 -41
- data/lib/scout/workflow/task.rb +54 -57
- data/lib/scout/workflow/usage.rb +1 -1
- data/lib/scout/workflow/util.rb +4 -0
- data/lib/scout/workflow.rb +110 -13
- data/lib/scout-gear.rb +2 -0
- data/lib/scout.rb +0 -1
- data/scout-gear.gemspec +80 -23
- data/scout_commands/rbbt +2 -0
- data/test/data/person/brothers +4 -0
- data/test/data/person/identifiers +10 -0
- data/test/data/person/marriages +3 -0
- data/test/data/person/parents +6 -0
- data/test/scout/association/test_fields.rb +105 -0
- data/test/scout/association/test_index.rb +70 -0
- data/test/scout/association/test_item.rb +21 -0
- data/test/scout/entity/test_format.rb +19 -0
- data/test/scout/entity/test_identifiers.rb +58 -0
- data/test/scout/entity/test_object.rb +0 -0
- data/test/scout/entity/test_property.rb +345 -0
- data/test/scout/{tsv/persist → persist/engine}/test_fix_width_table.rb +0 -1
- data/test/scout/persist/engine/test_packed_index.rb +99 -0
- data/test/scout/persist/engine/test_sharder.rb +31 -0
- data/test/scout/persist/engine/test_tkrzw.rb +0 -0
- data/test/scout/persist/engine/test_tokyocabinet.rb +17 -0
- data/test/scout/persist/test_tsv.rb +146 -0
- data/test/scout/{tsv/persist/test_adapter.rb → persist/tsv/adapter/test_base.rb} +3 -4
- data/test/scout/persist/tsv/adapter/test_fix_width_table.rb +46 -0
- data/test/scout/persist/tsv/adapter/test_packed_index.rb +37 -0
- data/test/scout/persist/tsv/adapter/test_serialize.rb +0 -0
- data/test/scout/persist/tsv/adapter/test_sharder.rb +290 -0
- data/test/scout/{tsv/persist → persist/tsv/adapter}/test_tkrzw.rb +3 -6
- data/test/scout/persist/tsv/adapter/test_tokyocabinet.rb +282 -0
- data/test/scout/persist/tsv/test_serialize.rb +12 -0
- data/test/scout/test_association.rb +51 -0
- data/test/scout/test_entity.rb +40 -0
- data/test/scout/test_tsv.rb +33 -4
- data/test/scout/test_work_queue.rb +3 -2
- data/test/scout/test_workflow.rb +16 -15
- data/test/scout/tsv/annotation/test_repo.rb +150 -0
- data/test/scout/tsv/change_id/test_translate.rb +178 -0
- data/test/scout/tsv/test_annotation.rb +52 -0
- data/test/scout/tsv/test_attach.rb +226 -1
- data/test/scout/tsv/test_change_id.rb +25 -0
- data/test/scout/tsv/test_csv.rb +50 -0
- data/test/scout/tsv/test_dumper.rb +38 -0
- data/test/scout/tsv/test_entity.rb +0 -0
- data/test/scout/tsv/test_index.rb +82 -0
- data/test/scout/tsv/test_open.rb +44 -0
- data/test/scout/tsv/test_parser.rb +70 -0
- data/test/scout/tsv/test_stream.rb +22 -0
- data/test/scout/tsv/test_transformer.rb +27 -3
- data/test/scout/tsv/test_traverse.rb +78 -0
- data/test/scout/tsv/util/test_process.rb +16 -0
- data/test/scout/tsv/util/test_reorder.rb +67 -0
- data/test/scout/tsv/util/test_sort.rb +28 -1
- data/test/scout/tsv/util/test_unzip.rb +32 -0
- data/test/scout/work_queue/test_socket.rb +4 -1
- data/test/scout/workflow/deployment/test_orchestrator.rb +17 -26
- data/test/scout/workflow/deployment/test_trace.rb +25 -0
- data/test/scout/workflow/step/test_archive.rb +28 -0
- data/test/scout/workflow/step/test_children.rb +25 -0
- data/test/scout/workflow/step/test_info.rb +16 -0
- data/test/scout/workflow/task/test_dependencies.rb +16 -16
- data/test/scout/workflow/task/test_inputs.rb +45 -1
- data/test/scout/workflow/test_definition.rb +52 -0
- data/test/scout/workflow/test_step.rb +57 -0
- data/test/scout/workflow/test_task.rb +26 -1
- data/test/scout/workflow/test_usage.rb +4 -4
- data/test/test_helper.rb +23 -1
- metadata +71 -14
- data/lib/scout/tsv/persist.rb +0 -27
- data/test/scout/tsv/persist/test_tokyocabinet.rb +0 -120
- data/test/scout/tsv/test_persist.rb +0 -45
data/lib/scout/workflow.rb
CHANGED
@@ -11,13 +11,45 @@ require 'scout/resource/scout'
|
|
11
11
|
|
12
12
|
module Workflow
|
13
13
|
class << self
|
14
|
-
attr_accessor :workflows, :main
|
14
|
+
attr_accessor :workflows, :main, :workflow_dir, :autoinstall, :workflow_repo
|
15
15
|
def workflows
|
16
16
|
@workflows ||= []
|
17
17
|
end
|
18
|
+
|
19
|
+
def workflow_dir
|
20
|
+
@workflow_dir ||
|
21
|
+
ENV["SCOUT_WORKFLOW_DIR"] ||
|
22
|
+
begin
|
23
|
+
workflow_dir_config = Path.setup("etc/workflow_dir")
|
24
|
+
if workflow_dir_config.exists?
|
25
|
+
Path.setup(workflow_dir_config.read.strip)
|
26
|
+
else
|
27
|
+
Path.setup('workflows').find(:user)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def workflow_repo
|
33
|
+
@workflow_repo ||
|
34
|
+
ENV["SCOUT_WORKFLOW_REPO"] ||
|
35
|
+
begin
|
36
|
+
workflow_repo_config = Path.setup("etc/workflow_repo")
|
37
|
+
if workflow_repo_config.exists?
|
38
|
+
workflow_repo_config.read.strip
|
39
|
+
else
|
40
|
+
'https://github.com/Scout-Workflows/'
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def autoinstall
|
46
|
+
@autoinstall || ENV["SCOUT_WORKFLOW_AUTOINSTALL"] = "true"
|
47
|
+
end
|
48
|
+
|
18
49
|
end
|
19
50
|
|
20
51
|
attr_accessor :libdir
|
52
|
+
|
21
53
|
def self.extended(base)
|
22
54
|
self.workflows << base
|
23
55
|
libdir = Path.caller_lib_dir
|
@@ -25,22 +57,87 @@ module Workflow
|
|
25
57
|
base.libdir = Path.setup(libdir).tap{|p| p.resource = base}
|
26
58
|
end
|
27
59
|
|
60
|
+
def self.update_workflow_dir(workflow_dir)
|
61
|
+
Misc.in_dir(workflow_dir) do
|
62
|
+
Log.info "Updating: " + workflow_dir
|
63
|
+
`git pull`
|
64
|
+
`git submodule init`
|
65
|
+
`git submodule update`
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
def self.install_workflow(workflow, base_repo_url = nil)
|
70
|
+
case
|
71
|
+
when File.exist?(workflow)
|
72
|
+
update_workflow_dir(workflow)
|
73
|
+
else
|
74
|
+
Misc.in_dir(self.workflow_dir) do
|
75
|
+
Log.info "Installing: " + workflow
|
76
|
+
|
77
|
+
repo_base_url ||= self.workflow_repo
|
78
|
+
|
79
|
+
|
80
|
+
if repo_base_url.include?(workflow) or repo_base_url.include?(Misc.snake_case(workflow))
|
81
|
+
repo = repo_base_url
|
82
|
+
else
|
83
|
+
begin
|
84
|
+
repo = File.join(repo_base_url, workflow + '.git')
|
85
|
+
CMD.cmd("wget '#{repo}' -O /dev/null").read
|
86
|
+
rescue
|
87
|
+
Log.debug "Workflow repo does not exist, trying snake_case: #{ repo }"
|
88
|
+
begin
|
89
|
+
repo = File.join(repo_base_url, Misc.snake_case(workflow) + '.git')
|
90
|
+
CMD.cmd("wget '#{repo}' -O /dev/null").read
|
91
|
+
rescue
|
92
|
+
raise "Workflow repo does not exist: #{ repo }"
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
Log.warn "Cloning #{ repo }"
|
98
|
+
Misc.insist do
|
99
|
+
`git clone "#{repo}" #{ Misc.snake_case(workflow) }`
|
100
|
+
raise unless $?.success?
|
101
|
+
end
|
102
|
+
Log.warn "Initializing and updating submodules for #{repo}. You might be prompted for passwords."
|
103
|
+
Misc.in_dir(Misc.snake_case(workflow)) do
|
104
|
+
`git submodule init`
|
105
|
+
`git submodule update`
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
def self.require_workflow_file(file)
|
112
|
+
file = file.find if Path === file
|
113
|
+
$LOAD_PATH.unshift(File.join(File.dirname(file), 'lib'))
|
114
|
+
load file
|
115
|
+
end
|
116
|
+
|
28
117
|
def self.require_workflow(workflow_name_orig)
|
29
118
|
first = nil
|
30
119
|
workflow_name_orig.split("+").each do |complete_workflow_name|
|
31
120
|
self.main = nil
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
121
|
+
|
122
|
+
Persist.memory(complete_workflow_name, prefix: "Workflow") do
|
123
|
+
begin
|
124
|
+
workflow_name, *subworkflows = complete_workflow_name.split("::")
|
125
|
+
workflow_file = workflow_name
|
126
|
+
workflow_file = Path.setup('workflows')[workflow_name]["workflow.rb"] unless Open.exists?(workflow_file)
|
127
|
+
workflow_file = Path.setup('workflows')[Misc.snake_case(workflow_name)]["workflow.rb"] unless Open.exists?(workflow_file)
|
128
|
+
workflow_file = Path.setup('workflows')[Misc.camel_case(workflow_name)]["workflow.rb"] unless Open.exists?(workflow_file)
|
129
|
+
if Open.exists?(workflow_file)
|
130
|
+
self.main = nil
|
131
|
+
require_workflow_file(workflow_file)
|
132
|
+
elsif autoinstall
|
133
|
+
install_workflow(workflow_name)
|
134
|
+
raise TryAgain
|
135
|
+
else
|
136
|
+
raise "Workflow #{workflow_name} not found"
|
137
|
+
end
|
138
|
+
rescue TryAgain
|
139
|
+
retry
|
140
|
+
end
|
44
141
|
end
|
45
142
|
|
46
143
|
current = begin
|
data/lib/scout-gear.rb
CHANGED
data/lib/scout.rb
CHANGED
data/scout-gear.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: scout-gear 10.
|
5
|
+
# stub: scout-gear 10.6.1 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "scout-gear".freeze
|
9
|
-
s.version = "10.
|
9
|
+
s.version = "10.6.1".freeze
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib".freeze]
|
13
13
|
s.authors = ["Miguel Vazquez".freeze]
|
14
|
-
s.date = "
|
14
|
+
s.date = "2024-05-28"
|
15
15
|
s.description = "Temporary files, logs, path, resources, persistence, workflows, TSV, etc.".freeze
|
16
16
|
s.email = "mikisvaz@gmail.com".freeze
|
17
17
|
s.executables = ["scout".freeze]
|
@@ -33,26 +33,50 @@ Gem::Specification.new do |s|
|
|
33
33
|
"lib/rbbt-scout.rb",
|
34
34
|
"lib/scout-gear.rb",
|
35
35
|
"lib/scout.rb",
|
36
|
+
"lib/scout/association.rb",
|
37
|
+
"lib/scout/association/fields.rb",
|
38
|
+
"lib/scout/association/index.rb",
|
39
|
+
"lib/scout/association/item.rb",
|
40
|
+
"lib/scout/association/util.rb",
|
41
|
+
"lib/scout/entity.rb",
|
42
|
+
"lib/scout/entity/format.rb",
|
43
|
+
"lib/scout/entity/identifiers.rb",
|
44
|
+
"lib/scout/entity/object.rb",
|
45
|
+
"lib/scout/entity/property.rb",
|
36
46
|
"lib/scout/offsite.rb",
|
37
47
|
"lib/scout/offsite/exceptions.rb",
|
38
48
|
"lib/scout/offsite/ssh.rb",
|
39
49
|
"lib/scout/offsite/step.rb",
|
40
50
|
"lib/scout/offsite/sync.rb",
|
51
|
+
"lib/scout/persist/engine.rb",
|
52
|
+
"lib/scout/persist/engine/fix_width_table.rb",
|
53
|
+
"lib/scout/persist/engine/packed_index.rb",
|
54
|
+
"lib/scout/persist/engine/sharder.rb",
|
55
|
+
"lib/scout/persist/engine/tkrzw.rb",
|
56
|
+
"lib/scout/persist/engine/tokyocabinet.rb",
|
57
|
+
"lib/scout/persist/tsv.rb",
|
58
|
+
"lib/scout/persist/tsv/adapter.rb",
|
59
|
+
"lib/scout/persist/tsv/adapter/base.rb",
|
60
|
+
"lib/scout/persist/tsv/adapter/fix_width_table.rb",
|
61
|
+
"lib/scout/persist/tsv/adapter/packed_index.rb",
|
62
|
+
"lib/scout/persist/tsv/adapter/sharder.rb",
|
63
|
+
"lib/scout/persist/tsv/adapter/tkrzw.rb",
|
64
|
+
"lib/scout/persist/tsv/adapter/tokyocabinet.rb",
|
65
|
+
"lib/scout/persist/tsv/serialize.rb",
|
41
66
|
"lib/scout/semaphore.rb",
|
42
67
|
"lib/scout/tsv.rb",
|
68
|
+
"lib/scout/tsv/annotation.rb",
|
69
|
+
"lib/scout/tsv/annotation/repo.rb",
|
43
70
|
"lib/scout/tsv/attach.rb",
|
44
71
|
"lib/scout/tsv/change_id.rb",
|
72
|
+
"lib/scout/tsv/change_id/translate.rb",
|
73
|
+
"lib/scout/tsv/csv.rb",
|
45
74
|
"lib/scout/tsv/dumper.rb",
|
75
|
+
"lib/scout/tsv/entity.rb",
|
46
76
|
"lib/scout/tsv/index.rb",
|
47
77
|
"lib/scout/tsv/open.rb",
|
48
78
|
"lib/scout/tsv/parser.rb",
|
49
79
|
"lib/scout/tsv/path.rb",
|
50
|
-
"lib/scout/tsv/persist.rb",
|
51
|
-
"lib/scout/tsv/persist/adapter.rb",
|
52
|
-
"lib/scout/tsv/persist/fix_width_table.rb",
|
53
|
-
"lib/scout/tsv/persist/serialize.rb",
|
54
|
-
"lib/scout/tsv/persist/tkrzw.rb",
|
55
|
-
"lib/scout/tsv/persist/tokyocabinet.rb",
|
56
80
|
"lib/scout/tsv/stream.rb",
|
57
81
|
"lib/scout/tsv/transformer.rb",
|
58
82
|
"lib/scout/tsv/traverse.rb",
|
@@ -72,8 +96,11 @@ Gem::Specification.new do |s|
|
|
72
96
|
"lib/scout/workflow/definition.rb",
|
73
97
|
"lib/scout/workflow/deployment.rb",
|
74
98
|
"lib/scout/workflow/deployment/orchestrator.rb",
|
99
|
+
"lib/scout/workflow/deployment/trace.rb",
|
75
100
|
"lib/scout/workflow/documentation.rb",
|
76
101
|
"lib/scout/workflow/step.rb",
|
102
|
+
"lib/scout/workflow/step/archive.rb",
|
103
|
+
"lib/scout/workflow/step/children.rb",
|
77
104
|
"lib/scout/workflow/step/config.rb",
|
78
105
|
"lib/scout/workflow/step/dependencies.rb",
|
79
106
|
"lib/scout/workflow/step/file.rb",
|
@@ -114,26 +141,53 @@ Gem::Specification.new do |s|
|
|
114
141
|
"share/software/install_helpers",
|
115
142
|
"share/templates/command",
|
116
143
|
"share/templates/workflow.rb",
|
144
|
+
"test/data/person/brothers",
|
145
|
+
"test/data/person/identifiers",
|
146
|
+
"test/data/person/marriages",
|
147
|
+
"test/data/person/parents",
|
148
|
+
"test/scout/association/test_fields.rb",
|
149
|
+
"test/scout/association/test_index.rb",
|
150
|
+
"test/scout/association/test_item.rb",
|
151
|
+
"test/scout/entity/test_format.rb",
|
152
|
+
"test/scout/entity/test_identifiers.rb",
|
153
|
+
"test/scout/entity/test_object.rb",
|
154
|
+
"test/scout/entity/test_property.rb",
|
117
155
|
"test/scout/offsite/test_ssh.rb",
|
118
156
|
"test/scout/offsite/test_step.rb",
|
119
157
|
"test/scout/offsite/test_sync.rb",
|
120
158
|
"test/scout/offsite/test_task.rb",
|
159
|
+
"test/scout/persist/engine/test_fix_width_table.rb",
|
160
|
+
"test/scout/persist/engine/test_packed_index.rb",
|
161
|
+
"test/scout/persist/engine/test_sharder.rb",
|
162
|
+
"test/scout/persist/engine/test_tkrzw.rb",
|
163
|
+
"test/scout/persist/engine/test_tokyocabinet.rb",
|
164
|
+
"test/scout/persist/test_tsv.rb",
|
165
|
+
"test/scout/persist/tsv/adapter/test_base.rb",
|
166
|
+
"test/scout/persist/tsv/adapter/test_fix_width_table.rb",
|
167
|
+
"test/scout/persist/tsv/adapter/test_packed_index.rb",
|
168
|
+
"test/scout/persist/tsv/adapter/test_serialize.rb",
|
169
|
+
"test/scout/persist/tsv/adapter/test_sharder.rb",
|
170
|
+
"test/scout/persist/tsv/adapter/test_tkrzw.rb",
|
171
|
+
"test/scout/persist/tsv/adapter/test_tokyocabinet.rb",
|
172
|
+
"test/scout/persist/tsv/test_serialize.rb",
|
173
|
+
"test/scout/test_association.rb",
|
174
|
+
"test/scout/test_entity.rb",
|
121
175
|
"test/scout/test_offsite.rb",
|
122
176
|
"test/scout/test_semaphore.rb",
|
123
177
|
"test/scout/test_tsv.rb",
|
124
178
|
"test/scout/test_work_queue.rb",
|
125
179
|
"test/scout/test_workflow.rb",
|
126
|
-
"test/scout/tsv/
|
127
|
-
"test/scout/tsv/
|
128
|
-
"test/scout/tsv/
|
129
|
-
"test/scout/tsv/persist/test_tokyocabinet.rb",
|
180
|
+
"test/scout/tsv/annotation/test_repo.rb",
|
181
|
+
"test/scout/tsv/change_id/test_translate.rb",
|
182
|
+
"test/scout/tsv/test_annotation.rb",
|
130
183
|
"test/scout/tsv/test_attach.rb",
|
131
184
|
"test/scout/tsv/test_change_id.rb",
|
185
|
+
"test/scout/tsv/test_csv.rb",
|
132
186
|
"test/scout/tsv/test_dumper.rb",
|
187
|
+
"test/scout/tsv/test_entity.rb",
|
133
188
|
"test/scout/tsv/test_index.rb",
|
134
189
|
"test/scout/tsv/test_open.rb",
|
135
190
|
"test/scout/tsv/test_parser.rb",
|
136
|
-
"test/scout/tsv/test_persist.rb",
|
137
191
|
"test/scout/tsv/test_stream.rb",
|
138
192
|
"test/scout/tsv/test_transformer.rb",
|
139
193
|
"test/scout/tsv/test_traverse.rb",
|
@@ -148,6 +202,9 @@ Gem::Specification.new do |s|
|
|
148
202
|
"test/scout/work_queue/test_socket.rb",
|
149
203
|
"test/scout/work_queue/test_worker.rb",
|
150
204
|
"test/scout/workflow/deployment/test_orchestrator.rb",
|
205
|
+
"test/scout/workflow/deployment/test_trace.rb",
|
206
|
+
"test/scout/workflow/step/test_archive.rb",
|
207
|
+
"test/scout/workflow/step/test_children.rb",
|
151
208
|
"test/scout/workflow/step/test_dependencies.rb",
|
152
209
|
"test/scout/workflow/step/test_info.rb",
|
153
210
|
"test/scout/workflow/step/test_load.rb",
|
@@ -167,18 +224,18 @@ Gem::Specification.new do |s|
|
|
167
224
|
]
|
168
225
|
s.homepage = "http://github.com/mikisvaz/scout-gear".freeze
|
169
226
|
s.licenses = ["MIT".freeze]
|
170
|
-
s.rubygems_version = "3.5.
|
227
|
+
s.rubygems_version = "3.5.10".freeze
|
171
228
|
s.summary = "basic gear for scouts".freeze
|
172
229
|
|
173
230
|
s.specification_version = 4
|
174
231
|
|
175
|
-
s.add_runtime_dependency(%q<scout-essentials>.freeze, [">= 0"])
|
176
|
-
s.add_runtime_dependency(%q<net-ssh>.freeze, [">= 0"])
|
177
|
-
s.add_runtime_dependency(%q<matrix>.freeze, [">= 0"])
|
178
|
-
s.add_runtime_dependency(%q<RubyInline>.freeze, [">= 0"])
|
179
|
-
s.add_development_dependency(%q<rdoc>.freeze, ["~> 3.12"])
|
180
|
-
s.add_development_dependency(%q<bundler>.freeze, ["~> 1.0"])
|
181
|
-
s.add_development_dependency(%q<juwelier>.freeze, ["~> 2.1.0"])
|
182
|
-
s.add_development_dependency(%q<simplecov>.freeze, [">= 0"])
|
232
|
+
s.add_runtime_dependency(%q<scout-essentials>.freeze, [">= 0".freeze])
|
233
|
+
s.add_runtime_dependency(%q<net-ssh>.freeze, [">= 0".freeze])
|
234
|
+
s.add_runtime_dependency(%q<matrix>.freeze, [">= 0".freeze])
|
235
|
+
s.add_runtime_dependency(%q<RubyInline>.freeze, [">= 0".freeze])
|
236
|
+
s.add_development_dependency(%q<rdoc>.freeze, ["~> 3.12".freeze])
|
237
|
+
s.add_development_dependency(%q<bundler>.freeze, ["~> 1.0".freeze])
|
238
|
+
s.add_development_dependency(%q<juwelier>.freeze, ["~> 2.1.0".freeze])
|
239
|
+
s.add_development_dependency(%q<simplecov>.freeze, [">= 0".freeze])
|
183
240
|
end
|
184
241
|
|
data/scout_commands/rbbt
CHANGED
@@ -0,0 +1,105 @@
|
|
1
|
+
require File.expand_path(__FILE__).sub(%r(/test/.*), '/test/test_helper.rb')
|
2
|
+
require File.expand_path(__FILE__).sub(%r(.*/test/), '').sub(/test_(.*)\.rb/,'\1')
|
3
|
+
|
4
|
+
require 'scout/tsv'
|
5
|
+
class TestAssociationFields < Test::Unit::TestCase
|
6
|
+
def test_specs
|
7
|
+
spec = Association.parse_field_specification "=~Associated Gene Name=>Ensembl Gene ID"
|
8
|
+
assert_equal [nil, "Associated Gene Name", "Ensembl Gene ID"], spec
|
9
|
+
|
10
|
+
spec = Association.parse_field_specification "TG=~Associated Gene Name=>Ensembl Gene ID"
|
11
|
+
assert_equal ["TG", "Associated Gene Name", "Ensembl Gene ID"], spec
|
12
|
+
|
13
|
+
spec = Association.parse_field_specification "TG=~Associated Gene Name"
|
14
|
+
assert_equal ["TG", "Associated Gene Name", nil], spec
|
15
|
+
|
16
|
+
spec = Association.parse_field_specification "Associated Gene Name=>Ensembl Gene ID"
|
17
|
+
assert_equal ["Associated Gene Name", nil, "Ensembl Gene ID"], spec
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_normalize_specs
|
21
|
+
spec = Association.normalize_specs "TG=~Associated Gene Name=>Ensembl Gene ID", %w(SG TG Effect directed?)
|
22
|
+
assert_equal ["TG", "Associated Gene Name", "Ensembl Gene ID"], spec
|
23
|
+
|
24
|
+
spec = Association.normalize_specs "Ensembl Gene ID", %w(SG TG Effect directed?)
|
25
|
+
assert_equal ["Ensembl Gene ID", nil, nil], spec
|
26
|
+
|
27
|
+
spec = Association.normalize_specs "Ensembl Gene ID"
|
28
|
+
assert_equal ["Ensembl Gene ID", nil, nil], spec
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_process_specs
|
32
|
+
spec = Association.extract_specs %w(SG TG Effect directed?), :target => "TG=~Associated Gene Name=>Ensembl Gene ID"
|
33
|
+
assert_equal ["TG", "Associated Gene Name", "Ensembl Gene ID"], spec[:target]
|
34
|
+
assert_equal ["SG", nil, nil], spec[:source]
|
35
|
+
|
36
|
+
spec = Association.extract_specs %w(SG TG Effect directed?)
|
37
|
+
assert_equal ["SG", nil, nil], spec[:source]
|
38
|
+
assert_equal ["TG", nil,nil], spec[:target]
|
39
|
+
|
40
|
+
spec = Association.extract_specs %w(SG TG Effect directed?), :source => "TG"
|
41
|
+
assert_equal ["TG", nil, nil], spec[:source]
|
42
|
+
assert_equal ["SG", nil,nil], spec[:target]
|
43
|
+
|
44
|
+
spec = Association.extract_specs %w(SG TG Effect directed?), :source => "SG"
|
45
|
+
assert_equal ["SG", nil, nil], spec[:source]
|
46
|
+
assert_equal ["TG", nil,nil], spec[:target]
|
47
|
+
|
48
|
+
spec = Association.extract_specs %w(SG TG Effect directed?), :target => "SG"
|
49
|
+
assert_equal ["TG", nil, nil], spec[:source]
|
50
|
+
assert_equal ["SG", nil,nil], spec[:target]
|
51
|
+
end
|
52
|
+
|
53
|
+
def test_headers
|
54
|
+
spec = Association.headers %w(SG TG Effect directed?), %w(Effect)
|
55
|
+
assert_equal 0, spec[0]
|
56
|
+
assert_equal 1, spec[1][0]
|
57
|
+
|
58
|
+
spec = Association.headers %w(SG TG Effect directed?), %w(Effect), :source => "SG"
|
59
|
+
assert_equal 0, spec[0]
|
60
|
+
assert_equal 1, spec[1][0]
|
61
|
+
|
62
|
+
spec = Association.headers %w(SG TG Effect directed?), %w(Effect), :target => "TG"
|
63
|
+
assert_equal 0, spec[0]
|
64
|
+
assert_equal 1, spec[1][0]
|
65
|
+
|
66
|
+
spec = Association.headers %w(SG TG Effect directed?), %w(Effect), :target => "TG", :source => "SG"
|
67
|
+
assert_equal 0, spec[0]
|
68
|
+
assert_equal 1, spec[1][0]
|
69
|
+
|
70
|
+
spec = Association.headers %w(SG TG Effect directed?), %w(Effect), :source => "TG"
|
71
|
+
assert_equal 1, spec[0]
|
72
|
+
assert_equal 0, spec[1][0]
|
73
|
+
|
74
|
+
spec = Association.headers %w(SG TG Effect directed?), %w(Effect), :target => "SG"
|
75
|
+
assert_equal 1, spec[0]
|
76
|
+
assert_equal 0, spec[1][0]
|
77
|
+
|
78
|
+
spec = Association.headers %w(SG TG Effect directed?), %w(Effect), :target => "SG", :source => "TG"
|
79
|
+
assert_equal 1, spec[0]
|
80
|
+
assert_equal 0, spec[1][0]
|
81
|
+
|
82
|
+
spec = Association.headers %w(SG TG Effect directed?), %w(Effect), :target => "SG", :source => "TG=~Associated Gene Name=>Ensembl Gene ID"
|
83
|
+
assert_equal 1, spec[0]
|
84
|
+
assert_equal 0, spec[1][0]
|
85
|
+
|
86
|
+
spec = Association.headers %w(SG TG Effect directed?), %w(Effect), :target => "SG=~Associated Gene Name=>Ensembl Gene ID", :source => "TG=~Associated Gene Name=>Ensembl Gene ID"
|
87
|
+
assert_equal 1, spec[0]
|
88
|
+
assert_equal 0, spec[1][0]
|
89
|
+
|
90
|
+
spec = Association.headers %w(SG TG Effect directed?), %w(Effect), :target => "SG=~Associated Gene Name", :source => "TG=~Associated Gene Name=>Ensembl Gene ID"
|
91
|
+
assert_equal 1, spec[0]
|
92
|
+
assert_equal 0, spec[1][0]
|
93
|
+
|
94
|
+
spec = Association.headers %w(SG TG Effect directed?), %w(Effect), :target => "TG=~Associated Gene Name", :source => "SG=~Associated Gene Name", :target_format => "Ensembl Gene ID"
|
95
|
+
assert_equal 0, spec[0]
|
96
|
+
assert_equal "Ensembl Gene ID", spec[5]
|
97
|
+
assert_equal nil, spec[4]
|
98
|
+
|
99
|
+
|
100
|
+
spec = Association.headers %w(SG TG Effect directed?), %w(Effect), :target => "TG=~Associated Gene Name", :source => "SG=~Associated Gene Name", :source_format => "Ensembl Gene ID"
|
101
|
+
assert_equal 0, spec[0]
|
102
|
+
assert_equal "Ensembl Gene ID", spec[4]
|
103
|
+
assert_equal nil, spec[5]
|
104
|
+
end
|
105
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
require File.expand_path(__FILE__).sub(%r(/test/.*), '/test/test_helper.rb')
|
2
|
+
require File.expand_path(__FILE__).sub(%r(.*/test/), '').sub(/test_(.*)\.rb/,'\1')
|
3
|
+
|
4
|
+
require 'scout/tsv'
|
5
|
+
require 'scout/association'
|
6
|
+
class TestAssociationIndex < Test::Unit::TestCase
|
7
|
+
def test_parents_simple
|
8
|
+
database = Association.database datadir_test.person.parents
|
9
|
+
index = Association.index datadir_test.person.parents
|
10
|
+
assert_include index, "Miki~Juan"
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_parents
|
14
|
+
index = Association.index datadir_test.person.parents, target: "Parent=>Name", source: "=>Name"
|
15
|
+
assert_include index, "Miguel~Juan Luis"
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_brothers
|
19
|
+
index = Association.index datadir_test.person.brothers, undirected: true, persist: false
|
20
|
+
assert_include index, "Clei~Guille"
|
21
|
+
assert_include index, "Guille~Clei"
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_brothers_match
|
25
|
+
index = Association.index datadir_test.person.brothers, undirected: true
|
26
|
+
assert_equal ["Clei~Guille"], index.match("Clei")
|
27
|
+
assert_equal ["Guille~Clei"], index.match("Guille")
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_parents_subset
|
31
|
+
index = Association.index datadir_test.person.parents
|
32
|
+
assert_include index.subset(["Miki", "Guille"], :all), "Miki~Juan"
|
33
|
+
assert_include index.subset(["Miki", "Guille"], :all), "Guille~Gloria"
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_parents_reverse
|
37
|
+
index = Association.index datadir_test.person.parents
|
38
|
+
assert_include index.reverse.source_field, "Parent"
|
39
|
+
assert_include index.reverse.subset(["Juan"], :all), "Juan~Miki"
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_parents_filter
|
43
|
+
index = Association.index datadir_test.person.parents
|
44
|
+
assert_include index.filter('Type of parent', 'mother'), "Miki~Mariluz"
|
45
|
+
assert_include index.filter('Type of parent', 'mother'), "Clei~Gloria"
|
46
|
+
refute index.filter('Type of parent', 'mother').include?("Miki~Juan")
|
47
|
+
end
|
48
|
+
|
49
|
+
def test_parents_flat
|
50
|
+
tsv = datadir_test.person.parents.tsv type: :flat, fields: ["Parent"]
|
51
|
+
index = Association.index tsv
|
52
|
+
assert_include index, "Miki~Juan"
|
53
|
+
assert_include index, "Isa~Mariluz"
|
54
|
+
end
|
55
|
+
|
56
|
+
def test_list_serializer
|
57
|
+
TmpFile.with_file <<-EOF do |f|
|
58
|
+
#: :sep=,#:type=:list
|
59
|
+
#lowcase,upcase,double,triple
|
60
|
+
a,A,aa,aaa
|
61
|
+
b,B,bb,bbb
|
62
|
+
EOF
|
63
|
+
tsv = TSV.open(f)
|
64
|
+
i = Association.index tsv
|
65
|
+
assert_equal ['aa', 'aaa'], i["a~A"]
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
70
|
+
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require File.expand_path(__FILE__).sub(%r(/test/.*), '/test/test_helper.rb')
|
2
|
+
require File.expand_path(__FILE__).sub(%r(.*/test/), '').sub(/test_(.*)\.rb/,'\1')
|
3
|
+
|
4
|
+
require 'scout/tsv'
|
5
|
+
require 'scout/association'
|
6
|
+
class TestAssociationItem < Test::Unit::TestCase
|
7
|
+
def test_incidence
|
8
|
+
pairs = [[:A, :a], [:B, :b]].collect{|p| "#{p.first.to_s}~#{p.last.to_s}"}
|
9
|
+
assert TSV === AssociationItem.incidence(pairs)
|
10
|
+
assert_equal 2, AssociationItem.incidence(pairs).length
|
11
|
+
assert_equal 2, AssociationItem.incidence(pairs).fields.length
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_brothers
|
15
|
+
incidence = TSV.incidence(datadir_test.person.brothers, undirected: true)
|
16
|
+
assert incidence["Clei"]["Guille"]
|
17
|
+
assert incidence["Guille"]["Clei"]
|
18
|
+
refute incidence["Clei"]["Isa"]
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require File.expand_path(__FILE__).sub(%r(/test/.*), '/test/test_helper.rb')
|
2
|
+
require File.expand_path(__FILE__).sub(%r(.*/test/), '').sub(/test_(.*)\.rb/,'\1')
|
3
|
+
|
4
|
+
class TestEntityFormat < Test::Unit::TestCase
|
5
|
+
def test_format
|
6
|
+
index = Entity::FormatIndex.new
|
7
|
+
index["Ensembl Gene ID"] = "Gene"
|
8
|
+
assert_equal "Gene", index["Ensembl Gene ID"]
|
9
|
+
assert_equal "Gene", index["Transcription Factor (Ensembl Gene ID)"]
|
10
|
+
|
11
|
+
Entity::FORMATS["Ensembl Gene ID"] = "Gene"
|
12
|
+
assert_equal "Ensembl Gene ID", Entity::FORMATS.find("Ensembl Gene ID")
|
13
|
+
assert_equal "Ensembl Gene ID", Entity::FORMATS.find("Transcription Factor (Ensembl Gene ID)")
|
14
|
+
|
15
|
+
assert_equal "Gene", Entity::FORMATS["Ensembl Gene ID"]
|
16
|
+
assert_equal "Gene", Entity::FORMATS["Transcription Factor (Ensembl Gene ID)"]
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
@@ -0,0 +1,58 @@
|
|
1
|
+
require File.expand_path(__FILE__).sub(%r(/test/.*), '/test/test_helper.rb')
|
2
|
+
require File.expand_path(__FILE__).sub(%r(.*/test/), '').sub(/test_(.*)\.rb/,'\1')
|
3
|
+
|
4
|
+
require 'scout/tsv'
|
5
|
+
require 'scout/entity'
|
6
|
+
|
7
|
+
class TestEntityIdentifiers < Test::Unit::TestCase
|
8
|
+
module Person
|
9
|
+
extend Entity
|
10
|
+
end
|
11
|
+
|
12
|
+
module PersonWithNoIds
|
13
|
+
extend Entity
|
14
|
+
include Entity::Identified
|
15
|
+
end
|
16
|
+
|
17
|
+
Person.add_identifiers datafile_test(Entity::Identified::NAMESPACE_TAG + '/identifiers'), "Name", "Alias"
|
18
|
+
|
19
|
+
teardown do
|
20
|
+
Entity.formats.clear
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_alias
|
24
|
+
miguel = Person.setup("Miguel", namespace: :person)
|
25
|
+
assert_equal "Miki", miguel.to("Alias")
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_alias_no_namespace
|
29
|
+
miguel = Person.setup("Miguel")
|
30
|
+
|
31
|
+
assert_raise do
|
32
|
+
miguel.to("Name")
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_alias_no_ids
|
37
|
+
miguel = PersonWithNoIds.setup("Miguel", namespace: :person)
|
38
|
+
assert_raise do
|
39
|
+
miguel.to("Name")
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
|
44
|
+
def test_name_from_ID
|
45
|
+
assert_equal "Miki", Person.setup("001", :format => 'ID', namespace: :person).to("Alias")
|
46
|
+
assert_equal "Miguel", Person.setup("001", :format => 'ID', namespace: :person).to("Name")
|
47
|
+
assert_equal ["Miguel"], Person.setup(["001"], :format => 'ID', namespace: :person).to("Name")
|
48
|
+
end
|
49
|
+
|
50
|
+
|
51
|
+
def test_identifier_files
|
52
|
+
assert Person.identifier_files.any?
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_Entity_identifier_files
|
56
|
+
assert Entity.identifier_files("Name").any?
|
57
|
+
end
|
58
|
+
end
|
File without changes
|