scout-gear 10.8.4 → 10.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.vimproject +13 -0
- data/README.md +352 -0
- data/VERSION +1 -1
- data/doc/Association.md +288 -0
- data/doc/Entity.md +296 -0
- data/doc/KnowledgeBase.md +433 -0
- data/doc/Persist.md +356 -0
- data/doc/Semaphore.md +171 -0
- data/doc/TSV.md +449 -0
- data/doc/WorkQueue.md +359 -0
- data/doc/Workflow.md +586 -0
- data/lib/scout/association.rb +4 -2
- data/lib/scout/entity/identifiers.rb +1 -1
- data/lib/scout/entity/object.rb +1 -1
- data/lib/scout/entity/property.rb +5 -5
- data/lib/scout/entity.rb +1 -1
- data/lib/scout/knowledge_base/description.rb +1 -1
- data/lib/scout/knowledge_base/list.rb +7 -2
- data/lib/scout/knowledge_base/registry.rb +2 -2
- data/lib/scout/knowledge_base.rb +20 -2
- data/lib/scout/monitor.rb +10 -6
- data/lib/scout/persist/engine/packed_index.rb +2 -2
- data/lib/scout/persist/engine/sharder.rb +1 -1
- data/lib/scout/persist/tsv.rb +1 -0
- data/lib/scout/semaphore.rb +1 -1
- data/lib/scout/tsv/dumper.rb +3 -3
- data/lib/scout/tsv/open.rb +1 -0
- data/lib/scout/tsv/parser.rb +1 -1
- data/lib/scout/tsv/transformer.rb +1 -0
- data/lib/scout/tsv/util.rb +2 -2
- data/lib/scout/work_queue/socket.rb +1 -1
- data/lib/scout/work_queue/worker.rb +7 -5
- data/lib/scout/workflow/entity.rb +22 -1
- data/lib/scout/workflow/step/config.rb +3 -3
- data/lib/scout/workflow/step/file.rb +4 -0
- data/lib/scout/workflow/step/info.rb +8 -2
- data/lib/scout/workflow/step.rb +10 -5
- data/lib/scout/workflow/task/inputs.rb +1 -1
- data/lib/scout/workflow/usage.rb +3 -2
- data/lib/scout/workflow/util.rb +22 -0
- data/scout-gear.gemspec +16 -5
- data/scout_commands/cat +86 -0
- data/scout_commands/doc +3 -1
- data/scout_commands/entity +151 -0
- data/scout_commands/system/status +238 -0
- data/scout_commands/workflow/info +23 -10
- data/scout_commands/workflow/install +1 -1
- data/test/scout/entity/test_property.rb +1 -1
- data/test/scout/knowledge_base/test_registry.rb +19 -0
- data/test/scout/test_work_queue.rb +1 -1
- data/test/scout/work_queue/test_worker.rb +12 -10
- metadata +15 -4
- data/doc/lib/scout/path.md +0 -35
- data/doc/lib/scout/workflow/task.md +0 -13
|
@@ -12,7 +12,7 @@ class KnowledgeBase
|
|
|
12
12
|
if entity_type.to_s == "simple"
|
|
13
13
|
path = dir.lists[entity_type.to_s][id]
|
|
14
14
|
else
|
|
15
|
-
path = dir.lists[entity_type.to_s][id
|
|
15
|
+
path = dir.lists[entity_type.to_s][id].find_with_extension("tsv")
|
|
16
16
|
end
|
|
17
17
|
else
|
|
18
18
|
path = dir.lists.glob("*/#{id}").first
|
|
@@ -33,6 +33,7 @@ class KnowledgeBase
|
|
|
33
33
|
Open.lock path do
|
|
34
34
|
begin
|
|
35
35
|
if AnnotatedArray === list
|
|
36
|
+
path = path.set_extension('tsv')
|
|
36
37
|
Open.write(path, Annotation.tsv(list, :all).to_s)
|
|
37
38
|
else
|
|
38
39
|
Open.write(path, list * "\n")
|
|
@@ -60,7 +61,11 @@ class KnowledgeBase
|
|
|
60
61
|
list.extend AnnotatedArray
|
|
61
62
|
list
|
|
62
63
|
else
|
|
63
|
-
path.list
|
|
64
|
+
list = path.list
|
|
65
|
+
if entity_type
|
|
66
|
+
Entity.prepare_entity(list, entity_type)
|
|
67
|
+
end
|
|
68
|
+
list
|
|
64
69
|
end
|
|
65
70
|
rescue
|
|
66
71
|
Log.exception $!
|
|
@@ -84,7 +84,7 @@ class KnowledgeBase
|
|
|
84
84
|
key = name.to_s + "_" + fp
|
|
85
85
|
end
|
|
86
86
|
|
|
87
|
-
Persist.memory("Index:"
|
|
87
|
+
Persist.memory("Index:" + [key, dir] * "@") do
|
|
88
88
|
options = options.dup
|
|
89
89
|
|
|
90
90
|
persist_dir = dir
|
|
@@ -148,7 +148,7 @@ class KnowledgeBase
|
|
|
148
148
|
options[:namespace] ||= self.namespace unless self.namespace.nil?
|
|
149
149
|
|
|
150
150
|
key += '.database'
|
|
151
|
-
Persist.memory("Database:"
|
|
151
|
+
Persist.memory("Database:" + [key, dir] * "@") do
|
|
152
152
|
options = options.dup
|
|
153
153
|
|
|
154
154
|
persist_dir = dir
|
data/lib/scout/knowledge_base.rb
CHANGED
|
@@ -59,8 +59,26 @@ class KnowledgeBase
|
|
|
59
59
|
end
|
|
60
60
|
|
|
61
61
|
def self.load(dir)
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
kb = case dir
|
|
63
|
+
when Path
|
|
64
|
+
KnowledgeBase.new dir
|
|
65
|
+
when Symbol
|
|
66
|
+
dir = Path.setup("var").knowledge_base[dir.to_s] if Symbol === dir
|
|
67
|
+
kb = KnowledgeBase.new dir
|
|
68
|
+
when Workflow
|
|
69
|
+
raise if dir.knowledge_base.nil?
|
|
70
|
+
kb = dir.knowledge_base
|
|
71
|
+
when String
|
|
72
|
+
if Workflow.list.include? dir
|
|
73
|
+
workflow = Workflow.require_workflow dir
|
|
74
|
+
kb = workflow.knowledge_base
|
|
75
|
+
elsif dir =~ /^\w+$/
|
|
76
|
+
load(dir.to_sym)
|
|
77
|
+
else
|
|
78
|
+
kb = KnowledgeBase.new dir
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
|
|
64
82
|
kb.load
|
|
65
83
|
kb
|
|
66
84
|
end
|
data/lib/scout/monitor.rb
CHANGED
|
@@ -2,14 +2,18 @@ require 'scout'
|
|
|
2
2
|
|
|
3
3
|
module Scout
|
|
4
4
|
|
|
5
|
-
LOCK_DIRS = Scout.tmp.tsv_open_locks.find_all + Scout.tmp.persist_locks.find_all + Scout.tmp.sensiblewrite_locks.find_all +
|
|
6
|
-
Scout.tmp.produce_locks.find_all + Scout.tmp.step_info_locks.find_all
|
|
7
|
-
|
|
8
5
|
SENSIBLE_WRITE_DIRS = Open.sensible_write_dir.find_all
|
|
9
6
|
|
|
10
|
-
|
|
7
|
+
LOCK_DIRS = Path.setup('tmp/tsv_open_locks').find_all +
|
|
8
|
+
Path.setup('tmp/tsv_locks').find_all +
|
|
9
|
+
Path.setup('tmp/persist_locks').find_all +
|
|
10
|
+
Path.setup('tmp/sensible_write_locks').find_all +
|
|
11
|
+
Path.setup('tmp/produce_locks').find_all +
|
|
12
|
+
Path.setup('tmp/step_info_locks').find_all
|
|
13
|
+
|
|
14
|
+
PERSIST_DIRS = Path.setup('share').find_all + Path.setup('var/cache/persistence').find_all
|
|
11
15
|
|
|
12
|
-
JOB_DIRS =
|
|
16
|
+
JOB_DIRS = Path.setup('var/jobs').find_all
|
|
13
17
|
|
|
14
18
|
MUTEX_FOR_THREAD_EXCLUSIVE = Mutex.new
|
|
15
19
|
|
|
@@ -68,7 +72,7 @@ module Scout
|
|
|
68
72
|
lock_info[f][:ppid] = info[:ppid]
|
|
69
73
|
end
|
|
70
74
|
rescue Exception
|
|
71
|
-
Log.
|
|
75
|
+
Log.warn $!.message
|
|
72
76
|
end
|
|
73
77
|
end
|
|
74
78
|
lock_info
|
|
@@ -9,7 +9,7 @@ class PackedIndex
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
def self.process_mask(mask)
|
|
12
|
-
str = ""
|
|
12
|
+
str = "".dup
|
|
13
13
|
size = 0
|
|
14
14
|
mask.each do |e|
|
|
15
15
|
if ELEMS.include? e
|
|
@@ -50,7 +50,7 @@ class PackedIndex
|
|
|
50
50
|
@mask = @stream.read(mask_length)
|
|
51
51
|
@offset = @mask.length + 8
|
|
52
52
|
end
|
|
53
|
-
@nil_string = "NIL"
|
|
53
|
+
@nil_string = "NIL" + ("-" * (@item_size - 3))
|
|
54
54
|
end
|
|
55
55
|
|
|
56
56
|
def file
|
|
@@ -37,7 +37,7 @@ class Sharder
|
|
|
37
37
|
databases[shard]
|
|
38
38
|
else
|
|
39
39
|
database = databases[shard] ||= begin
|
|
40
|
-
path = File.join(persistence_path, 'shard-'
|
|
40
|
+
path = File.join(persistence_path, 'shard-' + shard.to_s)
|
|
41
41
|
(writable or File.exist?(path)) ? Persist.open_database(path, (File.exist?(path) ? false : writable), :clean, db_type, @persist_options) : nil
|
|
42
42
|
end
|
|
43
43
|
Log.warn "Database #{ path } missing" if database.nil?
|
data/lib/scout/persist/tsv.rb
CHANGED
data/lib/scout/semaphore.rb
CHANGED
|
@@ -75,7 +75,7 @@ if continue
|
|
|
75
75
|
|
|
76
76
|
def self.with_semaphore(size, file = nil)
|
|
77
77
|
if file.nil?
|
|
78
|
-
file = "/scout-"
|
|
78
|
+
file = "/scout-" + Misc.digest(rand(100000000000).to_s)[0..10] if file.nil?
|
|
79
79
|
else
|
|
80
80
|
file = file.gsub('/', '_') if file
|
|
81
81
|
end
|
data/lib/scout/tsv/dumper.rb
CHANGED
|
@@ -16,7 +16,7 @@ module TSV
|
|
|
16
16
|
if String === preamble
|
|
17
17
|
preamble_str = preamble
|
|
18
18
|
elsif preamble && options.values.compact.any?
|
|
19
|
-
preamble_str = "#: "
|
|
19
|
+
preamble_str = "#: " + IndiferentHash.hash2string(options.merge(serializer: nil))
|
|
20
20
|
else
|
|
21
21
|
preamble_str = nil
|
|
22
22
|
end
|
|
@@ -81,7 +81,7 @@ module TSV
|
|
|
81
81
|
header = Dumper.header(@options.merge(type: @type, sep: @sep, preamble: preamble))
|
|
82
82
|
@mutex.synchronize do
|
|
83
83
|
@initialized = true
|
|
84
|
-
@sin << header
|
|
84
|
+
@sin << header + "\n" if header and ! header.empty?
|
|
85
85
|
end
|
|
86
86
|
end
|
|
87
87
|
|
|
@@ -134,7 +134,7 @@ module TSV
|
|
|
134
134
|
end
|
|
135
135
|
|
|
136
136
|
def fingerprint
|
|
137
|
-
"Dumper:{"
|
|
137
|
+
"Dumper:{" + Log.fingerprint(self.all_fields|| []) << "}"
|
|
138
138
|
end
|
|
139
139
|
|
|
140
140
|
def digest_str
|
data/lib/scout/tsv/open.rb
CHANGED
data/lib/scout/tsv/parser.rb
CHANGED
data/lib/scout/tsv/util.rb
CHANGED
|
@@ -165,11 +165,11 @@ Example:
|
|
|
165
165
|
end
|
|
166
166
|
|
|
167
167
|
def fingerprint
|
|
168
|
-
"TSV:{"
|
|
168
|
+
"TSV:{" + Log.fingerprint(self.all_fields|| []) << ";" << Log.fingerprint(self.keys) << "}"
|
|
169
169
|
end
|
|
170
170
|
|
|
171
171
|
def digest_str
|
|
172
|
-
"TSV:{"
|
|
172
|
+
"TSV:{" + Log.fingerprint(self.all_fields|| []) << ";" << Log.fingerprint(self.keys) << ";" << Log.fingerprint(self.values) << "}"
|
|
173
173
|
end
|
|
174
174
|
|
|
175
175
|
def inspect
|
|
@@ -9,7 +9,7 @@ class WorkQueue
|
|
|
9
9
|
|
|
10
10
|
@serializer = serializer || Marshal
|
|
11
11
|
|
|
12
|
-
@key = "/"
|
|
12
|
+
@key = "/" + rand(1000000000).to_s << '.' << Process.pid.to_s;
|
|
13
13
|
@write_sem = @key + '.in'
|
|
14
14
|
@read_sem = @key + '.out'
|
|
15
15
|
Log.debug "Creating socket semaphores: #{@key}"
|
|
@@ -27,9 +27,9 @@ class WorkQueue
|
|
|
27
27
|
run do
|
|
28
28
|
begin
|
|
29
29
|
if output
|
|
30
|
-
Open.purge_pipes(output.swrite)
|
|
30
|
+
Open.purge_pipes(input.sread, output.swrite)
|
|
31
31
|
else
|
|
32
|
-
Open.purge_pipes
|
|
32
|
+
Open.purge_pipes(input.sread)
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
while obj = input.read
|
|
@@ -43,9 +43,11 @@ class WorkQueue
|
|
|
43
43
|
rescue DoneProcessing
|
|
44
44
|
rescue Interrupt
|
|
45
45
|
rescue Exception
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
begin
|
|
47
|
+
output.write WorkerException.new($!, Process.pid)
|
|
48
|
+
ensure
|
|
49
|
+
exit -1
|
|
50
|
+
end
|
|
49
51
|
end
|
|
50
52
|
exit 0
|
|
51
53
|
end
|
|
@@ -71,10 +71,31 @@ module EntityWorkflow
|
|
|
71
71
|
end
|
|
72
72
|
|
|
73
73
|
property_name = task_name.to_s.sub(/^(#{entity_name}_list|#{entity_name}|list)_/, '')
|
|
74
|
+
property_job_name = property_name + '_job'
|
|
75
|
+
|
|
76
|
+
property property_job_name => property_type do |*args|
|
|
77
|
+
job(task_name, *args)
|
|
78
|
+
end
|
|
79
|
+
|
|
74
80
|
property property_name => property_type do |*args|
|
|
75
|
-
job =
|
|
81
|
+
job = self.send(property_job_name)
|
|
82
|
+
|
|
83
|
+
job.join if job.running?
|
|
84
|
+
|
|
85
|
+
if job.error?
|
|
86
|
+
if job.recoverable_error?
|
|
87
|
+
job.clean
|
|
88
|
+
else
|
|
89
|
+
raise job.exception
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
job.run unless job.done?
|
|
94
|
+
|
|
95
|
+
job.load
|
|
76
96
|
Array === job ? job.collect(&:run) : job.run
|
|
77
97
|
end
|
|
98
|
+
|
|
78
99
|
end
|
|
79
100
|
|
|
80
101
|
def entity_task(task_name, *args, &block)
|
|
@@ -8,10 +8,10 @@ class Step
|
|
|
8
8
|
new_tokens = []
|
|
9
9
|
if workflow
|
|
10
10
|
workflow_name = workflow.name
|
|
11
|
-
new_tokens << ("workflow:"
|
|
12
|
-
new_tokens << ("task:"
|
|
11
|
+
new_tokens << ("workflow:" + workflow_name)
|
|
12
|
+
new_tokens << ("task:" + workflow_name << "#" << task_name.to_s)
|
|
13
13
|
end
|
|
14
|
-
new_tokens << ("task:"
|
|
14
|
+
new_tokens << ("task:" + task_name.to_s)
|
|
15
15
|
|
|
16
16
|
Scout::Config.get(key, tokens + new_tokens, options)
|
|
17
17
|
end
|
|
@@ -120,7 +120,7 @@ class Step
|
|
|
120
120
|
if info.include?(key)
|
|
121
121
|
case info[key]
|
|
122
122
|
when Array
|
|
123
|
-
info[key].concat
|
|
123
|
+
info[key].concat(Array === value ? value : [value])
|
|
124
124
|
when Hash
|
|
125
125
|
info[key].merge! value
|
|
126
126
|
else
|
|
@@ -201,7 +201,13 @@ class Step
|
|
|
201
201
|
end
|
|
202
202
|
|
|
203
203
|
def exception
|
|
204
|
-
info[:exception]
|
|
204
|
+
return nil unless info[:exception]
|
|
205
|
+
begin
|
|
206
|
+
Marshal.load(Base64.decode64(info[:exception]))
|
|
207
|
+
rescue
|
|
208
|
+
Log.exception $!
|
|
209
|
+
nil
|
|
210
|
+
end
|
|
205
211
|
end
|
|
206
212
|
|
|
207
213
|
# Marshal Step
|
data/lib/scout/workflow/step.rb
CHANGED
|
@@ -16,7 +16,7 @@ require_relative 'step/archive'
|
|
|
16
16
|
class Step
|
|
17
17
|
|
|
18
18
|
attr_accessor :path, :inputs, :dependencies, :id, :task, :tee_copies, :non_default_inputs, :provided_inputs, :compute, :overriden_task, :overriden_workflow, :workflow, :exec_context, :overriden
|
|
19
|
-
def initialize(path = nil, inputs = nil, dependencies = nil, id = nil, non_default_inputs = nil, provided_inputs = nil, compute = nil, exec_context
|
|
19
|
+
def initialize(path = nil, inputs = nil, dependencies = nil, id = nil, non_default_inputs = nil, provided_inputs = nil, compute = nil, exec_context: nil, &task)
|
|
20
20
|
@path = path
|
|
21
21
|
@inputs = inputs
|
|
22
22
|
@dependencies = dependencies
|
|
@@ -112,17 +112,22 @@ class Step
|
|
|
112
112
|
|
|
113
113
|
def exec
|
|
114
114
|
|
|
115
|
-
if inputs
|
|
115
|
+
if inputs
|
|
116
116
|
if Task === task
|
|
117
117
|
types = task.inputs.collect{|name,type| type }
|
|
118
|
-
new_inputs = inputs.zip(types).collect{|input,info|
|
|
118
|
+
new_inputs = inputs.zip(types).collect{|input,info|
|
|
119
119
|
type, desc, default, options = info
|
|
120
120
|
next input unless Step === input
|
|
121
121
|
input.join if input.streaming?
|
|
122
122
|
Task.format_input(input.join.path, type, options)
|
|
123
123
|
}
|
|
124
124
|
else
|
|
125
|
-
|
|
125
|
+
if Hash === inputs
|
|
126
|
+
new_inputs = inputs.values
|
|
127
|
+
else
|
|
128
|
+
new_inputs = inputs
|
|
129
|
+
end
|
|
130
|
+
new_inputs = new_inputs.collect{|input|
|
|
126
131
|
Step === input ? input.load : input
|
|
127
132
|
}
|
|
128
133
|
end
|
|
@@ -218,7 +223,7 @@ class Step
|
|
|
218
223
|
|
|
219
224
|
@result
|
|
220
225
|
rescue Exception => e
|
|
221
|
-
merge_info :status => :error, :exception => e, :end => Time.now, :backtrace => e.backtrace, :message => "#{e.class}: #{e.message}"
|
|
226
|
+
merge_info :status => :error, :exception => Base64.encode64(Marshal.dump(e)), :end => Time.now, :backtrace => e.backtrace, :message => "#{e.class}: #{e.message}"
|
|
222
227
|
begin
|
|
223
228
|
abort_dependencies
|
|
224
229
|
ensure
|
|
@@ -169,7 +169,7 @@ module Task
|
|
|
169
169
|
end
|
|
170
170
|
|
|
171
171
|
def load_inputs(directory)
|
|
172
|
-
if Open.exists?(directory) && ! Open.directory?(directory)
|
|
172
|
+
if Open.exists?(directory) && ! Open.directory?(directory) && ! Open.size(directory) == 0
|
|
173
173
|
TmpFile.with_file do |tmp_directory|
|
|
174
174
|
Misc.in_dir tmp_directory do
|
|
175
175
|
CMD.cmd("tar xvfz '#{directory}'")
|
data/lib/scout/workflow/usage.rb
CHANGED
|
@@ -35,6 +35,7 @@ module Task
|
|
|
35
35
|
str.puts SOPT.input_array_doc(inputs)
|
|
36
36
|
|
|
37
37
|
inputs.select{|name,type, _| type == :select }.each do |name,_,_,_,options|
|
|
38
|
+
next unless options
|
|
38
39
|
selects << [name, options[:select_options]] if options[:select_options]
|
|
39
40
|
end
|
|
40
41
|
end
|
|
@@ -194,9 +195,9 @@ module Workflow
|
|
|
194
195
|
if child
|
|
195
196
|
#·description << "->" << task_name.to_s
|
|
196
197
|
elsif first
|
|
197
|
-
description
|
|
198
|
+
description += "" + task_name.to_s
|
|
198
199
|
else
|
|
199
|
-
description
|
|
200
|
+
description += ";" + task_name.to_s
|
|
200
201
|
end
|
|
201
202
|
|
|
202
203
|
seen << [workflow, task_name]
|
data/lib/scout/workflow/util.rb
CHANGED
|
@@ -16,5 +16,27 @@ module Workflow
|
|
|
16
16
|
name = name.to_sym
|
|
17
17
|
dependencies.select{|dep| dep.task_name.to_sym == name }
|
|
18
18
|
end
|
|
19
|
+
|
|
20
|
+
def all_tasks
|
|
21
|
+
tasks.keys
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def self.list
|
|
25
|
+
Path.setup('workflows').glob('*').collect{|p| p.basename }
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def task_jobs_files(task_name)
|
|
29
|
+
self.directory[task_name].glob("**").
|
|
30
|
+
collect{|f| %w(info files).include?(f.get_extension) ? f.unset_extension : f }.
|
|
31
|
+
uniq
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def task_jobs(task_name)
|
|
35
|
+
task_jobs_files(task_name).collect{|f| Step.load f }
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def load_job(task_name, name)
|
|
39
|
+
Step.new self.directory[task_name][name]
|
|
40
|
+
end
|
|
19
41
|
end
|
|
20
42
|
|
data/scout-gear.gemspec
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
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.9.0 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.9.0".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]
|
|
@@ -17,6 +17,7 @@ Gem::Specification.new do |s|
|
|
|
17
17
|
s.executables = ["scout".freeze]
|
|
18
18
|
s.extra_rdoc_files = [
|
|
19
19
|
"LICENSE.txt",
|
|
20
|
+
"README.md",
|
|
20
21
|
"README.rdoc"
|
|
21
22
|
]
|
|
22
23
|
s.files = [
|
|
@@ -24,12 +25,19 @@ Gem::Specification.new do |s|
|
|
|
24
25
|
".gitmodules",
|
|
25
26
|
".vimproject",
|
|
26
27
|
"LICENSE.txt",
|
|
28
|
+
"README.md",
|
|
27
29
|
"README.rdoc",
|
|
28
30
|
"Rakefile",
|
|
29
31
|
"VERSION",
|
|
30
32
|
"bin/scout",
|
|
31
|
-
"doc/
|
|
32
|
-
"doc/
|
|
33
|
+
"doc/Association.md",
|
|
34
|
+
"doc/Entity.md",
|
|
35
|
+
"doc/KnowledgeBase.md",
|
|
36
|
+
"doc/Persist.md",
|
|
37
|
+
"doc/Semaphore.md",
|
|
38
|
+
"doc/TSV.md",
|
|
39
|
+
"doc/WorkQueue.md",
|
|
40
|
+
"doc/Workflow.md",
|
|
33
41
|
"lib/scout-gear.rb",
|
|
34
42
|
"lib/scout.rb",
|
|
35
43
|
"lib/scout/association.rb",
|
|
@@ -130,7 +138,9 @@ Gem::Specification.new do |s|
|
|
|
130
138
|
"scout_commands/alias",
|
|
131
139
|
"scout_commands/batch/clean",
|
|
132
140
|
"scout_commands/batch/list",
|
|
141
|
+
"scout_commands/cat",
|
|
133
142
|
"scout_commands/doc",
|
|
143
|
+
"scout_commands/entity",
|
|
134
144
|
"scout_commands/find",
|
|
135
145
|
"scout_commands/glob",
|
|
136
146
|
"scout_commands/kb/config",
|
|
@@ -145,6 +155,7 @@ Gem::Specification.new do |s|
|
|
|
145
155
|
"scout_commands/resource/produce",
|
|
146
156
|
"scout_commands/resource/sync",
|
|
147
157
|
"scout_commands/system/clean",
|
|
158
|
+
"scout_commands/system/status",
|
|
148
159
|
"scout_commands/template",
|
|
149
160
|
"scout_commands/update",
|
|
150
161
|
"scout_commands/workflow/cmd",
|
|
@@ -252,7 +263,7 @@ Gem::Specification.new do |s|
|
|
|
252
263
|
]
|
|
253
264
|
s.homepage = "http://github.com/mikisvaz/scout-gear".freeze
|
|
254
265
|
s.licenses = ["MIT".freeze]
|
|
255
|
-
s.rubygems_version = "3.
|
|
266
|
+
s.rubygems_version = "3.7.0.dev".freeze
|
|
256
267
|
s.summary = "basic gear for scouts".freeze
|
|
257
268
|
|
|
258
269
|
s.specification_version = 4
|
data/scout_commands/cat
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require 'scout-gear'
|
|
4
|
+
|
|
5
|
+
$0 = "scout #{$previous_commands.any? ? $previous_commands*" " + " " : "" }#{ File.basename(__FILE__) }" if $previous_commands
|
|
6
|
+
|
|
7
|
+
options = SOPT.setup <<EOF
|
|
8
|
+
|
|
9
|
+
Cat a file
|
|
10
|
+
|
|
11
|
+
$ #{$0} [<options>] (<resource> <path>|<path>)
|
|
12
|
+
|
|
13
|
+
-h--help Print this help
|
|
14
|
+
-r--requires* Files to require; 'all' for all in Scout.etc.requires
|
|
15
|
+
-lw--load_workflow* Files to require; 'all' for all in Scout.etc.requires
|
|
16
|
+
-w--where* Where to look for the path
|
|
17
|
+
EOF
|
|
18
|
+
if options[:help]
|
|
19
|
+
if defined? scout_usage
|
|
20
|
+
scout_usage
|
|
21
|
+
else
|
|
22
|
+
puts SOPT.doc
|
|
23
|
+
end
|
|
24
|
+
exit 0
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
resource, path = ARGV
|
|
28
|
+
path, resource = resource, nil if path.nil?
|
|
29
|
+
|
|
30
|
+
raise MissingParameterException.new(:path) if path.nil?
|
|
31
|
+
|
|
32
|
+
case options[:workflows]
|
|
33
|
+
when nil, false, "false", "none"
|
|
34
|
+
when "all"
|
|
35
|
+
Scout.etc.workflows.list.each do |workflow|
|
|
36
|
+
Workflow.require_workflow file
|
|
37
|
+
end if Scout.etc.workflows.exists?
|
|
38
|
+
else
|
|
39
|
+
options[:workflows].split(/[ ,;|]/).each do |workflow|
|
|
40
|
+
Workflow.require_workflow workflow
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
case options[:requires]
|
|
45
|
+
when nil, false, "false", "none"
|
|
46
|
+
when "all"
|
|
47
|
+
Scout.etc.requires.list.each do |file|
|
|
48
|
+
require file
|
|
49
|
+
end if Scout.etc.requires.exists?
|
|
50
|
+
else
|
|
51
|
+
options[:requires].split(/[ ,;|]/).each do |file|
|
|
52
|
+
require file
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
location = nil
|
|
57
|
+
where = options[:where]
|
|
58
|
+
all = options[:all]
|
|
59
|
+
|
|
60
|
+
begin
|
|
61
|
+
resource = Workflow.require_workflow resource
|
|
62
|
+
rescue
|
|
63
|
+
begin
|
|
64
|
+
resource = Kernel.const_get(resource)
|
|
65
|
+
rescue
|
|
66
|
+
raise "Resource not found: #{ resource }"
|
|
67
|
+
end
|
|
68
|
+
end if resource
|
|
69
|
+
|
|
70
|
+
path = (resource || Scout)[path.dup]
|
|
71
|
+
|
|
72
|
+
if where.nil? || where == 'all' || path.path_maps.include?(where.to_sym)
|
|
73
|
+
location = path.find(where)
|
|
74
|
+
|
|
75
|
+
if Array === location
|
|
76
|
+
file = location.first
|
|
77
|
+
puts location.first.read
|
|
78
|
+
puts location * "\n"
|
|
79
|
+
else
|
|
80
|
+
file = Open.exists?(location)? location : nil
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
puts file.read if file
|
|
84
|
+
else
|
|
85
|
+
raise ParameterException, "Where '#{where}' not identified. Try scout-camp if looking for a remote file"
|
|
86
|
+
end
|
data/scout_commands/doc
CHANGED
|
@@ -26,7 +26,9 @@ end
|
|
|
26
26
|
|
|
27
27
|
module_name = ARGV.first
|
|
28
28
|
if module_name.nil?
|
|
29
|
-
puts Scout.doc.lib.scout.glob("**/*.md").collect{|f|
|
|
29
|
+
puts Scout.doc.lib.scout.glob("**/*.md").collect{|f|
|
|
30
|
+
f.find.unset_extension.sub(Scout.doc.lib.scout.find + "/", '')
|
|
31
|
+
} * "\n"
|
|
30
32
|
else
|
|
31
33
|
begin
|
|
32
34
|
puts Scout.doc.lib.scout[module_name].find_with_extension('md', :lib).read
|