docker_registry2 0.7.0 → 1.0.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
  SHA1:
3
- metadata.gz: 659ecf4ef40131454d487d83c3f6592020b69f04
4
- data.tar.gz: 64c62b6dc3ac56dcd49e7290dd519a6c56ba9836
3
+ metadata.gz: 3a8e38262e00c15c3706999d7d5283a6f9b13ff0
4
+ data.tar.gz: 5fe67075919b2a2d3d70077fbc327dc0f9a5a9f0
5
5
  SHA512:
6
- metadata.gz: f436b0a221871c034a9a7fe785d00ebb24011c12e2adeec782786676f819ef61356ab0f1440b3b98f0f01e516b31e90a71532cc672a488b6e12f3f243481fdde
7
- data.tar.gz: 0e8eca4a3438bb7fda0608b7920b6b76bc2090928b81c13589adb2f1031de98d11c8c15136fb1cad6028a23987be66ecf56cd71884feed755f94c981602fb737
6
+ metadata.gz: 3d369e8f8f55e20601637fe62089db93d178a025fcf67caaf69287f808df47fe8bf062afab68c55ec17c6a7beee5352e9d1866461c80a579ea20386ef6193f53
7
+ data.tar.gz: 49861378fac8d26ccd3558206bb4f87f45322d89422ad5efcdecf6fcb55400a26bb406be65a765730830d8e70c26e77875306e73114206dc4546d40b6330cf9b
data/README.md CHANGED
@@ -66,12 +66,16 @@ The following exceptions are thrown:
66
66
  * `RegistrySSLException`: registry SSL certificate cannot be validated
67
67
 
68
68
  #### Authenticated
69
- If you wish to authenticate, pass a username and password as part of the URL.
69
+ If you wish to authenticate, pass a username and password as part of the options to `DockerRegistry.connect`.
70
70
 
71
71
  ````ruby
72
- reg = DockerRegistry2.connect("https://myuser:mypass@my.registy.corp.com")
72
+ url = "https://my.registy.corp.com"
73
+ opts = {user: "me", password: "secretstuff"}
74
+ reg = DockerRegistry2.connect(url,opts)
73
75
  ````
74
76
 
77
+ **Note:** Older versions prior to 1.0.0 _used_ to support putting the username and password in the URL. We no longer support it as it is **strongly** discouraged in RFCs. Put it in the `opts` hash.
78
+
75
79
  The following exceptions are thrown:
76
80
 
77
81
  * `RegistryAuthenticationException`: username/password combination is invalid
@@ -4,8 +4,8 @@ require File.dirname(__FILE__) + '/registry/exceptions'
4
4
 
5
5
 
6
6
  module DockerRegistry2
7
- def self.connect(uri="https://registry.hub.docker.com")
8
- @reg = DockerRegistry2::Registry.new(uri)
7
+ def self.connect(uri="https://registry.hub.docker.com",opts={})
8
+ @reg = DockerRegistry2::Registry.new(uri,opts)
9
9
  end
10
10
 
11
11
  def self.search(query = '')
@@ -10,8 +10,8 @@ class DockerRegistry2::Registry
10
10
  def initialize(uri, options = {})
11
11
  @uri = URI.parse(uri)
12
12
  @base_uri = "#{@uri.scheme}://#{@uri.host}:#{@uri.port}"
13
- @user = @uri.user
14
- @password = @uri.password
13
+ @user = options[:user]
14
+ @password = options[:password]
15
15
  # make a ping connection
16
16
  ping
17
17
  end
@@ -193,12 +193,8 @@ class DockerRegistry2::Registry
193
193
  end
194
194
  # authenticate against the realm
195
195
  uri = URI.parse(target[:realm])
196
- uri.user = @user if defined? @user
197
- uri.password = @password if defined? @password
198
196
  begin
199
- # FIXME: This should be set with the rest of the headers
200
- # target[:params]['scope'] = 'repository'
201
- response = RestClient.get uri.to_s, {params: target[:params]}
197
+ response = RestClient::Request.execute method: :get, url: uri.to_s, headers: {params: target[:params]}, user: @user, password: @password
202
198
  rescue RestClient::Unauthorized
203
199
  # bad authentication
204
200
  raise DockerRegistry2::RegistryAuthenticationException
@@ -1,3 +1,3 @@
1
1
  module DockerRegistry2
2
- VERSION = '0.7.0'
2
+ VERSION = '1.0.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: 0.7.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Avi Deitcher https://github.com/deitch
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2017-05-11 00:00:00.000000000 Z
13
+ date: 2017-06-16 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler