bricolage 5.20.5 → 5.21.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bricolage/jobnet.rb +38 -4
- data/lib/bricolage/jobnetrunner.rb +6 -1
- data/lib/bricolage/version.rb +1 -1
- data/test/home/Gemfile.lock +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 38fa88f0cfbee0ae3d6cca03c6a50d9b148c2e3b
|
4
|
+
data.tar.gz: 29c84154960c9a298bb0966beaf5b37586a09636
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6fa588561652d3108036557074222f77f8ea21e88141cfd9fa6d3cfcf6a81a32f0ec068cc05fb78eb8014ec8c925daf20b04818ff9c4ba0da42117f9d6db734e
|
7
|
+
data.tar.gz: 20c5afefe133f3f49da1e3bb9b9d5f31aaa86c90fa1ef190fb6cdec31926d5366da10bd0c8959bea21c94a7aaf7cbffd77028d85ae03194ae69f76171d5da1ca
|
data/lib/bricolage/jobnet.rb
CHANGED
@@ -12,6 +12,13 @@ module Bricolage
|
|
12
12
|
root
|
13
13
|
end
|
14
14
|
|
15
|
+
def RootJobNet.load_single_job(ctx, path)
|
16
|
+
root = new(JobNet::FileLoader.new(ctx), JobNet.load_single_job(path))
|
17
|
+
root.load_recursive
|
18
|
+
root.fix
|
19
|
+
root
|
20
|
+
end
|
21
|
+
|
15
22
|
def initialize(jobnet_loader, start_jobnet)
|
16
23
|
@jobnet_loader = jobnet_loader
|
17
24
|
@start_jobnet = start_jobnet
|
@@ -140,6 +147,12 @@ module Bricolage
|
|
140
147
|
raise ParameterError, "could not load jobnet: #{path} (#{err.message})"
|
141
148
|
end
|
142
149
|
|
150
|
+
def JobNet.load_single_job(path, ref = JobNetRef.for_job_path(path))
|
151
|
+
jobnet_script = ref.name.to_s
|
152
|
+
script_io = StringIO.new(jobnet_script)
|
153
|
+
Parser.new(ref).parse_stream(script_io)
|
154
|
+
end
|
155
|
+
|
143
156
|
def initialize(ref, location)
|
144
157
|
@ref = ref
|
145
158
|
@location = location
|
@@ -241,9 +254,9 @@ module Bricolage
|
|
241
254
|
@jobnet_ref = jobnet_ref
|
242
255
|
end
|
243
256
|
|
244
|
-
def parse_stream(
|
245
|
-
net = JobNet.new(@jobnet_ref, Location.
|
246
|
-
foreach_edge(
|
257
|
+
def parse_stream(io)
|
258
|
+
net = JobNet.new(@jobnet_ref, Location.for_io(io))
|
259
|
+
foreach_edge(io) do |src, dest|
|
247
260
|
net.add_edge src, dest
|
248
261
|
end
|
249
262
|
net
|
@@ -261,7 +274,7 @@ module Bricolage
|
|
261
274
|
f.each do |line|
|
262
275
|
text = line.sub(/\#.*/, '').strip
|
263
276
|
next if text.empty?
|
264
|
-
loc = Location.
|
277
|
+
loc = Location.for_io(f)
|
265
278
|
|
266
279
|
if m = DEPEND_PATTERN.match(text)
|
267
280
|
src = (m[1] ? ref(m[1], loc) : default_src) or
|
@@ -343,6 +356,15 @@ module Bricolage
|
|
343
356
|
new(path.parent.basename, path.basename('.jobnet'), Location.dummy)
|
344
357
|
end
|
345
358
|
|
359
|
+
def JobNetRef.for_job_path(path)
|
360
|
+
basename = path
|
361
|
+
# remove all extnames
|
362
|
+
until (ext = basename.extname).empty?
|
363
|
+
basename = basename.basename(ext)
|
364
|
+
end
|
365
|
+
new(path.parent.basename, basename, Location.dummy)
|
366
|
+
end
|
367
|
+
|
346
368
|
def initialize(subsys, name, location)
|
347
369
|
super
|
348
370
|
@jobnet = nil
|
@@ -391,6 +413,18 @@ module Bricolage
|
|
391
413
|
new(f.path, f.lineno)
|
392
414
|
end
|
393
415
|
|
416
|
+
def Location.for_non_file(io)
|
417
|
+
new(io.inspect, io.lineno)
|
418
|
+
end
|
419
|
+
|
420
|
+
def Location.for_io(io)
|
421
|
+
if io.respond_to?(:path)
|
422
|
+
for_file(io)
|
423
|
+
else
|
424
|
+
for_non_file(io)
|
425
|
+
end
|
426
|
+
end
|
427
|
+
|
394
428
|
def initialize(file, lineno)
|
395
429
|
@file = file
|
396
430
|
@lineno = lineno
|
@@ -39,7 +39,12 @@ module Bricolage
|
|
39
39
|
@ctx = Context.for_application(nil, opts.jobnet_file, environment: opts.environment, global_variables: opts.global_variables)
|
40
40
|
@jobnet_id = "#{opts.jobnet_file.dirname.basename}/#{opts.jobnet_file.basename('.jobnet')}"
|
41
41
|
@log_path = opts.log_path
|
42
|
-
jobnet =
|
42
|
+
jobnet =
|
43
|
+
if opts.jobnet_file.extname == '.job'
|
44
|
+
RootJobNet.load_single_job(@ctx, opts.jobnet_file)
|
45
|
+
else
|
46
|
+
RootJobNet.load(@ctx, opts.jobnet_file)
|
47
|
+
end
|
43
48
|
queue = get_queue(opts)
|
44
49
|
if queue.locked?
|
45
50
|
raise ParameterError, "Job queue is still locked. If you are sure to restart jobnet, #{queue.unlock_help}"
|
data/lib/bricolage/version.rb
CHANGED
data/test/home/Gemfile.lock
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bricolage
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: 5.21.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Minero Aoki
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-01-
|
11
|
+
date: 2017-01-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pg
|