docker_registry2 1.5.1 → 1.6.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
- SHA256:
3
- metadata.gz: b9fd72dc1fe4e4402e0ee0351b1e67836689c54fba7d9ed41a87bf4e99e4ae79
4
- data.tar.gz: a76ff1e8b07c7ef515756aaae656dcba022f4f903bb9c25c11a5546ced2fdeaf
2
+ SHA1:
3
+ metadata.gz: 81a59b8010136692df1083c6a952f8cd1daaa731
4
+ data.tar.gz: 25f140d4340f8fc8c6c90a3fb9aab39179c1433a
5
5
  SHA512:
6
- metadata.gz: b3001c73026f597029ba88318e99afaae6ac211da1a7870a700179734d8f87f8c391b6d4e2305783188e0164d3bf94b9a18ba6ecda258a2afd88a4fd3e7dae1b
7
- data.tar.gz: 000f4d72b6c74030a0c0361e8e18daaf23d81619450296a65cb2a6759abeed275c6fa84c6ca4608d9f43d2ae69ca20935d97a9601693d17dcf06a144305dd931
6
+ metadata.gz: e8d4477daf7c4aa1e03cf4101ca1f6d4e0b3841a34f925461e0af93bdacc34cdde4ee4c0968e6f6d6800f2b2164e3a0d7d6ae736e43e0eeb3d04f289c23eed73
7
+ data.tar.gz: ea63c5390cfd87e0746cc2f27acfc640602fe91bf75af982f5db2361c1a36b4ea8706e0ed4ed8da0ed3f4b1ab53a3c8777a7c47312a7925c0dd25ac0d93dfe2d
@@ -49,10 +49,21 @@ class DockerRegistry2::Registry
49
49
  return repos
50
50
  end
51
51
 
52
- def tags(repo,withHashes = false)
53
- response = doget "/v2/#{repo}/tags/list"
52
+ def tags(repo,count=100,last="",withHashes = false)
53
+ #create query params
54
+ params = []
55
+ if last != ""
56
+ params.push(["last",last])
57
+ end
58
+ params.push(["n",count])
59
+
60
+ response = doget "/v2/#{repo}/tags/list?#{URI.encode_www_form(params)}"
54
61
  # parse the response
55
62
  resp = JSON.parse response
63
+ # parse out next page link if necessary
64
+ if response.headers[:link]
65
+ resp["last"] = last(response.headers[:link])
66
+ end
56
67
  # do we include the hashes?
57
68
  if withHashes then
58
69
  useGet = false
@@ -72,8 +83,7 @@ class DockerRegistry2::Registry
72
83
  resp["hashes"][tag] = head.headers[:docker_content_digest]
73
84
  }
74
85
  end
75
-
76
- return resp
86
+ resp
77
87
  end
78
88
 
79
89
  def manifest(repo,tag)
@@ -176,6 +186,26 @@ class DockerRegistry2::Registry
176
186
  Integer(response.headers[:content_length],10)
177
187
  end
178
188
 
189
+ def last(header)
190
+ last=''
191
+ parts = header.split(',')
192
+ links = Hash.new
193
+
194
+ # Parse each part into a named link
195
+ parts.each do |part, index|
196
+ section = part.split(';')
197
+ url = section[0][/<(.*)>/,1]
198
+ name = section[1][/rel="(.*)"/,1].to_sym
199
+ links[name] = url
200
+ end
201
+
202
+ if links[:next]
203
+ query=URI(links[:next]).query
204
+ last=URI::decode_www_form(query).to_h["last"]
205
+ end
206
+ last
207
+ end
208
+
179
209
  def manifest_sum(manifest)
180
210
  size = 0
181
211
  manifest["layers"].each { |layer|
@@ -1,3 +1,3 @@
1
1
  module DockerRegistry2
2
- VERSION = '1.5.1'
2
+ VERSION = '1.6.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: docker_registry2
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.1
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Avi Deitcher https://github.com/deitch
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2019-05-30 00:00:00.000000000 Z
14
+ date: 2019-06-27 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: bundler
@@ -100,7 +100,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
100
100
  - !ruby/object:Gem::Version
101
101
  version: '0'
102
102
  requirements: []
103
- rubygems_version: 3.0.3
103
+ rubyforge_project:
104
+ rubygems_version: 2.4.8
104
105
  signing_key:
105
106
  specification_version: 4
106
107
  summary: Docker v2 registry HTTP API client