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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 02cd3cdb2d65b2d74f5f1c2a59afa40cae3ee0ba439f7dad10328ce2f59327be
4
- data.tar.gz: b849c08932d338e64b6fcd815b02280ba2032488db5681ef1b9a60edb758d5a3
3
+ metadata.gz: 937a773a3be70440b08a33edea44480af5b5b4e9857081e5e9dfafeff7298cf0
4
+ data.tar.gz: 373f091f9ce32ade9862e6c9d114c0ed760166a050ba67b3fa25d29fa42183b2
5
5
  SHA512:
6
- metadata.gz: 7d1d85abad9d1a5eac78c30aa0bf8225cea5af3f8f7d2a53ae5640ef44765c023ca2dc02357d4d847be810d52be54e07742e57a1c45ee1027d7efb3a4327ea9b
7
- data.tar.gz: 9adf944eb2605b6a3c5f2980fd04c7a9a8a0493657a644e348138f424f59f22afb549fc607c716175af10306b18ad98d38477173c7238705cd902554303caeed
6
+ metadata.gz: 338d2113c8fc175a15f57fcaae506f83da82c60179bdbcf828fb68da45545f2988afec5eed0a70a79292030d93cb97d68862da2e716f6c409f80eb1cf1d0874f
7
+ data.tar.gz: afa065e5b744ae159a018a050a9e2bb693fce818bc799e85c762b42291597ab96e64223d8569d0c17559ed96e16fe8771b342f2b632f490a43e93e902dcd58aa
data/RELEASE.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Bricolage Release Note
2
2
 
3
+ ## version 5.29.0
4
+
5
+ - [new] bricolage-jobnet command accepts multiple jobs/jobnets and executes them sequencially.
6
+
3
7
  ## version 5.28.1
4
8
 
5
9
  - [new] new environment BRICOLAGE_DISABLE_QUEUE to disable jobnet queue.
@@ -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, path)
9
- if path.extname == '.job'
10
- load_single_job(ctx, path)
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
- load(ctx, path)
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
- root = new(JobNet::FileLoader.new(ctx), JobNet.load_single_job(path), path)
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
- jobnet_script = ref.name.to_s
170
- script_io = StringIO.new(jobnet_script)
171
- Parser.new(ref).parse_stream(script_io)
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 = path
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.jobnet_file, environment: opts.environment, global_variables: opts.global_variables)
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.jobnet_file)
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.jobnet_file}"
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
- raise OptionError, "too many jobnet file" if argv.size > 1
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
- attr_reader :jobnet_file
317
+
318
+ attr_reader :jobnet_files
319
319
 
320
320
  attr_reader :global_variables
321
321
 
@@ -1,4 +1,4 @@
1
1
  module Bricolage
2
2
  APPLICATION_NAME = 'Bricolage'
3
- VERSION = '5.28.1'
3
+ VERSION = '5.29.0'
4
4
  end
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.28.1
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-26 00:00:00.000000000 Z
11
+ date: 2018-07-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg