task-orchestrator 0.0.24 → 0.0.25
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/examples/nested_loops +10 -0
- data/lib/orchestrator/task.rb +29 -0
- data/lib/orchestrator/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d429c26750c50b057de12c86cfa1f9a35d712103
|
4
|
+
data.tar.gz: ecc803f3b40cb903e9093cafc70e236ebfb89cf2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f7358c4788335a26d19a4c2c39a8a61e20abfefd6c955a3c3d94306f2c9db521f72a30a736d07b1b0a94e1f8fc0265922b46d196697ad988acad503c92ceef00
|
7
|
+
data.tar.gz: 91229f1333d4295043be212de1268c6b000acc458535d220a412f4f8f41cf65db034af13701834b4d09f8e8f0592f284869463bad221ca81392142a9448f1c70
|
data/lib/orchestrator/task.rb
CHANGED
@@ -142,6 +142,11 @@ module Orchestrator
|
|
142
142
|
invalid("interpolation type is not valid in this context - :::#{match}:::") if match !~ pattern and match =~ /^(ENV|ARG|EXEC)\./
|
143
143
|
|
144
144
|
case match
|
145
|
+
when /^LOOP\.\d$/
|
146
|
+
require 'pp'
|
147
|
+
invalid("command interpolation failed not nested loop type step") unless @nested_loop_param
|
148
|
+
i = match.match(/^LOOP\.(\d)$/)[1].to_i
|
149
|
+
@nested_loop_param[i] ? @nested_loop_param[i] : invalid("command interpolation failed unexisting nesting #{match}")
|
145
150
|
when /^LOOP$/
|
146
151
|
invalid("command interpolation failed not loop type step") unless @loop_param
|
147
152
|
@loop_param
|
@@ -238,6 +243,30 @@ module Orchestrator
|
|
238
243
|
end
|
239
244
|
step['scripts'] = scripts
|
240
245
|
step.delete('loop')
|
246
|
+
elsif step.has_key?('nested_loop')
|
247
|
+
invalid("task step nested loop is not array") unless step['nested_loop'].is_a?(Array)
|
248
|
+
step['nested_loop'].each do |loop|
|
249
|
+
invalid("task step nested loop is not array of arrays") unless loop.is_a?(Array)
|
250
|
+
end
|
251
|
+
scripts = []
|
252
|
+
loops = step['nested_loop'].inject([[]]) do |tuples, array|
|
253
|
+
tuples.inject([]) do |agg, tuple|
|
254
|
+
array.each do |x|
|
255
|
+
agg << [*tuple, x]
|
256
|
+
end
|
257
|
+
agg
|
258
|
+
end
|
259
|
+
end
|
260
|
+
loops.each do |item|
|
261
|
+
@nested_loop_param = item
|
262
|
+
step['scripts'].each_index do |index|
|
263
|
+
script = Marshal.load(Marshal.dump(step['scripts'][index]))
|
264
|
+
scripts << validate_command(script, 'task step nested loop script')
|
265
|
+
end
|
266
|
+
@nested_loop_param = nil
|
267
|
+
end
|
268
|
+
step['scripts'] = scripts
|
269
|
+
step.delete('nested_loop')
|
241
270
|
else
|
242
271
|
step['scripts'].each_index do |index|
|
243
272
|
step['scripts'][index] = validate_command(step['scripts'][index], 'task step script')
|
data/lib/orchestrator/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: task-orchestrator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.25
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Piavlo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-07-
|
11
|
+
date: 2015-07-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pony
|
@@ -84,6 +84,7 @@ files:
|
|
84
84
|
- examples/interpolation
|
85
85
|
- examples/loops
|
86
86
|
- examples/multistep
|
87
|
+
- examples/nested_loops
|
87
88
|
- examples/parallel
|
88
89
|
- examples/retry_handler
|
89
90
|
- examples/sequential
|