build-labels 0.0.21 → 0.0.22

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: ece715acff32709330b757daf3bde7df56b686cfdb48ae95274fde1cea6c629f
4
- data.tar.gz: 92de637e65532323c3ffb810c2eb1c5c4dba08724dde1c18f593b6c97a07933b
3
+ metadata.gz: 50511bc850b411617f1d5c516593dbfe886de1d4230e76b3036c70ac9e7fa91e
4
+ data.tar.gz: 6f1d316b6941a45bd0451e17b322854172d9e1a5eb55eca39bb7039e2bcf1120
5
5
  SHA512:
6
- metadata.gz: bd5e5a24c460f2bb57f41a9206c45d99b4cf97dc2088f34ad760e287be95b611554d02fb3f6a728b2533b8f12e70da0e763464c3fb711cafea84530a15cdf2ba
7
- data.tar.gz: 0a5b06118df2116a5e76d15393a0c55ae34bddfd5ede44d4fda9c09e19d714dc346c598b23d594c6be2953cdb01d387c82ad25b12129174b935d6be3f3b66bba
6
+ metadata.gz: c3e4df0698922db01f4526405a9ce7c694a6fea149e86d4fbd90142ca6e1781cf8d2a22cb534049da6853b8fb3662cb65695c470fe099000fa4d06f15d3f30b2
7
+ data.tar.gz: 4afcd88dcf92dcf78f9c938a0902e486db8f10981f42b4a659877c4b5b2ae52f2c76ef5e3167713b48e424727424eb667ff16a640c586311f826df8438205d89
@@ -55,21 +55,23 @@ module BuildLabels
55
55
  end
56
56
  end
57
57
  def extend_compose(compose)
58
- compose['services'].transform_values! do |service|
58
+ compose['services'].each do |name, service|
59
+ service.delete_if {|k, v| !%w[image build].include? k }
59
60
  next unless service['build']
60
- service.slice!('image', 'build')
61
- service['build'] = { 'context' => service['build'] } if service['build'].is_a?(String)
61
+ if service['build'].class == String
62
+ service['build'] = { 'context' => service['build'] }
63
+ end
62
64
  service['build']['labels'] ||= []
63
- add_namespace(:dc, 'docker.service')
64
- self.dc.name = service['name']
65
+ add_namespace :dc, 'docker.service'
66
+ self.dc.name = name
65
67
 
66
68
  each_labels do |ns, values|
67
- values.each do |k, v|
69
+ values.each_pair do |k,v|
68
70
  service['build']['labels'] << "#{ns}.#{k}=#{v}" unless v.to_s.empty?
69
71
  end
70
72
  end
71
- service
72
- end.compact!
73
+ end
74
+ compose['services'].delete_if do |name, svc| ! svc.key?('build') end
73
75
 
74
76
  puts compose.to_yaml
75
77
  end
data/lib/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module BuildLabels
2
2
  class Builder
3
- VERSION = '0.0.21'
3
+ VERSION = '0.0.22'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: build-labels
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.21
4
+ version: 0.0.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - Artyom B