Class: Dockerploy::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/dockerploy/cli.rb

Overview

The command-line interface for Dockerploy

Instance Method Summary collapse

Constructor Details

#initialize(args = [], opts = {}, config = {}) ⇒ CLI

Returns a new instance of CLI.



13
14
15
# File 'lib/dockerploy/cli.rb', line 13

def initialize(args = [], opts = {}, config = {})
  super(args, opts, config)
end

Instance Method Details

#buildObject



28
29
30
# File 'lib/dockerploy/cli.rb', line 28

def build
  Image.new(configuration).build
end

#deploy(environment) ⇒ Object



43
44
45
46
# File 'lib/dockerploy/cli.rb', line 43

def deploy(environment)
  config = configuration(environment.to_sym)
  Deploy.new(config).deploy
end

#ps(environment) ⇒ Object



18
19
20
21
22
23
24
25
# File 'lib/dockerploy/cli.rb', line 18

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) ⇒ Object



38
39
40
# File 'lib/dockerploy/cli.rb', line 38

def pull(environment)
  Image.new(configuration(environment.to_sym)).pull
end

#pushObject



33
34
35
# File 'lib/dockerploy/cli.rb', line 33

def push
  Image.new(configuration).push
end