docker-api 2.2.0 → 2.4.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
  SHA256:
3
- metadata.gz: fc1628fd247f468eade6265726036edfe62cf330a3f0be35f24359af395dc4b4
4
- data.tar.gz: 29a503b4ac556125534508256dbea71f6acc1a3612b24c1ae204cbd93a83ba04
3
+ metadata.gz: c8c844030bda8d245234ddd5d977ad5202b9a2f0a2e34175579790d79e6f584b
4
+ data.tar.gz: 5b793f7689d091a8a765853511e4f0f8f495338250cdec62bce30fc7a83d5117
5
5
  SHA512:
6
- metadata.gz: 0e0478393e9624e3b206c4578a1a2449843da15bcbceb70520a708ce4a9e8a493a13dd5c6d0e8d3b2b71e1256a4770eb3cb1568471985fd3f52fb703e03ac20e
7
- data.tar.gz: 14022d379e3e2dade67ffcd6ce12e56f9e12b65eb00e1906e579561262963fde36181b955526bfbd24c47baba3b4dfee15475c980e7f5bda4bff64ecf8e36859
6
+ metadata.gz: d5ce08a8dfbe1e5377ceb62d8186e4973ca6f7fa8d166bd9177f8f4a3338dc2dfeb3d735d3c54e31b15373f4124cc87d509d369a34e0f1598291105a4593947f
7
+ data.tar.gz: d27a38af366bbb20febcc3699238a56f5c52d24394780c25d3caf72bc6f9314fb8bae6dd9c7f53cd5ff30558f5bbc353d22fc9f236913a2d8786488c9a702aea
data/README.md CHANGED
@@ -1,10 +1,10 @@
1
1
  docker-api
2
2
  ==========
