cigale 0.3.2 → 0.4.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: dc0664c5fa543dd732fc0baacff536924777d16f
4
- data.tar.gz: 4272de59a283b7acf5eb9eb46a81f9635996a018
3
+ metadata.gz: 91a22dd325a361b333838b733755dc3663760d65
4
+ data.tar.gz: f65bf376f5ec58a515e0821420f34c42d03c1c4f
5
5
  SHA512:
6
- metadata.gz: dcfbaee4f0669de1fa898f2b708f3e44dff38539155c675b329ee40c9f645b45fad776ce6035df7dc9cee2e66d7ef4b7b235bf75c769d39e0abe5c941d2ae4af
7
- data.tar.gz: 9adb4957b128324a325d9fa08054dfdab02d0f509ad83d002618fab067ca8c873dbd3babe17b3de03984212e51f8fcc42e7f0fadfee07ba8a2d5972f82bfdec5
6
+ metadata.gz: 8f6da71d58f3ee806fe0d01c0613851e8c17b80071316f65a1e1781064acb0b0665d0773771da36021148aaae78d97ce28ca7d52b1b143a07e4cf6c570e87f1f
7
+ data.tar.gz: d18187232ef50a8ac276ab3537e8d02194df1c44ada91e7a9fe9e8f9c7099f8ea0fa104a6437644532803ec224474fa1fb915aae877e64c5bce2b74b6b877c9a
data/lib/cigale/cli.rb CHANGED
@@ -117,6 +117,8 @@ module Cigale
117
117
  integrate_defs(expanded_entries, @definitions)
118
118
 
119
119
  for entry in expanded_entries
120
+ logger.info "fully expanded entry:\n#{entry.to_yaml}"
121
+
120
122
  etype, edef = first_pair(entry)
121
123
  if edef["name"].nil?
122
124
  raise "Jobs must have names: #{edef.inspect}" unless opts[:fixture]
@@ -63,9 +63,26 @@ module Cigale
63
63
  splat = true
64
64
  end
65
65
 
66
+ params = v
66
67
  mdef = lookup(mname)
67
68
 
68
- res = self.with_params(v).expand(mdef)
69
+ # cf. https://github.com/itchio/cigale/issues/3
70
+ case mdef
71
+ when Hash
72
+ if defaults = mdef.delete(:defaults)
73
+ params = defaults.merge(toh(params))
74
+ end
75
+ when Array
76
+ case first = mdef.first
77
+ when Hash
78
+ if defaults = first.delete(:defaults)
79
+ params = defaults.merge(toh(params))
80
+ mdef.shift
81
+ end
82
+ end
83
+ end
84
+
85
+ res = self.with_params(params).expand(mdef)
69
86
  case res
70
87
  when Hash
71
88
  if splat
@@ -1,3 +1,3 @@
1
1
  module Cigale
2
- VERSION = "0.3.2"
2
+ VERSION = "0.4.0"
3
3
  end
@@ -0,0 +1,6 @@
1
+ ---
2
+ job:
3
+ name: defaults
4
+ a: a
5
+ b: B
6
+ c: c
@@ -0,0 +1,13 @@
1
+ - :deploy:
2
+ :defaults:
3
+ a: a
4
+ b: b
5
+ c: c
6
+ a: "{a}"
7
+ b: "{b}"
8
+ c: "{c}"
9
+
10
+ - job:
11
+ name: "defaults"
12
+ .deploy:
13
+ b: B
@@ -0,0 +1,7 @@
1
+ ---
2
+ job:
3
+ name: defaults
4
+ list:
5
+ - a: a
6
+ - b: B
7
+ - c: c
@@ -0,0 +1,14 @@
1
+ - :deploy:
2
+ - :defaults:
3
+ a: a
4
+ b: b
5
+ c: c
6
+ - a: "{a}"
7
+ - b: "{b}"
8
+ - c: "{c}"
9
+
10
+ - job:
11
+ name: "defaults"
12
+ list:
13
+ .deploy:
14
+ b: B
@@ -0,0 +1,7 @@
1
+ ---
2
+ job:
3
+ name: defaults
4
+ list:
5
+ - a: A
6
+ - b: B
7
+ - c: C
@@ -0,0 +1,16 @@
1
+ - :deploy:
2
+ - :defaults:
3
+ a: a
4
+ b: b
5
+ c: c
6
+ - a: "{a}"
7
+ - b: "{b}"
8
+ - c: "{c}"
9
+
10
+ - job:
11
+ name: "defaults"
12
+ list:
13
+ .deploy:
14
+ a: A
15
+ b: B
16
+ c: C
@@ -0,0 +1,7 @@
1
+ ---
2
+ job:
3
+ name: defaults
4
+ list:
5
+ - a: a
6
+ - b: b
7
+ - c: c
@@ -0,0 +1,13 @@
1
+ - :deploy:
2
+ - :defaults:
3
+ a: a
4
+ b: b
5
+ c: c
6
+ - a: "{a}"
7
+ - b: "{b}"
8
+ - c: "{c}"
9
+
10
+ - job:
11
+ name: "defaults"
12
+ list:
13
+ .deploy:
data/splats.yml ADDED
@@ -0,0 +1,8 @@
1
+ ---
2
+ job:
3
+ name: splats
4
+ a: A
5
+ b: B
6
+ c: C
7
+ d: D
8
+ e: E
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cigale
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Amos Wenger
@@ -324,6 +324,14 @@ files:
324
324
  - lib/cigale/wrapper/workspace-cleanup.rb
325
325
  - lib/cigale/wrapper/xvfb.rb
326
326
  - lib/cigale/wrapper/xvnc.rb
327
+ - spec/fixtures/macros/defaults001.expanded.yml
328
+ - spec/fixtures/macros/defaults001.yml
329
+ - spec/fixtures/macros/defaults002.expanded.yml
330
+ - spec/fixtures/macros/defaults002.yml
331
+ - spec/fixtures/macros/defaults003.expanded.yml
332
+ - spec/fixtures/macros/defaults003.yml
333
+ - spec/fixtures/macros/defaults004.expanded.yml
334
+ - spec/fixtures/macros/defaults004.yml
327
335
  - spec/fixtures/macros/macro-builders001.expanded.yml
328
336
  - spec/fixtures/macros/macro-builders001.yml
329
337
  - spec/fixtures/macros/macro-builders002.expanded.yml
@@ -1303,6 +1311,7 @@ files:
1303
1311
  - spec/macro_spec.rb
1304
1312
  - spec/parity_spec.rb
1305
1313
  - spec/spec_helper.rb
1314
+ - splats.yml
1306
1315
  homepage: ''
1307
1316
  licenses:
1308
1317
  - MIT
@@ -1328,6 +1337,14 @@ signing_key:
1328
1337
  specification_version: 4
1329
1338
  summary: Jenkins job generator
1330
1339
  test_files:
1340
+ - spec/fixtures/macros/defaults001.expanded.yml
1341
+ - spec/fixtures/macros/defaults001.yml
1342
+ - spec/fixtures/macros/defaults002.expanded.yml
1343
+ - spec/fixtures/macros/defaults002.yml
1344
+ - spec/fixtures/macros/defaults003.expanded.yml
1345
+ - spec/fixtures/macros/defaults003.yml
1346
+ - spec/fixtures/macros/defaults004.expanded.yml
1347
+ - spec/fixtures/macros/defaults004.yml
1331
1348
  - spec/fixtures/macros/macro-builders001.expanded.yml
1332
1349
  - spec/fixtures/macros/macro-builders001.yml
1333
1350
  - spec/fixtures/macros/macro-builders002.expanded.yml