bricolage 5.28.1 → 5.29.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/RELEASE.md +4 -0
- data/lib/bricolage/jobnet.rb +46 -14
- data/lib/bricolage/jobnetrunner.rb +6 -6
- data/lib/bricolage/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 937a773a3be70440b08a33edea44480af5b5b4e9857081e5e9dfafeff7298cf0
|
4
|
+
data.tar.gz: 373f091f9ce32ade9862e6c9d114c0ed760166a050ba67b3fa25d29fa42183b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 338d2113c8fc175a15f57fcaae506f83da82c60179bdbcf828fb68da45545f2988afec5eed0a70a79292030d93cb97d68862da2e716f6c409f80eb1cf1d0874f
|
7
|
+
data.tar.gz: afa065e5b744ae159a018a050a9e2bb693fce818bc799e85c762b42291597ab96e64223d8569d0c17559ed96e16fe8771b342f2b632f490a43e93e902dcd58aa
|
data/RELEASE.md
CHANGED
data/lib/bricolage/jobnet.rb
CHANGED
@@ -5,11 +5,12 @@ module Bricolage
|
|
5
5
|
|
6
6
|
# Represents "first" jobnet given by command line (e.g. bricolage-jobnet some.jobnet)
|
7
7
|
class RootJobNet
|
8
|
-
def RootJobNet.load_auto(ctx,
|
9
|
-
|
10
|
-
|
8
|
+
def RootJobNet.load_auto(ctx, pathes)
|
9
|
+
pathes = Array(pathes)
|
10
|
+
if pathes.size == 1 and pathes.first.extname == '.jobnet'
|
11
|
+
load(ctx, pathes.first)
|
11
12
|
else
|
12
|
-
|
13
|
+
load_multiple_jobs(ctx, pathes)
|
13
14
|
end
|
14
15
|
end
|
15
16
|
|
@@ -21,7 +22,11 @@ module Bricolage
|
|
21
22
|
end
|
22
23
|
|
23
24
|
def RootJobNet.load_single_job(ctx, path)
|
24
|
-
|
25
|
+
load_multiple_jobs(ctx, [path])
|
26
|
+
end
|
27
|
+
|
28
|
+
def RootJobNet.load_multiple_jobs(ctx, pathes)
|
29
|
+
root = new(JobNet::FileLoader.new(ctx), JobNet.load_multiple_jobs(pathes), pathes.first)
|
25
30
|
root.load_recursive
|
26
31
|
root.fix
|
27
32
|
root
|
@@ -166,9 +171,28 @@ module Bricolage
|
|
166
171
|
end
|
167
172
|
|
168
173
|
def JobNet.load_single_job(path, ref = JobNetRef.for_job_path(path))
|
169
|
-
|
170
|
-
|
171
|
-
|
174
|
+
load_multiple_jobs([path], ref)
|
175
|
+
end
|
176
|
+
|
177
|
+
def JobNet.load_multiple_jobs(pathes, ref = JobNetRef.for_job_path(pathes.first))
|
178
|
+
jobnet_script = StringIO.new
|
179
|
+
prev = nil
|
180
|
+
pathes.each do |path|
|
181
|
+
jobnet_script.print '-> ' if prev
|
182
|
+
case path.extname
|
183
|
+
when '.job'
|
184
|
+
r = JobRef.for_path(path)
|
185
|
+
jobnet_script.puts r.to_s
|
186
|
+
when '.jobnet'
|
187
|
+
r = JobNetRef.for_job_path(path)
|
188
|
+
jobnet_script.puts r.to_s
|
189
|
+
else
|
190
|
+
raise ParameterError, "is not a job nor a jobnet: #{path}"
|
191
|
+
end
|
192
|
+
prev = r
|
193
|
+
end
|
194
|
+
jobnet_script.rewind
|
195
|
+
Parser.new(ref).parse_stream(jobnet_script)
|
172
196
|
end
|
173
197
|
|
174
198
|
def initialize(ref, location)
|
@@ -364,6 +388,19 @@ module Bricolage
|
|
364
388
|
end
|
365
389
|
|
366
390
|
class JobRef < Ref
|
391
|
+
def JobRef.for_path(path)
|
392
|
+
new(path.parent.basename, JobRef.strip_exts(path), Location.dummy)
|
393
|
+
end
|
394
|
+
|
395
|
+
def JobRef.strip_exts(path)
|
396
|
+
basename = path
|
397
|
+
# remove all extnames
|
398
|
+
until (ext = basename.extname).empty?
|
399
|
+
basename = basename.basename(ext)
|
400
|
+
end
|
401
|
+
basename
|
402
|
+
end
|
403
|
+
|
367
404
|
def net?
|
368
405
|
false
|
369
406
|
end
|
@@ -375,12 +412,7 @@ module Bricolage
|
|
375
412
|
end
|
376
413
|
|
377
414
|
def JobNetRef.for_job_path(path)
|
378
|
-
basename
|
379
|
-
# remove all extnames
|
380
|
-
until (ext = basename.extname).empty?
|
381
|
-
basename = basename.basename(ext)
|
382
|
-
end
|
383
|
-
new(path.parent.basename, basename, Location.dummy)
|
415
|
+
new(path.parent.basename, JobRef.strip_exts(path), Location.dummy)
|
384
416
|
end
|
385
417
|
|
386
418
|
def initialize(subsys, name, location)
|
@@ -39,15 +39,15 @@ module Bricolage
|
|
39
39
|
@hooks.run_before_option_parsing_hooks(opts)
|
40
40
|
opts.parse!(ARGV)
|
41
41
|
|
42
|
-
@ctx = Context.for_application(job_path: opts.
|
42
|
+
@ctx = Context.for_application(job_path: opts.jobnet_files.first, environment: opts.environment, global_variables: opts.global_variables)
|
43
43
|
opts.merge_saved_options(@ctx.load_system_options)
|
44
44
|
|
45
|
-
jobnet = RootJobNet.load_auto(@ctx, opts.
|
45
|
+
jobnet = RootJobNet.load_auto(@ctx, opts.jobnet_files)
|
46
46
|
@jobnet_id = jobnet.id
|
47
47
|
|
48
48
|
if opts.dump_options?
|
49
49
|
puts "jobnet-id=#{@jobnet_id}"
|
50
|
-
puts "jobnet-file=#{opts.
|
50
|
+
puts "jobnet-file=#{opts.jobnet_files.first}"
|
51
51
|
opts.option_pairs.each do |key, value|
|
52
52
|
puts "#{key}=#{value.inspect}"
|
53
53
|
end
|
@@ -307,15 +307,15 @@ Options:
|
|
307
307
|
def parse!(argv)
|
308
308
|
@parser.parse!(argv)
|
309
309
|
raise OptionError, "missing jobnet file" if argv.empty?
|
310
|
-
|
311
|
-
@jobnet_file = Pathname(argv.first)
|
310
|
+
@jobnet_files = argv.map {|path| Pathname(path) }
|
312
311
|
build_common_options!
|
313
312
|
rescue OptionParser::ParseError => ex
|
314
313
|
raise OptionError, ex.message
|
315
314
|
end
|
316
315
|
|
317
316
|
attr_reader :environment
|
318
|
-
|
317
|
+
|
318
|
+
attr_reader :jobnet_files
|
319
319
|
|
320
320
|
attr_reader :global_variables
|
321
321
|
|
data/lib/bricolage/version.rb
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.29.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: 2018-07-
|
11
|
+
date: 2018-07-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pg
|