docker-api 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/docker.rb +1 -0
- data/lib/docker/container.rb +7 -7
- data/lib/docker/image.rb +8 -16
- data/lib/docker/model.rb +2 -6
- data/lib/docker/version.rb +1 -1
- metadata +1 -1
data/lib/docker.rb
CHANGED
data/lib/docker/container.rb
CHANGED
@@ -12,19 +12,19 @@ class Docker::Container
|
|
12
12
|
end
|
13
13
|
|
14
14
|
# Get more information about the Container.
|
15
|
-
get :json
|
15
|
+
request :get, :json
|
16
16
|
# Wait for the current command to finish executing.
|
17
|
-
post :wait
|
17
|
+
request :post, :wait
|
18
18
|
# Start the Container.
|
19
|
-
post :start
|
19
|
+
request :post, :start
|
20
20
|
# Inspect the Container's changes to the filesysetem
|
21
|
-
get :changes
|
21
|
+
request :get, :changes
|
22
22
|
# Stop the Container.
|
23
|
-
post :stop
|
23
|
+
request :post, :stop
|
24
24
|
# Kill the Container.
|
25
|
-
post :kill
|
25
|
+
request :post, :kill
|
26
26
|
# Restart the Container
|
27
|
-
post :restart
|
27
|
+
request :post, :restart
|
28
28
|
|
29
29
|
# Export the Container as a tar.
|
30
30
|
def export(&block)
|
data/lib/docker/image.rb
CHANGED
@@ -14,11 +14,11 @@ class Docker::Image
|
|
14
14
|
end
|
15
15
|
|
16
16
|
# Tag the Image.
|
17
|
-
post :tag
|
17
|
+
request :post, :tag
|
18
18
|
# Get more information about the Image.
|
19
|
-
get :json
|
19
|
+
request :get, :json
|
20
20
|
# Get the history of the Image.
|
21
|
-
get :history
|
21
|
+
request :get, :history
|
22
22
|
|
23
23
|
# Given a command and optional list of streams to attach to, run a command on
|
24
24
|
# an Image. This will not modify the Image, but rather create a new Container
|
@@ -104,19 +104,11 @@ class Docker::Image
|
|
104
104
|
end
|
105
105
|
|
106
106
|
def create_tar(input)
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
FileUtils.cd(path)
|
113
|
-
file = File.new('Dockerfile', 'w')
|
114
|
-
file.write(input)
|
115
|
-
file.close
|
116
|
-
Archive::Tar::Minitar.pack_file("Dockerfile", tar)
|
117
|
-
FileUtils.cd(cwd)
|
118
|
-
FileUtils.rm_rf(path)
|
119
|
-
string.tap(&:rewind)
|
107
|
+
output = StringIO.new
|
108
|
+
Gem::Package::TarWriter.new(output) do |tar|
|
109
|
+
tar.add_file('Dockerfile', '640') { |tar_file| tar_file.write(input) }
|
110
|
+
end
|
111
|
+
output.tap(&:rewind)
|
120
112
|
end
|
121
113
|
|
122
114
|
def create_dir_tar(directory)
|
data/lib/docker/model.rb
CHANGED
@@ -8,8 +8,8 @@ module Docker::Model
|
|
8
8
|
def self.included(base)
|
9
9
|
base.class_eval do
|
10
10
|
extend ClassMethods
|
11
|
-
private_class_method :new, :request, :
|
12
|
-
:
|
11
|
+
private_class_method :new, :request, :set_create_request,
|
12
|
+
:set_resource_prefix
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
@@ -58,10 +58,6 @@ module Docker::Model
|
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
61
|
-
[:get, :put, :post, :delete].each do |method|
|
62
|
-
define_method(method) { |*args, &block| request(method, *args, &block) }
|
63
|
-
end
|
64
|
-
|
65
61
|
# Create a Model with the specified body. Raises a
|
66
62
|
# Docker::Error::ArgumentError if the argument is not a Hash. Otherwise,
|
67
63
|
# instances execs the Class's #create_request method with the single
|
data/lib/docker/version.rb
CHANGED