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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: afbe68e59763560e7f89ee6d7bd90441e7c2265786005ce59bfa32378e8cc239
4
- data.tar.gz: 4e1525bad69b698263dbe539154ca5da2bbb64f2617d0a5c44efbbb1d2b07b2c
3
+ metadata.gz: ea0d7f3d6a623e089d9987a0adbd2eeff7858379c38fbec0e0dba6f0ea05607f
4
+ data.tar.gz: 92d294f339f5f9f60f2eabbaa06ecbd5e023cf2ddd4580653565938a78eaf789
5
5
  SHA512:
6
- metadata.gz: 4c7b5f1a182d4c35c4b1009a97fba76ffa351cb8af0057231d1ad27a3a52ab944c2acd6b019691310bdd9ee1182ea00bd7f965831f478eb250f521ef9e01c982
7
- data.tar.gz: ef42245ba03307913c7db918f4d4ff6b735e0c7ee5fba69c84a03035a9e4560491692026dd7fe55f97dd88835670c6599b3318efc8336081fb29f84c6df60230
6
+ metadata.gz: 43ec2a6a5aebc188876c74fcacdb1b9a6ecf7db0c80226cc52443c113fdf28450223049f727c13517164698aa9a9b5eccf9b03e4ba59dbc90ceeceaf68f353bb
7
+ data.tar.gz: 00c3c9bb7a291dd14dbdca5e173abd1904e7c200a0c6bb4790fb14f38a4bca8dfbe9995eec090183e687ba442fec68c42fdbec6a8b0fa70be56ea87cf1e1129d
@@ -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]) ? store[@config[:image_name]].to_i : 0
79
- new_tag = current_tag + 1
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 = to_boolean(ENV[envvar])
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
- value = agree(question, 'n') if value.nil?
238
+ if value.nil?
239
+ value = default.nil? ? agree(question, 'n') : default
240
+ end
234
241
  value
235
242
  end
236
243
 
@@ -1,5 +1,5 @@
1
1
  module Docker
2
2
  module Spec
3
- VERSION = "0.19.0"
3
+ VERSION = "0.20.0"
4
4
  end
5
5
  end
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.19.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-08 00:00:00.000000000 Z
11
+ date: 2018-11-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler