class SSHKit::Host

Attributes

docker_host_id[RW]
docker_options[W]

Public Instance Methods

docker=(hash) click to toggle source
# File lib/sshkit/docker_host_ext.rb, line 15
def docker=(hash)
  @docker_host_id = hash.__id__
  @hostname = "(docker "
  @user ||= 'root'
  @port = @docker_host_id # Use hash id to ident host by injecting to port
  docker_options.update hash.symbolize_keys
  if docker_options.has_key?(:image)
    @hostname << "image: #{@docker_options[:image]})"
  elsif @docker_options.has_key?(:container)
    @hostname << "container: #{@docker_options[:container]})"
  else
    raise ArgumentError, "Please specify image or container for docker! (ex; docker: {image: 'ruby:2.2'})"
  end
end
docker?() click to toggle source
# File lib/sshkit/docker_host_ext.rb, line 7
def docker?
  !docker_options.empty?
end
docker_options() click to toggle source
# File lib/sshkit/docker_host_ext.rb, line 11
def docker_options
  @docker_options ||= {}
end