retag 0.1.0.73710 → 0.1.1

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: 21c93d3dc99eeea3246460f4dfa166d52eabd222e26c834fb70e01efa67a9b76
4
- data.tar.gz: df60a6f712e511f377dfdf6f9d30d9023f4c805716c2bb5ba059b788adcbc83f
3
+ metadata.gz: 91558c109a6f2bf1cc988a0bf375404ca035c229d0abd031fd52cbe084cc1d23
4
+ data.tar.gz: be5c10c2e9d85588f412b81c92fb22dfcac5117360e47c9bd20eb02d8219f992
5
5
  SHA512:
6
- metadata.gz: eb34a11116989b740c3befb0b3707df6d81bffda5712740eaa4a7fdad83f8aa7f580f280a1ecbfa82690df5331b845db0ed7462285606fe8c29e09d44209b24e
7
- data.tar.gz: e400dcf1c51a19ba40b7139e88b26dfeffc1914e7c2bdc8f851401f8c97cb1fc7fefae1330c2135869c700ee313048a0cf280cde6089b35cc6e7fb48763eaaaa
6
+ metadata.gz: 3093e65db866569cc3a28ffc09ce9b97241d6fb7c3e4793ff880e24a521b83bc4861ee172a27ef8d7e99d71c639da30fbbff7614574712bc5804525f48d5bd68
7
+ data.tar.gz: 7381e35cc1934e8a78e9a4514a8f6dd3863e3744c5f516c083ccd88255dbe2b25b4eba111f69430fc1b91d8d80e98923d19c3cb298379404f7f268555efd3419
data/lib/retag/image.rb CHANGED
@@ -10,8 +10,8 @@ module Retag
10
10
  def initialize(image, tag, suffix: nil)
11
11
  @image = image
12
12
  @tag = tag
13
- @tag = "#{tag}-#{suffix}" if suffix.present?
14
- @full = "#{image}:#{tag}"
13
+ @tag = "#{@tag}-#{suffix}" if suffix.present?
14
+ @full = "#{@image}:#{@tag}"
15
15
  end
16
16
 
17
17
  def retag!(newtag = tag)
@@ -24,13 +24,15 @@ module Retag
24
24
 
25
25
  Tempfile.create('manifest') do |file|
26
26
  manifest = JSON.parse(cmd!("curl -s -u '#{dockerauth(uri.host)}' -H 'Accept: #{content_type}' '#{uri}/v2/#{repo}/manifests/#{tag}' -o -", capture: true).strip)
27
- raise manifest unless manifest.dig('layers') || manifest.dig('config')
27
+ raise manifest.inspect unless manifest.dig('layers') || manifest.dig('config')
28
28
 
29
29
  file.write(manifest.to_json)
30
30
  file.flush
31
31
  result = cmd!("curl -s -u '#{dockerauth(uri.host)}' -H 'Content-Type: #{content_type}' -H 'Accept: #{content_type}' -X PUT --data-binary @#{file.path} '#{uri}/v2/#{repo}/manifests/#{newtag}' -o -", capture: true).strip
32
32
  raise result unless result.empty?
33
33
  end
34
+
35
+ Image.new(image, newtag)
34
36
  end
35
37
 
36
38
  def pull(img = full)
data/lib/retag/service.rb CHANGED
@@ -3,18 +3,19 @@ module Retag
3
3
 
4
4
  include Retag::Utils
5
5
 
6
- attr_reader :name, :config, :repo, :branch, :release
6
+ attr_reader :name, :config, :repo, :branch, :release, :suffix
7
7
 
8
- def initialize(name, config, release)
8
+ def initialize(name, config, release, suffix: )
9
9
  @name = name
10
10
  @config = config
11
11
  @repo = config['repo']
12
12
  @branch = config['branch']
13
13
  @release = release
14
+ @suffix = suffix
14
15
  end
15
16
 
16
17
  def images
17
- @images ||= config['images'].map{|img| Retag::Image.new(img, revision, suffix: 'stable') }
18
+ @images ||= config['images'].map{|img| Retag::Image.new(img, revision, suffix: @suffix) }
18
19
  end
19
20
 
20
21
  def pull
data/lib/retag/utils.rb CHANGED
@@ -10,7 +10,7 @@ module Retag
10
10
  tag = $cmdnum.to_s.rjust(3, '0')
11
11
  output = ''
12
12
 
13
- logger.tagged("CMD#{tag}") { logger.debug cmd }
13
+ logger.tagged("CMD#{tag}".colorize(:light_black)) { logger.debug cmd.colorize(:light_black) }
14
14
 
15
15
  code = Open3.popen3(cmd) do |stdin, stdout, stderr, thr|
16
16
  stdin.close_write
data/lib/retag/version.rb CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Retag
4
4
 
5
- VERSION = '0.1.0'
5
+ VERSION = '0.1.1'
6
6
 
7
7
  end
8
8
 
metadata CHANGED
@@ -1,11 +1,11 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: retag
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.73710
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samoilenko Yuri
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
  date: 2022-01-20 00:00:00.000000000 Z
@@ -142,6 +142,20 @@ dependencies:
142
142
  - - "~>"
143
143
  - !ruby/object:Gem::Version
144
144
  version: '6.0'
145
+ - !ruby/object:Gem::Dependency
146
+ name: colorize
147
+ requirement: !ruby/object:Gem::Requirement
148
+ requirements:
149
+ - - ">="
150
+ - !ruby/object:Gem::Version
151
+ version: '0'
152
+ type: :runtime
153
+ prerelease: false
154
+ version_requirements: !ruby/object:Gem::Requirement
155
+ requirements:
156
+ - - ">="
157
+ - !ruby/object:Gem::Version
158
+ version: '0'
145
159
  - !ruby/object:Gem::Dependency
146
160
  name: json
147
161
  requirement: !ruby/object:Gem::Requirement
@@ -219,7 +233,7 @@ licenses:
219
233
  metadata:
220
234
  homepage_uri: https://github.com/RnD-Soft/retag
221
235
  source_code_uri: https://github.com/RnD-Soft/retag
222
- post_install_message:
236
+ post_install_message:
223
237
  rdoc_options: []
224
238
  require_paths:
225
239
  - lib
@@ -234,8 +248,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
234
248
  - !ruby/object:Gem::Version
235
249
  version: '0'
236
250
  requirements: []
237
- rubygems_version: 3.0.3
238
- signing_key:
251
+ rubygems_version: 3.2.28
252
+ signing_key:
239
253
  specification_version: 4
240
254
  summary: Retag is cli to manipulate docker images in handy way
241
255
  test_files: []