Class: Kamal::Commands::Base
- Inherits:
-
Object
- Object
- Kamal::Commands::Base
show all
- Defined in:
- lib/kamal/commands/base.rb
Direct Known Subclasses
Accessory, App, Auditor, Builder, Kamal::Commands::Builder::Base, Docker, Hook, Lock, Proxy, Prune, Registry, Server
Constant Summary
collapse
- DOCKER_HEALTH_STATUS_FORMAT =
"'{{if .State.Health}}{{.State.Health.Status}}{{else}}{{.State.Status}}{{end}}'"
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(config) ⇒ Base
Returns a new instance of Base.
9
10
11
|
# File 'lib/kamal/commands/base.rb', line 9
def initialize(config)
@config = config
end
|
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
7
8
9
|
# File 'lib/kamal/commands/base.rb', line 7
def config
@config
end
|
Instance Method Details
#container_id_for(container_name:, only_running: false) ⇒ Object
17
18
19
|
# File 'lib/kamal/commands/base.rb', line 17
def container_id_for(container_name:, only_running: false)
docker :container, :ls, *("--all" unless only_running), "--filter", "name=^#{container_name}$", "--quiet"
end
|
#make_directory(path) ⇒ Object
25
26
27
|
# File 'lib/kamal/commands/base.rb', line 25
def make_directory(path)
[ :mkdir, "-p", path ]
end
|
#make_directory_for(remote_file) ⇒ Object
21
22
23
|
# File 'lib/kamal/commands/base.rb', line 21
def make_directory_for(remote_file)
make_directory Pathname.new(remote_file).dirname.to_s
end
|
#remove_directory(path) ⇒ Object
29
30
31
|
# File 'lib/kamal/commands/base.rb', line 29
def remove_directory(path)
[ :rm, "-r", path ]
end
|
#remove_file(path) ⇒ Object
33
34
35
|
# File 'lib/kamal/commands/base.rb', line 33
def remove_file(path)
[ :rm, path ]
end
|
#run_over_ssh(*command, host:) ⇒ Object
13
14
15
|
# File 'lib/kamal/commands/base.rb', line 13
def run_over_ssh(*command, host:)
"ssh#{ssh_proxy_args} -t #{config.ssh.user}@#{host} -p #{config.ssh.port} '#{command.join(" ").gsub("'", "'\\\\''")}'"
end
|