docker_registry2 1.7.1 → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ae47ed1cf54b9805c7d2759b9eef12b9ee477eeabd14c6f2800a6170491b9f3d
4
- data.tar.gz: d369345bcd4676a91a722474f8fb67298e7b5c218a563a2504e09f9908abd457
3
+ metadata.gz: 19ca637dbdf39b4614e28d2650e79da21fe23ad0996abcde2a4d93b4df6c8eb1
4
+ data.tar.gz: 9ab57fce26b7b7f1d61e00c6c4fa3b141dcdecaeb1d3a1918f3476542d29a8c0
5
5
  SHA512:
6
- metadata.gz: a8e01f26d9af9cfc231057b9a6945a7727dd4133423f3f7c14b1118bd7ba4c56449f57edcd081c11976d410195bd4bf8d419d0eb0c0b5151ab099e67139fbbf6
7
- data.tar.gz: 1ffe681ba1bbe5c06950a6829ab953e21df4cad8e730998dcd7465a1ab832666910cbe9c71a44afe158ebe0dd994e5430a1b66f0ae1e479c43341a5d41c37c30
6
+ metadata.gz: 772e70eb519763985de74098cee52c7cd7a252516dacf2e9da0f6ecfdec2e8cdcc822a80548577de15b7d73ba0bdc8edff1b9fed6a24c97c71178928840d5966
7
+ data.tar.gz: 1d92a8c1c4994440cd3884592627b537f9ddcaa0836329f1bad4262561896b9b9f67b9dcb33a5ede29bf172e0281b6a694d4575a503820ac62cb557160e1c3f1
data/README.md CHANGED
@@ -222,13 +222,13 @@ Repeat until you have all of the results. The last one has no more pagination, a
222
222
 
223
223
 
224
224
  #### manifest
225
+
225
226
  ````ruby
226
227
  manifest = reg.manifest("namespace/repo","2.5.6")
227
228
  ````
228
229
 
229
230
  Returns the manifest for the given tag of the given repository. For the format and syntax of the manifest, see the [registry API](https://github.com/docker/distribution/blob/master/docs/spec/api.md) and the [manifest issue](https://github.com/docker/docker/issues/8093).
230
231
 
231
-
232
232
  If the given repository and/or tag is not found, return an empty object `{}`.
233
233
 
234
234
  The following exceptions are thrown:
@@ -236,6 +236,13 @@ The following exceptions are thrown:
236
236
  * `RegistryAuthenticationException`: username and password are invalid
237
237
  * `RegistryAuthorizationException`: registry does not support tags using the given credentials, probably because the repository is private and the credentials provided do not have access
238
238
 
239
+ The manifest, of course, is requested via http `GET`. While the returned manifest is an object parsed from the JSON of the manifest _body_, sometimes the http _headers_ are valuable as well. Thus the returned manifest object has a method `headers`, which returns the http headers from the request.
240
+
241
+ ```ruby
242
+ manifest = reg.manifest("namespace/repo","2.5.6")
243
+ manifest.headers
244
+ ```
245
+
239
246
  #### digest
240
247
  ````ruby
241
248
  digest = reg.digest("namespace/repo", "2.5.6")
@@ -1,6 +1,7 @@
1
1
  require File.dirname(__FILE__) + '/registry/version'
2
2
  require File.dirname(__FILE__) + '/registry/registry'
3
3
  require File.dirname(__FILE__) + '/registry/exceptions'
4
+ require File.dirname(__FILE__) + '/registry/manifest'
4
5
 
5
6
 
6
7
  module DockerRegistry2
@@ -0,0 +1,9 @@
1
+ module DockerRegistry2
2
+
3
+ class Manifest < Hash
4
+ attr_accessor :body, :headers
5
+ def initialize
6
+ super
7
+ end
8
+ end
9
+ end
@@ -99,7 +99,12 @@ class DockerRegistry2::Registry
99
99
 
100
100
  def manifest(repo,tag)
101
101
  # first get the manifest
102
- JSON.parse doget "/v2/#{repo}/manifests/#{tag}"
102
+ response = doget "/v2/#{repo}/manifests/#{tag}"
103
+ parsed = JSON.parse response.body
104
+ manifest = DockerRegistry2::Manifest[parsed]
105
+ manifest.body = response.body
106
+ manifest.headers = response.headers
107
+ manifest
103
108
  end
104
109
 
105
110
  def digest(repo, tag)
@@ -1,3 +1,3 @@
1
1
  module DockerRegistry2
2
- VERSION = '1.7.1'
2
+ VERSION = '1.8.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.7.1
4
+ version: 1.8.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-07-14 00:00:00.000000000 Z
14
+ date: 2019-08-11 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: bundler
@@ -79,6 +79,7 @@ files:
79
79
  - docker_registry2.gemspec
80
80
  - lib/docker_registry2.rb
81
81
  - lib/registry/exceptions.rb
82
+ - lib/registry/manifest.rb
82
83
  - lib/registry/registry.rb
83
84
  - lib/registry/version.rb
84
85
  homepage: https://github.com/deitch/docker_registry2