docker-api 1.13.2 → 1.13.3

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: fde443a387e40356f6eb1ba8c39721ee43b9ada4
4
+ data.tar.gz: b1eae14c8c69cb9a8aa62d7f661ccc9a31ab37a7
5
+ SHA512:
6
+ metadata.gz: 97126faabbb3b0742e40678e83d4362140bf013f26bf4a6557190b1d4e3778045b66fd1787e97379172b8ed561b7cb6516aaebcc809e35be0ffe140840684b1f
7
+ data.tar.gz: 4bd7b4f96e95e5d3c1a0caebacda75c251040bc372560f4a9300feba4bb84332c67c08524def10807fbe9b834e30effcc1e7db48cb29bc974fdc7ff2e0d9a25d
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  docker-api
2
2
  ==========
3
- [![Gem Version](https://badge.fury.io/rb/docker-api.png)](http://badge.fury.io/rb/docker-api) [![travis-ci](https://travis-ci.org/swipely/docker-api.png?branch=master)](https://travis-ci.org/swipely/docker-api) [![Code Climate](https://codeclimate.com/github/swipely/docker-api.png)](https://codeclimate.com/github/swipely/docker-api) [![Dependency Status](https://gemnasium.com/swipely/docker-api.png)](https://gemnasium.com/swipely/docker-api)
3
+ [![Gem Version](https://badge.fury.io/rb/docker-api.png)](https://badge.fury.io/rb/docker-api) [![travis-ci](https://travis-ci.org/swipely/docker-api.png?branch=master)](https://travis-ci.org/swipely/docker-api) [![Code Climate](https://codeclimate.com/github/swipely/docker-api.png)](https://codeclimate.com/github/swipely/docker-api) [![Dependency Status](https://gemnasium.com/swipely/docker-api.png)](https://gemnasium.com/swipely/docker-api)
4
4
 
5
- This gem provides an object-oriented interface to the [Docker Remote API](http://docs.docker.io/en/latest/reference/api/docker_remote_api/). Every method listed there is implemented. At the time of this writing, docker-api is meant to interface with Docker version 1.0.*
5
+ This gem provides an object-oriented interface to the [Docker Remote API](https://docs.docker.com/reference/api/docker_remote_api/). Every method listed there is implemented. At the time of this writing, docker-api is meant to interface with Docker version 1.0.*
6
6
 
7
7
  If you're interested in using Docker to package your apps, we recommend the [dockly](https://github.com/swipely/dockly) gem. Dockly provides a simple DSL for describing Docker containers that install as Debian packages and are controlled by upstart scripts.
8
8
 
@@ -36,7 +36,7 @@ docker-api is designed to be very lightweight. Almost no state is cached (aside
36
36
 
37
37
  ## Starting up
38
38
 
39
- Follow the [installation instructions](http://www.docker.io/gettingstarted/), and then run:
39
+ Follow the [installation instructions](https://docs.docker.com/installation/#installation), and then run:
40
40
 
41
41
  ```shell
42
42
  $ sudo docker -d
@@ -47,7 +47,7 @@ This will daemonize Docker so that it can be used for the remote API calls.
47
47
  If you're running Docker locally as a socket, there is no setup to do in Ruby. If you're not or change the path of the socket, you'll have to point the gem to your socket or local/remote port. For example:
48
48
 
49
49
  ```ruby
50
- Docker.url = 'http://example.com:5422'
50
+ Docker.url = 'tcp://example.com:5422'
51
51
  ```
52
52
 
53
53
  Two things to note here. The first is that this gem uses [excon](http://www.github.com/geemus/excon), so any of the options that are valid for `Excon.new` are also valid for `Docker.options`. Second, by default Docker runs on a socket. The gem will assume you want to connect to the socket unless you specify otherwise.
@@ -65,11 +65,11 @@ irb(main):003:0> Docker.options
65
65
  ```
66
66
 
67
67
  ```shell
68
- $ DOCKER_URL=http://example.com:1000 irb
68
+ $ DOCKER_URL=tcp://example.com:1000 irb
69
69
  irb(main):001:0> require 'docker'
70
70
  => true
71
71
  irb(main):003:0> Docker.url
72
- => "http://example.com:1000"
72
+ => "tcp://example.com:1000"
73
73
  irb(main):004:0> Docker.options
74
74
  => {}
75
75
  ```
@@ -95,7 +95,7 @@ Docker.authenticate!('username' => 'docker-fan-boi', 'password' => 'i<3docker',
95
95
  ```
96
96
 
97
97
  ## Images
98
- Just about every method here has a one-to-one mapping with the [Images](http://docs.docker.io/en/latest/reference/api/docker_remote_api_v1.10/#images) section of the API. If an API call accepts query parameters, these can be passed as an Hash to it's corresponding method. Also, note that `Docker::Image.new` is a private method, so you must use `.create`, `.build`, `.build_from_dir`, or `.import` to make an instance.
98
+ Just about every method here has a one-to-one mapping with the [Images](https://docs.docker.com/reference/api/docker_remote_api_v1.12/#22-images) section of the API. If an API call accepts query parameters, these can be passed as an Hash to it's corresponding method. Also, note that `Docker::Image.new` is a private method, so you must use `.create`, `.build`, `.build_from_dir`, or `.import` to make an instance.
99
99
 
100
100
  ```ruby
101
101
  require 'docker'
@@ -103,16 +103,15 @@ require 'docker'
103
103
 
104
104
  # Create an Image.
105
105
  Docker::Image.create('fromImage' => 'base')
106
- # => Docker::Image { :id => ae7ffbcd1, :connection => Docker::Connection { :url => http://localhost, :options => {:port=>4243} } }
106
+ # => Docker::Image { :id => ae7ffbcd1, :connection => Docker::Connection { :url => tcp://localhost, :options => {:port=>2375} } }
107
107
 
108
108
  # Insert a local file into an Image.
109
109
  image.insert_local('localPath' => 'Gemfile', 'outputPath' => '/')
110
- # => Docker::Image { :id => 682ea192f, :connection => Docker::Connection { :url => http://localhost, :options => {:port=>4243} } }
110
+ # => Docker::Image { :id => 682ea192f, :connection => Docker::Connection { :url => tcp://localhost, :options => {:port=>2375} } }
111
111
 
112
112
  # Insert multiple local files into an Image.
113
113
  image.insert_local('localPath' => [ 'Gemfile', 'Rakefile' ], 'outputPath' => '/')
114
- # => Docker::Image { :id => eb693ec80, :connection => Docker::Connection { :url => http://localhost, :options => {:port=>4243} } }
115
-
114
+ # => Docker::Image { :id => eb693ec80, :connection => Docker::Connection { :url => tcp://localhost, :options => {:port=>2375} } }
116
115
 
117
116
  # Tag an Image.
118
117
  image.tag('repo' => 'base2', 'force' => true)
@@ -133,7 +132,7 @@ image.push
133
132
 
134
133
  # Given a command, create a new Container to run that command in the Image.
135
134
  image.run('ls -l')
136
- # => Docker::Container { id => aaef712eda, :connection => Docker::Connection { :url => http://localhost, :options => {:port=>4243} } }
135
+ # => Docker::Container { id => aaef712eda, :connection => Docker::Connection { :url => tcp://localhost, :options => {:port=>2375} } }
137
136
 
138
137
  # Remove the Image from the server.
139
138
  image.remove(:force => true)
@@ -141,11 +140,11 @@ image.remove(:force => true)
141
140
 
142
141
  # Given a Container's export, creates a new Image.
143
142
  Docker::Image.import('some-export.tar')
144
- # => Docker::Image { :id => 66b712aef, :connection => Docker::Connection { :url => http://localhost, :options => {:port=>4243} } }
143
+ # => Docker::Image { :id => 66b712aef, :connection => Docker::Connection { :url => tcp://localhost, :options => {:port=>2375} } }
145
144
 
146
145
  # `Docker::Image.import` can also import from a URI
147
146
  Docker::Image.import('http://some-site.net/my-image.tar')
148
- # => Docker::Image { :id => 6b462b2d2, :connection => Docker::Connection { :url => http://localhost, :options => {:port=>4243} } }
147
+ # => Docker::Image { :id => 6b462b2d2, :connection => Docker::Connection { :url => tcp://localhost, :options => {:port=>2375} } }
149
148
 
150
149
  # For a lower-level interface for importing tars, `Docker::Image.import_stream` may be used.
151
150
  # It accepts a block, and will call that block until it returns an empty `String`.
@@ -155,30 +154,34 @@ end
155
154
 
156
155
  # Create an Image from a Dockerfile as a String.
157
156
  Docker::Image.build("from base\nrun touch /test")
158
- # => Docker::Image { :id => b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc, :connection => Docker::Connection { :url => http://localhost, :options => {:port=>4243} } }
157
+ # => Docker::Image { :id => b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc, :connection => Docker::Connection { :url => tcp://localhost, :options => {:port=>2375} } }
159
158
 
160
159
  # Create an Image from a Dockerfile.
161
160
  Docker::Image.build_from_dir('.')
162
- # => Docker::Image { :id => 1266dc19e, :connection => Docker::Connection { :url => http://localhost, :options => {:port=>4243} } }
161
+ # => Docker::Image { :id => 1266dc19e, :connection => Docker::Connection { :url => tcp://localhost, :options => {:port=>2375} } }
163
162
 
164
163
  # Load all Images on your Docker server.
165
164
  Docker::Image.all
166
- # => [Docker::Image { :id => b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc, :connection => Docker::Connection { :url => http://localhost, :options => {:port=>4243} } }, Docker::Image { :id => 8dbd9e392a964056420e5d58ca5cc376ef18e2de93b5cc90e868a1bbc8318c1c, :connection => Docker::Connection { :url => http://localhost, :options => {:port=>4243} } }]
165
+ # => [Docker::Image { :id => b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc, :connection => Docker::Connection { :url => tcp://localhost, :options => {:port=>2375} } }, Docker::Image { :id => 8dbd9e392a964056420e5d58ca5cc376ef18e2de93b5cc90e868a1bbc8318c1c, :connection => Docker::Connection { :url => tcp://localhost, :options => {:port=>2375} } }]
166
+
167
+ # Get Image from the server, with id
168
+ Docker::Image.get('df4f1bdecf40')
169
+ # => Docker::Image { :id => eb693ec80, :connection => Docker::Connection { :url => tcp://localhost, :options => {:port=>2375} } }
167
170
 
168
171
  # Search the Docker registry.
169
172
  Docker::Image.search('term' => 'sshd')
170
- # => [Docker::Image { :id => cespare/sshd, :connection => Docker::Connection { :url => http://localhost, :options => {:port=>4243} } }, Docker::Image { :id => johnfuller/sshd, :connection => Docker::Connection { :url => http://localhost, :options => {:port=>4243} } }, Docker::Image { :id => dhrp/mongodb-sshd, :connection => Docker::Connection { :url => http://localhost, :options => {:port=>4243} } }, Docker::Image { :id => rayang2004/sshd, :connection => Docker::Connection { :url => http://localhost, :options => {:port=>4243} } }, Docker::Image { :id => dhrp/sshd, :connection => Docker::Connection { :url => http://localhost, :options => {:port=>4243} } }, Docker::Image { :id => toorop/daemontools-sshd, :connection => Docker::Connection { :url => http://localhost, :options => {:port=>4243} } }, Docker::Image { :id => toorop/daemontools-sshd-nginx, :connection => Docker::Connection { :url => http://localhost, :options => {:port=>4243} } }, Docker::Image { :id => toorop/daemontools-sshd-nginx-php-fpm, :connection => Docker::Connection { :url => http://localhost, :options => {:port=>4243} } }, Docker::Image { :id => mbkan/lamp, :connection => Docker::Connection { :url => http://localhost, :options => {:port=>4243} } }, Docker::Image { :id => toorop/golang, :connection => Docker::Connection { :url => http://localhost, :options => {:port=>4243} } }, Docker::Image { :id => wma55/u1210sshd, :connection => Docker::Connection { :url => http://localhost, :options => {:port=>4243} } }, Docker::Image { :id => jdswinbank/sshd, :connection => Docker::Connection { :url => http://localhost, :options => {:port=>4243} } }, Docker::Image { :id => vgauthier/sshd, :connection => Docker::Connection { :url => http://localhost, :options => {:port=>4243} } }]
173
+ # => [Docker::Image { :id => cespare/sshd, :connection => Docker::Connection { :url => tcp://localhost, :options => {:port=>2375} } }, Docker::Image { :id => johnfuller/sshd, :connection => Docker::Connection { :url => tcp://localhost, :options => {:port=>2375} } }, Docker::Image { :id => dhrp/mongodb-sshd, :connection => Docker::Connection { :url => tcp://localhost, :options => {:port=>2375} } }, Docker::Image { :id => rayang2004/sshd, :connection => Docker::Connection { :url => tcp://localhost, :options => {:port=>2375} } }, Docker::Image { :id => dhrp/sshd, :connection => Docker::Connection { :url => tcp://localhost, :options => {:port=>2375} } }, Docker::Image { :id => toorop/daemontools-sshd, :connection => Docker::Connection { :url => tcp://localhost, :options => {:port=>2375} } }, Docker::Image { :id => toorop/daemontools-sshd-nginx, :connection => Docker::Connection { :url => tcp://localhost, :options => {:port=>2375} } }, Docker::Image { :id => toorop/daemontools-sshd-nginx-php-fpm, :connection => Docker::Connection { :url => tcp://localhost, :options => {:port=>2375} } }, Docker::Image { :id => mbkan/lamp, :connection => Docker::Connection { :url => tcp://localhost, :options => {:port=>2375} } }, Docker::Image { :id => toorop/golang, :connection => Docker::Connection { :url => tcp://localhost, :options => {:port=>2375} } }, Docker::Image { :id => wma55/u1210sshd, :connection => Docker::Connection { :url => tcp://localhost, :options => {:port=>2375} } }, Docker::Image { :id => jdswinbank/sshd, :connection => Docker::Connection { :url => tcp://localhost, :options => {:port=>2375} } }, Docker::Image { :id => vgauthier/sshd, :connection => Docker::Connection { :url => tcp://localhost, :options => {:port=>2375} } }]
171
174
  ```
172
175
 
173
176
  ## Containers
174
- Much like the Images, this object also has a one-to-one mapping with the [Containers](http://docs.docker.io/en/latest/reference/api/docker_remote_api_v1.10/#containers) section of the API. Also like Images, `.new` is a private method, so you must use `.create` to make an instance.
177
+ Much like the Images, this object also has a one-to-one mapping with the [Containers](https://docs.docker.com/reference/api/docker_remote_api_v1.12/#21-containers) section of the API. Also like Images, `.new` is a private method, so you must use `.create` to make an instance.
175
178
 
176
179
  ```ruby
177
180
  require 'docker'
178
181
 
179
182
  # Create a Container.
180
183
  Docker::Container.create('Cmd' => ['ls'], 'Image' => 'base')
181
- # => Docker::Container { :id => 492510dd38e4, :connection => Docker::Connection { :url => http://localhost, :options => {:port=>4243} } }
184
+ # => Docker::Container { :id => 492510dd38e4, :connection => Docker::Connection { :url => tcp://localhost, :options => {:port=>2375} } }
182
185
 
183
186
  # Get more information about the Container.
184
187
  container.json
@@ -186,31 +189,31 @@ container.json
186
189
 
187
190
  # Start running the Container.
188
191
  container.start
189
- # => Docker::Container { :id => 492510dd38e4, :connection => Docker::Connection { :url => http://localhost, :options => {:port=>4243} } }
192
+ # => Docker::Container { :id => 492510dd38e4, :connection => Docker::Connection { :url => tcp://localhost, :options => {:port=>2375} } }
190
193
 
191
194
  # Stop running the Container.
192
195
  container.stop
193
- # => Docker::Container { :id => 492510dd38e4, :connection => Docker::Connection { :url => http://localhost, :options => {:port=>4243} } }
196
+ # => Docker::Container { :id => 492510dd38e4, :connection => Docker::Connection { :url => tcp://localhost, :options => {:port=>2375} } }
194
197
 
195
198
  # Restart the Container.
196
199
  container.restart
197
- # => Docker::Container { :id => 492510dd38e4, :connection => Docker::Connection { :url => http://localhost, :options => {:port=>4243} } }
200
+ # => Docker::Container { :id => 492510dd38e4, :connection => Docker::Connection { :url => tcp://localhost, :options => {:port=>2375} } }
198
201
 
199
202
  # Pause the running Container processes.
200
203
  container.pause
201
- # => Docker::Container { :id => 492510dd38e4, :connection => Docker::Connection { :url => http://localhost, :options => {:port=>4243} } }
204
+ # => Docker::Container { :id => 492510dd38e4, :connection => Docker::Connection { :url => tcp://localhost, :options => {:port=>2375} } }
202
205
 
203
206
  # Unpause the running Container processes.
204
207
  container.unpause
205
- # => Docker::Container { :id => 492510dd38e4, :connection => Docker::Connection { :url => http://localhost, :options => {:port=>4243} } }
208
+ # => Docker::Container { :id => 492510dd38e4, :connection => Docker::Connection { :url => tcp://localhost, :options => {:port=>2375} } }
206
209
 
207
210
  # Kill the command running in the Container.
208
211
  container.kill
209
- # => Docker::Container { :id => 492510dd38e4, :connection => Docker::Connection { :url => http://localhost, :options => {:port=>4243} } }
212
+ # => Docker::Container { :id => 492510dd38e4, :connection => Docker::Connection { :url => tcp://localhost, :options => {:port=>2375} } }
210
213
 
211
214
  # Kill the Container specifying the kill signal.
212
215
  container.kill(:signal => "SIGHUP")
213
- # => Docker::Container { :id => 492510dd38e4, :connection => Docker::Connection { :url => http://localhost, :options => {:port=>4243} } }
216
+ # => Docker::Container { :id => 492510dd38e4, :connection => Docker::Connection { :url => tcp://localhost, :options => {:port=>2375} } }
214
217
 
215
218
  # Return the currently executing processes in a Container.
216
219
  container.top
@@ -237,7 +240,7 @@ fe00::0 ip6-localnet
237
240
  ff00::0 ip6-mcastprefix
238
241
  ff02::1 ip6-allnodes
239
242
  ff02::2 ip6-allrouters
240
- # => Docker::Container { :id => a1759f3e2873, :connection => Docker::Connection { :url => http://localhost, :options => {:port=>4243} } }
243
+ # => Docker::Container { :id => a1759f3e2873, :connection => Docker::Connection { :url => tcp://localhost, :options => {:port=>2375} } }
241
244
 
242
245
  # Wait for the current command to finish executing. If an argument is given,
243
246
  # will timeout after that number of seconds. The default is one minute.
@@ -268,12 +271,12 @@ container.tap(&:start).attach(:tty => true)
268
271
 
269
272
  # Create an Image from a Container's changes.
270
273
  container.commit
271
- # => Docker::Image { :id => eaeb8d00efdf, :connection => Docker::Connection { :url => http://localhost, :options => {:port=>4243} } }
274
+ # => Docker::Image { :id => eaeb8d00efdf, :connection => Docker::Connection { :url => tcp://localhost, :options => {:port=>2375} } }
272
275
 
273
276
  # Commit the Container and run a new command. The second argument is the number
274
277
  # of seconds the Container should wait before stopping its current command.
275
278
  container.run('pwd', 10)
276
- # => Docker::Image { :id => 4427be4199ac, :connection => Docker::Connection { :url => http://localhost, :options => {:port=>4243} } }
279
+ # => Docker::Image { :id => 4427be4199ac, :connection => Docker::Connection { :url => tcp://localhost, :options => {:port=>2375} } }
277
280
 
278
281
  # Delete a Container.
279
282
  container.delete(:force => true)
@@ -281,11 +284,11 @@ container.delete(:force => true)
281
284
 
282
285
  # Request a Container by ID or name.
283
286
  Docker::Container.get('500f53b25e6e')
284
- # => Docker::Container { :id => , :connection => Docker::Connection { :url => http://localhost, :options => {:port=>4243} } }
287
+ # => Docker::Container { :id => , :connection => Docker::Connection { :url => tcp://localhost, :options => {:port=>2375} } }
285
288
 
286
289
  # Request all of the Containers. By default, will only return the running Containers.
287
290
  Docker::Container.all(:all => true)
288
- # => [Docker::Container { :id => , :connection => Docker::Connection { :url => http://localhost, :options => {:port=>4243} } }]
291
+ # => [Docker::Container { :id => , :connection => Docker::Connection { :url => tcp://localhost, :options => {:port=>2375} } }]
289
292
  ```
290
293
 
291
294
  ## Connecting to Multiple Servers
@@ -295,7 +298,7 @@ By default, each object connects to the connection specified by `Docker.connecti
295
298
  ```ruby
296
299
  require 'docker'
297
300
 
298
- Docker::Container.all({}, Docker::Connection.new('http://example.com:4243', {}))
301
+ Docker::Container.all({}, Docker::Connection.new('tcp://example.com:2375', {}))
299
302
  ```
300
303
 
301
304
  ## Rake Task
@@ -18,8 +18,10 @@ class Docker::Connection
18
18
  uri = URI.parse(url)
19
19
  if uri.scheme == "unix"
20
20
  @url, @options = 'unix:///', {:socket => uri.path}.merge(opts)
21
- else
21
+ elsif uri.scheme =~ /^(https?|tcp)$/
22
22
  @url, @options = url, opts
23
+ else
24
+ @url, @options = "http://#{uri}", opts
23
25
  end
24
26
  end
25
27
  end
@@ -47,7 +49,7 @@ class Docker::Connection
47
49
  rescue Excon::Errors::NotFound => ex
48
50
  raise NotFoundError, ex.message
49
51
  rescue Excon::Errors::InternalServerError => ex
50
- raise ServerError, ex.message
52
+ raise ServerError, ex.response.data[:body]
51
53
  rescue Excon::Errors::Timeout => ex
52
54
  raise TimeoutError, ex.message
53
55
  end
@@ -1,6 +1,6 @@
1
1
  module Docker
2
2
  # The version of the docker-api gem.
3
- VERSION = '1.13.2'
3
+ VERSION = '1.13.3'
4
4
 
5
5
  # The version of the compatible Docker remote API.
6
6
  API_VERSION = '1.12'
@@ -4,6 +4,25 @@ module Excon
4
4
  # yields the underlying TCP socket for raw TCP communication (used to
5
5
  # attach to STDIN of containers).
6
6
  class Hijack < Base
7
+ def build_response(status, socket)
8
+ response = {
9
+ :body => '',
10
+ :headers => Excon::Headers.new,
11
+ :status => status,
12
+ :remote_ip => socket.respond_to?(:remote_ip) &&
13
+ socket.remote_ip,
14
+ }
15
+ if socket.data[:scheme] =~ /^(https?|tcp)$/
16
+ response.merge({
17
+ :local_port => socket.respond_to?(:local_port) &&
18
+ socket.local_port,
19
+ :local_address => socket.respond_to?(:local_address) &&
20
+ socket.local_address
21
+ })
22
+ end
23
+ response
24
+ end
25
+
7
26
  def response_call(datum)
8
27
  if datum[:hijack_block]
9
28
  # Need to process the response headers here rather than in
@@ -15,17 +34,7 @@ module Excon
15
34
  until match = /^HTTP\/\d+\.\d+\s(\d{3})\s/.match(socket.readline); end
16
35
  status = match[1].to_i
17
36
 
18
- datum[:response] = {
19
- :body => '',
20
- :headers => Excon::Headers.new,
21
- :status => status,
22
- :remote_ip => socket.respond_to?(:remote_ip) &&
23
- socket.remote_ip,
24
- :local_port => socket.respond_to?(:local_port) &&
25
- socket.local_port,
26
- :local_address => socket.respond_to?(:local_address) &&
27
- socket.local_address
28
- }
37
+ datum[:response] = build_response(status, socket)
29
38
 
30
39
  Excon::Response.parse_headers(socket, datum)
31
40
  datum[:hijack_block].call socket.instance_variable_get(:@socket)
@@ -41,6 +41,24 @@ describe Docker::Connection do
41
41
  end
42
42
  end
43
43
  end
44
+
45
+ context 'url conversion to uri' do
46
+ context 'when the url does not contain a scheme' do
47
+ let(:url) { 'localhost:4243' }
48
+
49
+ it 'adds the scheme to the url' do
50
+ expect(subject.url).to eq "http://#{url}"
51
+ end
52
+ end
53
+
54
+ context 'when the url is a complete uri' do
55
+ let(:url) { 'http://localhost:4243' }
56
+
57
+ it 'leaves the url intact' do
58
+ expect(subject.url).to eq url
59
+ end
60
+ end
61
+ end
44
62
  end
45
63
 
46
64
  describe '#resource' do
metadata CHANGED
@@ -1,84 +1,74 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: docker-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.13.2
5
- prerelease:
4
+ version: 1.13.3
6
5
  platform: ruby
7
6
  authors:
8
7
  - Swipely, Inc.
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2014-07-24 00:00:00.000000000 Z
11
+ date: 2014-09-25 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: excon
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: 0.38.0
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - '>='
28
25
  - !ruby/object:Gem::Version
29
26
  version: 0.38.0
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: json
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - '>='
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - '>='
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: archive-tar-minitar
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - '>='
52
46
  - !ruby/object:Gem::Version
53
47
  version: '0'
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - '>='
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: rake
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - '>='
68
60
  - !ruby/object:Gem::Version
69
61
  version: '0'
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - '>='
76
67
  - !ruby/object:Gem::Version
77
68
  version: '0'
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: rspec
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
73
  - - ~>
84
74
  - !ruby/object:Gem::Version
@@ -86,7 +76,6 @@ dependencies:
86
76
  type: :development
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
80
  - - ~>
92
81
  - !ruby/object:Gem::Version
@@ -94,97 +83,85 @@ dependencies:
94
83
  - !ruby/object:Gem::Dependency
95
84
  name: rspec-its
96
85
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
86
  requirements:
99
- - - ! '>='
87
+ - - '>='
100
88
  - !ruby/object:Gem::Version
101
89
  version: '0'
102
90
  type: :development
103
91
  prerelease: false
104
92
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
93
  requirements:
107
- - - ! '>='
94
+ - - '>='
108
95
  - !ruby/object:Gem::Version
109
96
  version: '0'
110
97
  - !ruby/object:Gem::Dependency
111
98
  name: cane
112
99
  requirement: !ruby/object:Gem::Requirement
113
- none: false
114
100
  requirements:
115
- - - ! '>='
101
+ - - '>='
116
102
  - !ruby/object:Gem::Version
117
103
  version: '0'
118
104
  type: :development
119
105
  prerelease: false
120
106
  version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
107
  requirements:
123
- - - ! '>='
108
+ - - '>='
124
109
  - !ruby/object:Gem::Version
125
110
  version: '0'
126
111
  - !ruby/object:Gem::Dependency
127
112
  name: pry
128
113
  requirement: !ruby/object:Gem::Requirement
129
- none: false
130
114
  requirements:
131
- - - ! '>='
115
+ - - '>='
132
116
  - !ruby/object:Gem::Version
133
117
  version: '0'
134
118
  type: :development
135
119
  prerelease: false
136
120
  version_requirements: !ruby/object:Gem::Requirement
137
- none: false
138
121
  requirements:
139
- - - ! '>='
122
+ - - '>='
140
123
  - !ruby/object:Gem::Version
141
124
  version: '0'
142
125
  - !ruby/object:Gem::Dependency
143
126
  name: vcr
144
127
  requirement: !ruby/object:Gem::Requirement
145
- none: false
146
128
  requirements:
147
- - - ! '>='
129
+ - - '>='
148
130
  - !ruby/object:Gem::Version
149
131
  version: 2.7.0
150
132
  type: :development
151
133
  prerelease: false
152
134
  version_requirements: !ruby/object:Gem::Requirement
153
- none: false
154
135
  requirements:
155
- - - ! '>='
136
+ - - '>='
156
137
  - !ruby/object:Gem::Version
157
138
  version: 2.7.0
158
139
  - !ruby/object:Gem::Dependency
159
140
  name: simplecov
160
141
  requirement: !ruby/object:Gem::Requirement
161
- none: false
162
142
  requirements:
163
- - - ! '>='
143
+ - - '>='
164
144
  - !ruby/object:Gem::Version
165
145
  version: '0'
166
146
  type: :development
167
147
  prerelease: false
168
148
  version_requirements: !ruby/object:Gem::Requirement
169
- none: false
170
149
  requirements:
171
- - - ! '>='
150
+ - - '>='
172
151
  - !ruby/object:Gem::Version
173
152
  version: '0'
174
153
  - !ruby/object:Gem::Dependency
175
154
  name: webmock
176
155
  requirement: !ruby/object:Gem::Requirement
177
- none: false
178
156
  requirements:
179
- - - ! '>='
157
+ - - '>='
180
158
  - !ruby/object:Gem::Version
181
159
  version: '0'
182
160
  type: :development
183
161
  prerelease: false
184
162
  version_requirements: !ruby/object:Gem::Requirement
185
- none: false
186
163
  requirements:
187
- - - ! '>='
164
+ - - '>='
188
165
  - !ruby/object:Gem::Version
189
166
  version: '0'
190
167
  description: A simple REST client for the Docker Remote API
@@ -295,27 +272,26 @@ files:
295
272
  homepage: https://github.com/swipely/docker-api
296
273
  licenses:
297
274
  - MIT
275
+ metadata: {}
298
276
  post_install_message:
299
277
  rdoc_options: []
300
278
  require_paths:
301
279
  - lib
302
280
  required_ruby_version: !ruby/object:Gem::Requirement
303
- none: false
304
281
  requirements:
305
- - - ! '>='
282
+ - - '>='
306
283
  - !ruby/object:Gem::Version
307
284
  version: '0'
308
285
  required_rubygems_version: !ruby/object:Gem::Requirement
309
- none: false
310
286
  requirements:
311
- - - ! '>='
287
+ - - '>='
312
288
  - !ruby/object:Gem::Version
313
289
  version: '0'
314
290
  requirements: []
315
291
  rubyforge_project:
316
- rubygems_version: 1.8.23.2
292
+ rubygems_version: 2.0.14
317
293
  signing_key:
318
- specification_version: 3
294
+ specification_version: 4
319
295
  summary: A simple REST client for the Docker Remote API
320
296
  test_files:
321
297
  - spec/docker/connection_spec.rb
@@ -394,3 +370,4 @@ test_files:
394
370
  - spec/vcr/Docker_Image/_run/when_the_argument_is_nil/no_command_configured_in_image/should_raise_an_error_if_no_command_is_specified.yml
395
371
  - spec/vcr/Docker_Image/_search/materializes_each_Image_into_a_Docker_Image.yml
396
372
  - spec/vcr/Docker_Image/_tag/tags_the_image_with_the_repo_name.yml
373
+ has_rdoc: