fig-lock 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/fig/lock.rb +12 -5
- data/lib/fig/lock/version.rb +1 -1
- data/spec/fig/lock_spec.rb +1 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fdf7b2e8a7f23e93d3ff059406fa5f9a9fdd621d
|
4
|
+
data.tar.gz: b8926d1ef7bbb4c26f4907b6d668147c33fe8485
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c51780e7a3dacd769a0e0466107a700f4f9843a9df67b23cfb99605eacef3794f66183984096f343dc6f9cc69eea329736371021a5af5bbc0122681526b8edf8
|
7
|
+
data.tar.gz: 2d472e31040f166b85d99fa5fa81bb56a527b115145250a5650aff8c7bfdf270429129b6e967f7fb4635aea6f14d84f7026af7a21ae093cf1b5abe5d95cf4230
|
data/lib/fig/lock.rb
CHANGED
@@ -70,6 +70,8 @@ module Fig
|
|
70
70
|
|
71
71
|
resolved_tags = {}
|
72
72
|
|
73
|
+
old_lock_yaml = lock_yaml
|
74
|
+
|
73
75
|
hash.each do |k,v|
|
74
76
|
image = v['image']
|
75
77
|
image = "#{image}:latest" unless image.index(':')
|
@@ -87,7 +89,6 @@ module Fig
|
|
87
89
|
|
88
90
|
# Figure out which one corresponds to "latest"
|
89
91
|
version = tags.detect{|k,v|
|
90
|
-
puts "#{k}: #{v}"
|
91
92
|
v == latest && k != 'latest'
|
92
93
|
}
|
93
94
|
version = version[0] if version
|
@@ -99,16 +100,22 @@ module Fig
|
|
99
100
|
end
|
100
101
|
|
101
102
|
# Update hash
|
102
|
-
|
103
|
-
|
103
|
+
v['image'] = result
|
104
|
+
if old_lock_yaml && old_lock_yaml[k] && old_lock_yaml[k]['image'] == result
|
105
|
+
log.debug "Component #{k} already using tag: #{result}"
|
104
106
|
else
|
105
|
-
log.info "Component #{k} updated to #{result}"
|
106
|
-
v['image'] = result
|
107
|
+
log.info "Component #{k} updated to tag: #{result}"
|
107
108
|
end
|
108
109
|
end
|
109
110
|
end
|
110
111
|
end
|
111
112
|
|
113
|
+
def lock_yaml
|
114
|
+
if File.exists?(lock_file)
|
115
|
+
YAML.load(File.read(lock_file))
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
112
119
|
# Fetch all images from the fig hash.
|
113
120
|
def fetch_images(hash)
|
114
121
|
log.info "Fetching images:"
|
data/lib/fig/lock/version.rb
CHANGED
data/spec/fig/lock_spec.rb
CHANGED
@@ -31,6 +31,7 @@ module Fig
|
|
31
31
|
context 'instance operations' do
|
32
32
|
|
33
33
|
before :each do
|
34
|
+
allow(File).to receive(:exists?).with('fig.lock'){false}
|
34
35
|
allow(File).to receive(:exists?).with('fig.yml'){true}
|
35
36
|
allow(File).to receive(:directory?).with('fig.yml'){false}
|
36
37
|
allow(File).to receive(:read).with('fig.yml'){yaml}
|