Sha256: 59c0c94acb3c72b069c9c160067587c5854d8d767f640d684e42c217a0b78a7a

Contents?: true

Size: 1.23 KB

Versions: 1

Compression:

Stored size: 1.23 KB

Contents

require 'cgi'
require 'json'
require 'excon'
require 'tempfile'
require 'archive/tar/minitar'

# The top-level module for this gem. It's purpose is to hold global
# configuration variables that are used as defaults in other classes.
module Docker
  extend self

  attr_reader :creds

  def url
    @url ||= 'http://localhost'
  end

  def options
    @options ||= { :port => 4243 }
  end

  def url=(new_url)
    @url = new_url
    reset_connection!
  end

  def options=(new_options)
    @options = { :port => 4243 }.merge(new_options)
    reset_connection!
  end

  def connection
    @connection ||= Connection.new(url, options)
  end

  def reset_connection!
    @connection = nil
  end

  # Get the version of Go, Docker, and optionally the Git commit.
  def version
    connection.json_request(:get, '/version')
  end

  # Get more information about the Docker server.
  def info
    connection.json_request(:get, '/info')
  end

  # Login to the Docker registry.
  def authenticate!(options = {})
    @creds = options.to_json
    connection.post(:path => '/auth', :body => @creds)
    true
  end
end

require 'docker/version'
require 'docker/error'
require 'docker/connection'
require 'docker/model'
require 'docker/container'
require 'docker/image'

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
docker-api-1.0.1 lib/docker.rb