kucodiff 0.0.1 → 0.1.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: da8aef200dbbf8a83f7772181b035549cc929450
4
- data.tar.gz: 529ad277ad8cc3dcfcdc4c433d62df20faa19c25
3
+ metadata.gz: b2f57c5081372a36536d6a42ac6909ec0427b9a8
4
+ data.tar.gz: fc50d9e152b1101dca1f2b1eeb442a3eebc71480
5
5
  SHA512:
6
- metadata.gz: 70500ca39f992dfa03d986c9c9aa4ec01b9c3dda9fac3be0284b7c1943f12b966db39a4f19e9cce560c0b1f72e321ae5203304f817cffcc72fc8c07e280111c0
7
- data.tar.gz: bd7581ffeec22db708ec87e293f8331746b202744f3b27afea5c151977a065b9cf7d570f6a9be10640bdb47090e3c8b6eee66b993e75f36c59eb9d4f027a2218
6
+ metadata.gz: d60be03e647ef4f460b77227ea92f09d4c29524f090ca991d3ffc6468a4201931845492ef19d718ef7ac794b7304493aaa9ae84bea815ea3d51cd624296d638d
7
+ data.tar.gz: 657a4fe62f2cb54695483a311ff325e3ba0430fd9f3034f202c132dbcb1d45a48096bfcff2317a032439377ea24e0e15cca3de19a118e6c154c1d0c4b59cf93b
data/lib/kucodiff.rb CHANGED
@@ -29,12 +29,14 @@ module Kucodiff
29
29
  else raise ArgumentError, "unknown file format in #{file}"
30
30
  end.first
31
31
 
32
- hashify_container_env(content)
32
+ hashify_container_env!(content)
33
+ hashify_required_env!(content)
34
+
33
35
  flat_hash(content)
34
36
  end
35
37
 
36
- # make env compareable
37
- def hashify_container_env(content)
38
+ # make env comparable
39
+ def hashify_container_env!(content)
38
40
  containers = content.fetch('spec', {}).fetch('template', {}).fetch('spec', {}).fetch('containers', [])
39
41
  containers.each do |container|
40
42
  next unless container['env']
@@ -45,6 +47,12 @@ module Kucodiff
45
47
  end
46
48
  end
47
49
 
50
+ def hashify_required_env!(content)
51
+ key = 'required_env'
52
+ annotations = content.fetch('spec', {}).fetch('template', {}).fetch('metadata', {}).fetch('annotations', {})
53
+ annotations[key] = Hash[annotations[key].strip.split(/[\s,]/).map { |k| [k, true] }] if annotations[key]
54
+ end
55
+
48
56
  def different_keys(a, b)
49
57
  (a.keys + b.keys).uniq.select { |k| a[k] != b[k] }
50
58
  end
@@ -1,3 +1,3 @@
1
1
  module Kucodiff
2
- VERSION = "0.0.1"
2
+ VERSION = "0.1.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kucodiff
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Grosser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-13 00:00:00.000000000 Z
11
+ date: 2017-03-20 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: michael@grosser.it