docker-spec 0.19.0 → 0.20.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/docker/spec.rb +13 -6
- data/lib/docker/spec/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ea0d7f3d6a623e089d9987a0adbd2eeff7858379c38fbec0e0dba6f0ea05607f
|
4
|
+
data.tar.gz: 92d294f339f5f9f60f2eabbaa06ecbd5e023cf2ddd4580653565938a78eaf789
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 43ec2a6a5aebc188876c74fcacdb1b9a6ecf7db0c80226cc52443c113fdf28450223049f727c13517164698aa9a9b5eccf9b03e4ba59dbc90ceeceaf68f353bb
|
7
|
+
data.tar.gz: 00c3c9bb7a291dd14dbdca5e173abd1904e7c200a0c6bb4790fb14f38a4bca8dfbe9995eec090183e687ba442fec68c42fdbec6a8b0fa70be56ea87cf1e1129d
|
data/lib/docker/spec.rb
CHANGED
@@ -74,9 +74,11 @@ class DockerSpec
|
|
74
74
|
end
|
75
75
|
|
76
76
|
# Open key value store and get the current tag for this repo
|
77
|
+
tag_prefix = @config[:tag_prefix]
|
77
78
|
store = Moneta.new(:YAML, file: File.expand_path(@config[:tag_db]))
|
78
|
-
current_tag = store.key?(@config[:image_name]) ?
|
79
|
-
|
79
|
+
current_tag = store.key?(@config[:image_name]) ?
|
80
|
+
store[@config[:image_name]].match(/#{tag_prefix}(.*)/)[1].to_i : 0
|
81
|
+
new_tag = tag_prefix + (current_tag + 1).to_s
|
80
82
|
|
81
83
|
image = Docker::Image.all.detect do |i|
|
82
84
|
i.info['RepoTags'].include?(@config[:image_name] + ':latest')
|
@@ -97,7 +99,7 @@ class DockerSpec
|
|
97
99
|
image.push nil, tag: 'latest'
|
98
100
|
|
99
101
|
# Store the new tag in the tag_db
|
100
|
-
store[@config[:image_name]] = new_tag
|
102
|
+
store[@config[:image_name]] = new_tag.to_s
|
101
103
|
store.close
|
102
104
|
end
|
103
105
|
end
|
@@ -117,6 +119,7 @@ class DockerSpec
|
|
117
119
|
@config[:clear_cache] = get_config(:clear_cache, 'DOCKER_SPEC_CLEAR_CACHE',
|
118
120
|
'Clear docker cache? ') if @config[:build_image]
|
119
121
|
@config[:tag_db] = get_config(:tag_db, 'DOCKER_SPEC_TAG_DB', 'tag db?')
|
122
|
+
@config[:tag_prefix] = get_config(:tag_prefix, 'DOCKER_SPEC_TAG_PREFIX', 'tag prefix?', '')
|
120
123
|
@config
|
121
124
|
end
|
122
125
|
|
@@ -227,10 +230,14 @@ EOF
|
|
227
230
|
end
|
228
231
|
end
|
229
232
|
|
230
|
-
def get_config(key, envvar, question)
|
231
|
-
value =
|
233
|
+
def get_config(key, envvar, question, default = nil)
|
234
|
+
value = ENV[envvar]
|
235
|
+
value = true if value.class == String && value.match(/^(true|yes|y)$/i)
|
236
|
+
value = false if value.class == String && value.match(/^(false|no|n)$/i)
|
232
237
|
value = @config[key] if value.nil?
|
233
|
-
|
238
|
+
if value.nil?
|
239
|
+
value = default.nil? ? agree(question, 'n') : default
|
240
|
+
end
|
234
241
|
value
|
235
242
|
end
|
236
243
|
|
data/lib/docker/spec/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: docker-spec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.20.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juan Breinlinger
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-11-
|
11
|
+
date: 2018-11-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|