docker-api 1.28.0 → 1.29.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: 208227d2b48722c6c994b7182065a13ee1e478ce
4
- data.tar.gz: 7fe1de106942c93a80884c0b5ca65a06bf237e81
3
+ metadata.gz: 29ba56360b810e2e0ba6b89d141050924fe411af
4
+ data.tar.gz: 5e13ee3c1047314c24d22db68061ba92ff9e6244
5
5
  SHA512:
6
- metadata.gz: 8420bbc610fa614cd590c9ff449a98e237c9bdaa20c91b03954c2c9d797849cb48f97e2048ee4589b095f0448fe9ab9e46685dcbe884d232cb3c9339313c47e3
7
- data.tar.gz: 64af52f1ed2c4a9b25c69759c06d77745e8ce7843db8675247b6225318b809754b4c336f50ebae01fbfcd20cc3b4adde22042c2eeb9fb96e7a03aba85a7b2a8d
6
+ metadata.gz: 8f2b8f6a76c9ad7e608b4b8405e5e8456849b81b4570b079a5c58f11940b4f53c9f20c5a7eaeca7b11105945f84811921d5e1aa1aaeaf78b9878dd2716970ca9
7
+ data.tar.gz: 3b5e1c48e6c7a7afdab6679abca8e8ca99393b7b8e95d4fb0a4eb131f54c3368d5b75253f8d7fd469eff6bbc0b7c6089deab9ebfc8ad7c53738ac96466d25ca6
@@ -8,6 +8,7 @@ rvm:
8
8
  - 2.0
9
9
  - 1.9.3
10
10
  env:
11
+ - DOCKER_VERSION=1.11.1
11
12
  - DOCKER_VERSION=1.10.3
12
13
  - DOCKER_VERSION=1.9.1
13
14
  - DOCKER_VERSION=1.8.2
data/README.md CHANGED
@@ -401,6 +401,10 @@ container = Docker::Container.create('Image' => 'ubuntu', 'Cmd' => command, 'Tty
401
401
  container.tap(&:start).attach(:tty => true)
402
402
  # => [["I'm a TTY!"], []]
403
403
 
404
+ # Obtaining the current statistics of a container
405
+ container.stats
406
+ # => {"read"=>"2016-02-29T20:47:05.221608695Z", "precpu_stats"=>{"cpu_usage"=> ... }
407
+
404
408
  # Create an Image from a Container's changes.
405
409
  container.commit
406
410
  # => Docker::Image { :id => eaeb8d00efdf, :connection => Docker::Connection { :url => tcp://localhost, :options => {:port=>2375} } }
@@ -156,6 +156,11 @@ class Docker::Container
156
156
  connection.get(path_for(:logs), opts)
157
157
  end
158
158
 
159
+ # TODO: Implement Streaming stats
160
+ def stats
161
+ Docker::Util.parse_json(connection.get(path_for(:stats), {stream: 0}))
162
+ end
163
+
159
164
  def rename(new_name)
160
165
  query = {}
161
166
  query['name'] = new_name
@@ -185,6 +185,8 @@ module Docker::Util
185
185
  body.lines.reverse_each do |line|
186
186
  if (id = line.match(/Successfully built ([a-f0-9]+)/)) && !id[1].empty?
187
187
  return id[1]
188
+ elsif (id = line.match(/sha256:([a-f0-9]+)/)) && !id[1].empty?
189
+ return id[1]
188
190
  end
189
191
  end
190
192
  raise UnexpectedResponseError, "Couldn't find id: #{body}"
@@ -1,6 +1,6 @@
1
1
  module Docker
2
2
  # The version of the docker-api gem.
3
- VERSION = '1.28.0'
3
+ VERSION = '1.29.0'
4
4
 
5
5
  # The version of the compatible Docker remote API.
6
6
  API_VERSION = '1.16'
@@ -81,6 +81,20 @@ describe Docker::Container do
81
81
  end
82
82
  end
83
83
 
84
+ describe '#stats', docker_1_9: true do
85
+ subject {
86
+ described_class.create('Cmd' => "echo hello", 'Image' => 'debian:wheezy')
87
+ }
88
+ after(:each) { subject.remove }
89
+
90
+ context "when requesting container stats" do
91
+ let(:output) { subject.stats }
92
+ it "returns a Hash" do
93
+ expect(output).to be_a Hash
94
+ end
95
+ end
96
+ end
97
+
84
98
  describe '#logs' do
85
99
  subject {
86
100
  described_class.create('Cmd' => "echo hello", 'Image' => 'debian:wheezy')
@@ -172,9 +172,9 @@ describe Docker do
172
172
  let(:info) { subject.info }
173
173
  let(:keys) do
174
174
  %w(Containers Debug DockerRootDir Driver DriverStatus ExecutionDriver ID
175
- IPv4Forwarding Images IndexServerAddress InitPath InitSha1
176
- KernelVersion Labels MemTotal MemoryLimit NCPU NEventsListener NFd
177
- NGoroutines Name OperatingSystem SwapLimit)
175
+ IPv4Forwarding Images IndexServerAddress KernelVersion Labels MemTotal
176
+ MemoryLimit NCPU NEventsListener NFd NGoroutines Name
177
+ OperatingSystem SwapLimit)
178
178
  end
179
179
 
180
180
  it 'returns the info as a Hash' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: docker-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.28.0
4
+ version: 1.29.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Swipely, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-30 00:00:00.000000000 Z
11
+ date: 2016-06-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: excon