Module: Docker
Overview
The top-level module for this gem. It’s purpose is to hold global configuration variables that are used as defaults in other classes.
Defined Under Namespace
Modules: Error, Model, Multipart Classes: Connection, Container, Image
Constant Summary collapse
- VERSION =
"0.0.6"
Instance Attribute Summary collapse
-
#creds ⇒ Object
readonly
Returns the value of attribute creds.
Instance Method Summary collapse
-
#authenticate!(options = {}) ⇒ Object
Login to the Docker registry.
- #connection ⇒ Object
-
#info ⇒ Object
Get more information about the Docker server.
- #options ⇒ Object
- #options=(new_options) ⇒ Object
- #reset_connection! ⇒ Object
- #url ⇒ Object
- #url=(new_url) ⇒ Object
-
#version ⇒ Object
Get the version of Go, Docker, and optionally the Git commit.
Instance Attribute Details
#creds ⇒ Object (readonly)
Returns the value of attribute creds.
14 15 16 |
# File 'lib/docker.rb', line 14 def creds @creds end |
Instance Method Details
#authenticate!(options = {}) ⇒ Object
Login to the Docker registry.
53 54 55 56 57 |
# File 'lib/docker.rb', line 53 def authenticate!( = {}) connection.post(:path => '/auth', :body => ) @creds = .to_json true end |
#connection ⇒ Object
34 35 36 |
# File 'lib/docker.rb', line 34 def connection @connection ||= Connection.new(url, ) end |
#info ⇒ Object
Get more information about the Docker server.
48 49 50 |
# File 'lib/docker.rb', line 48 def info connection.json_request(:get, '/info') end |
#options ⇒ Object
20 21 22 |
# File 'lib/docker.rb', line 20 def ||= { :port => 4243 } end |
#options=(new_options) ⇒ Object
29 30 31 32 |
# File 'lib/docker.rb', line 29 def () = { :port => 4243 }.merge() reset_connection! end |
#reset_connection! ⇒ Object
38 39 40 |
# File 'lib/docker.rb', line 38 def reset_connection! @connection = nil end |
#url ⇒ Object
16 17 18 |
# File 'lib/docker.rb', line 16 def url @url ||= 'http://localhost' end |
#url=(new_url) ⇒ Object
24 25 26 27 |
# File 'lib/docker.rb', line 24 def url=(new_url) @url = new_url reset_connection! end |
#version ⇒ Object
Get the version of Go, Docker, and optionally the Git commit.
43 44 45 |
# File 'lib/docker.rb', line 43 def version connection.json_request(:get, '/version') end |