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



17
18
19
# File 'lib/dockerploy/cli.rb', line 17

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

Instance Method Details

#buildObject



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

def build
  build_options = { tag: options[:tag] }
  Image.new(configuration, build_options).build
end

#deploy(environment) ⇒ Object



55
56
57
58
59
# 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

#initObject



22
23
24
# File 'lib/dockerploy/cli.rb', line 22

def init
  Template.write
end

#ps(environment) ⇒ Object



27
28
29
30
31
32
33
34
# 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) ⇒ Object



49
50
51
52
# 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

#pushObject



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

def push
  build_options = { tag: options[:tag] }
  Image.new(configuration, build_options).push
end