3
- [![Gem Version](https://badge.fury.io/rb/docker-api.svg)](https://badge.fury.io/rb/docker-api) [![travis-ci](https://travis-ci.org/swipely/docker-api.svg?branch=master)](https://travis-ci.org/swipely/docker-api) [![Code Climate](https://codeclimate.com/github/swipely/docker-api.svg)](https://codeclimate.com/github/swipely/docker-api)
3
+ [![Gem Version](https://badge.fury.io/rb/docker-api.svg)](https://badge.fury.io/rb/docker-api) [![Code Climate](https://codeclimate.com/github/upserve/docker-api.svg)](https://codeclimate.com/github/upserve/docker-api)
4
4
 
5
5
  This gem provides an object-oriented interface to the [Docker Engine API](https://docs.docker.com/develop/sdk/). Every method listed there is implemented. At the time of this writing, docker-api is meant to interface with Docker version 1.4.*
6
6
 
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.
7
+ If you're interested in using Docker to package your apps, we recommend the [dockly](https://github.com/upserve/dockly) gem. Dockly provides a simple DSL for describing Docker containers that install as Debian packages and are controlled by upstart scripts.
8
8
 
9
9
  Installation
10
10
  ------------
data/lib/docker/base.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This class is a base class for Docker Container and Image.
2
4
  # It is implementing accessor methods for the models attributes.
3
5
  module Docker::Base
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This class represents a Connection to a Docker server. The Connection is
2
4
  # immutable in that once the url and options is set they cannot be changed.
3
5
  class Docker::Connection
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This class represents a Docker Container. It's important to note that nothing
2
4
  # is cached so that the information is always up to date.
3
5
  class Docker::Container
data/lib/docker/error.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This module holds the Errors for the gem.
2
4
  module Docker::Error
3
5
 
data/lib/docker/event.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This class represents a Docker Event.
2
4
  class Docker::Event
3
5
  include Docker::Error
data/lib/docker/exec.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This class represents a Docker Exec Instance.
2
4
  class Docker::Exec
3
5
  include Docker::Base
data/lib/docker/image.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This class represents a Docker Image.
2
4
  class Docker::Image
3
5
  include Docker::Base
@@ -28,7 +30,7 @@ class Docker::Image
28
30
  repo, tag = Docker::Util.parse_repo_tag(repo_tag)
29
31
  raise ArgumentError, "Image does not have a name to push." if repo.nil?
30
32
 
31
- body = ""
33
+ body = +""
32
34
  credentials = creds || Docker.creds || {}
33
35
  headers = Docker::Util.build_auth_header(credentials)
34
36
  opts = {:tag => tag}.merge(options)
@@ -68,7 +70,7 @@ class Docker::Image
68
70
  name = opts.delete(:name)
69
71
 
70
72
  unless name
71
- if ::Docker.podman?
73
+ if ::Docker.podman?(connection)
72
74
  name = self.id.split(':').last
73
75
  else
74
76
  name = self.id
@@ -119,7 +121,7 @@ class Docker::Image
119
121
  def create(opts = {}, creds = nil, conn = Docker.connection, &block)
120
122
  credentials = creds.nil? ? Docker.creds : MultiJson.dump(creds)
121
123
  headers = credentials && Docker::Util.build_auth_header(credentials) || {}
122
- body = ''
124
+ body = +''
123
125
  conn.post(
124
126
  '/images/create',
125
127
  opts,
@@ -168,7 +170,7 @@ class Docker::Image
168
170
  end
169
171
  nil
170
172
  else
171
- string = ''
173
+ string = +''
172
174
  save_stream(names, {}, conn, &response_block_for_save(string))
173
175
  string
174
176
  end
@@ -196,7 +198,7 @@ class Docker::Image
196
198
  def load(tar, opts = {}, conn = Docker.connection, creds = nil, &block)
197
199
  headers = build_headers(creds)
198
200
  io = tar.is_a?(String) ? File.open(tar, 'rb') : tar
199
- body = ""
201
+ body = +""
200
202
  conn.post(
201
203
  '/images/load',
202
204
  opts,
@@ -267,7 +269,7 @@ class Docker::Image
267
269
 
268
270
  # Given a Dockerfile as a string, builds an Image.
269
271
  def build(commands, opts = {}, connection = Docker.connection, &block)
270
- body = ""
272
+ body = +""
271
273
  connection.post(
272
274
  '/build', opts,
273
275
  :body => Docker::Util.create_tar('Dockerfile' => commands),
@@ -288,7 +290,7 @@ class Docker::Image
288
290
  headers = build_headers(creds)
289
291
 
290
292
  # The response_block passed to Excon will build up this body variable.
291
- body = ""
293
+ body = +""
292
294
  connection.post(
293
295
  '/build', opts,
294
296
  :headers => headers,
@@ -340,7 +342,7 @@ class Docker::Image
340
342
  # Convience method to get the Dockerfile for a file hash and a path to
341
343
  # output to.
342
344
  def dockerfile_for(file_hash, output_path)
343
- dockerfile = "from #{self.id}\n"
345
+ dockerfile = +"from #{self.id}\n"
344
346
 
345
347
  file_hash.keys.each do |basename|
346
348
  dockerfile << "add #{basename} #{output_path}\n"
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This class represents all the messages either received by chunks from attach
2
4
  class Docker::Messages
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This class represents a messages stack
2
4
  class Docker::MessagesStack
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This class represents a Docker Network.
2
4
  class Docker::Network
3
5
  include Docker::Base
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This class allows image-based tasks to be created.
2
4
  class Docker::ImageTask < Rake::Task
3
5
  def self.scope_name(_scope, task_name)
data/lib/docker/util.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'set'
2
4
 
3
5
  # This module holds shared logic that doesn't really belong anywhere else in the
@@ -1,4 +1,6 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Docker
2
4
  # The version of the docker-api gem.
3
- VERSION = '2.2.0'
5
+ VERSION = '2.4.0'
4
6
  end
data/lib/docker/volume.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # class represents a Docker Volume
2
4
  class Docker::Volume
3
5
  include Docker::Base
data/lib/docker-api.rb CHANGED
@@ -1 +1,3 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'docker'
data/lib/docker.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'cgi'
2
4
  require 'multi_json'
3
5
  require 'excon'
@@ -1,11 +1,15 @@
1
- module Excon
2
- VALID_REQUEST_KEYS << :hijack_block
1
+ # frozen_string_literal: true
3
2
 
3
+ module Excon
4
4
  module Middleware
5
5
  # Hijack is an Excon middleware which parses response headers and then
6
6
  # yields the underlying TCP socket for raw TCP communication (used to
7
7
  # attach to STDIN of containers).
8
8
  class Hijack < Base
9
+ def self.valid_parameter_keys
10
+ [:hijack_block].freeze
11
+ end
12
+
9
13
  def build_response(status, socket)
10
14
  response = {
11
15
  :body => '',
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: 2.2.0
4
+ version: 2.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Swipely, Inc.
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-07-07 00:00:00.000000000 Z
11
+ date: 2024-10-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: excon
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 0.47.0
19
+ version: 0.64.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 0.47.0
26
+ version: 0.64.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: multi_json
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -80,20 +80,6 @@ dependencies:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
- - !ruby/object:Gem::Dependency
84
- name: cane
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- version: '0'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- version: '0'
97
83
  - !ruby/object:Gem::Dependency
98
84
  name: pry
99
85
  requirement: !ruby/object:Gem::Requirement
@@ -175,11 +161,11 @@ files:
175
161
  - lib/docker/version.rb
176
162
  - lib/docker/volume.rb
177
163
  - lib/excon/middlewares/hijack.rb
178
- homepage: https://github.com/swipely/docker-api
164
+ homepage: https://github.com/upserve/docker-api
179
165
  licenses:
180
166
  - MIT
181
167
  metadata: {}
182
- post_install_message:
168
+ post_install_message:
183
169
  rdoc_options: []
184
170
  require_paths:
185
171
  - lib
@@ -194,8 +180,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
194
180
  - !ruby/object:Gem::Version
195
181
  version: '0'
196
182
  requirements: []
197
- rubygems_version: 3.0.6
198
- signing_key:
183
+ rubygems_version: 3.1.6
184
+ signing_key:
199
185
  specification_version: 4
200
186
  summary: A simple REST client for the Docker Remote API
201
187
  test_files: []