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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 54eb8ff011e173d9091a2945ef189097c5fc055e
4
- data.tar.gz: c68f93bf30468fdcb221c09d0c81e43d8f9a58be
3
+ metadata.gz: 38fa88f0cfbee0ae3d6cca03c6a50d9b148c2e3b
4
+ data.tar.gz: 29c84154960c9a298bb0966beaf5b37586a09636
5
5
  SHA512:
6
- metadata.gz: aa8293db93a8df5d17dc69827d6ad4f18638e6dfb0e79af33a40f26cebced6d4b682f83078df8105f512909d58f10513f292f2e1197940b25244dcbee975691a
7
- data.tar.gz: 3f2ddade13d2cb6662624c91fde4fb1223eeeeba084256c5008084867577e4ef7c04f5e628c66a98200c92c907ddb0565207a9b0f3224bf55338a55012d00b54
6
+ metadata.gz: 6fa588561652d3108036557074222f77f8ea21e88141cfd9fa6d3cfcf6a81a32f0ec068cc05fb78eb8014ec8c925daf20b04818ff9c4ba0da42117f9d6db734e
7
+ data.tar.gz: 20c5afefe133f3f49da1e3bb9b9d5f31aaa86c90fa1ef190fb6cdec31926d5366da10bd0c8959bea21c94a7aaf7cbffd77028d85ae03194ae69f76171d5da1ca
@@ -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(f)
245
- net = JobNet.new(@jobnet_ref, Location.for_file(f))
246
- foreach_edge(f) do |src, dest|
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.for_file(f)
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 = RootJobNet.load(@ctx, opts.jobnet_file)
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}"
@@ -1,4 +1,4 @@
1
1
  module Bricolage
2
2
  APPLICATION_NAME = 'Bricolage'
3
- VERSION = '5.20.5'
3
+ VERSION = '5.21.0'
4
4
  end
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../..
3
3
  specs:
4
- bricolage (5.20.5)
4
+ bricolage (5.21.0)
5
5
  aws-sdk (~> 2)
6
6
  mysql2
7
7
  pg (~> 0.18.0)
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.20.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-16 00:00:00.000000000 Z
11
+ date: 2017-01-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg