class Dockerploy::CLI

The command-line interface for Dockerploy

Public Class Methods

new(args = [], opts = {}, config = {}) click to toggle source
Calls superclass method
# File lib/dockerploy/cli.rb, line 17
def initialize(args = [], opts = {}, config = {})
  super(args, opts, config)
end

Public Instance Methods

build() click to toggle source
# File lib/dockerploy/cli.rb, line 37
def build
  build_options = { tag: options[:tag] }
  Image.new(configuration, build_options).build
end
deploy(environment) click to toggle source
# File lib/dockerploy/cli.rb, line 55
def deploy(environment)
  deploy_options = { tag: options[:tag] }
  config = configuration(environment.to_sym)
  Deploy.new(config, deploy_options).deploy
end
init() click to toggle source
# File lib/dockerploy/cli.rb, line 22
def init
  Template.write
end
ps(environment) click to toggle source
# File lib/dockerploy/cli.rb, line 27
def ps(environment)
  config = configuration(environment.to_sym)
  return unless config.servers
  config.servers.each do |server|
    ssh_client = SSHClient.new(server[:host], server[:username], server[:password], server[:port])
    ssh_client.command(sprintf('docker ps | grep %s', config.application_name))
  end
end
pull(environment) click to toggle source
# File lib/dockerploy/cli.rb, line 49
def pull(environment)
  build_options = { tag: options[:tag] }
  Image.new(configuration(environment.to_sym), build_options).pull
end
push() click to toggle source
# File lib/dockerploy/cli.rb, line 43
def push
  build_options = { tag: options[:tag] }
  Image.new(configuration, build_options).push
end

Private Instance Methods

configuration(env = nil) click to toggle source
# File lib/dockerploy/cli.rb, line 63
def configuration(env = nil)
  @configuration ||= Configuration.new(env: env)
end