Fix config file name & add colors

This commit is contained in:
Glenn Y. Rolland 2020-03-03 17:56:10 +01:00
parent 3c4f2e5653
commit 149344afd8

View file

@ -1,6 +1,7 @@
# file: help.cr # file: help.cr
require "option_parser" require "option_parser"
require "yaml" require "yaml"
require "colorize"
class Pushokku class Pushokku
alias Options = { alias Options = {
@ -16,7 +17,7 @@ class Pushokku
} }
def parse_options(args) : Options def parse_options(args) : Options
config_file = ".pushokku" config_file = ".pushokku.yml"
docker_compose_yml = "docker-compose.yml" docker_compose_yml = "docker-compose.yml"
environment = "production" environment = "production"
@ -91,6 +92,7 @@ class Pushokku
p3_out = IO::Memory.new p3_out = IO::Memory.new
p3_err = IO::Memory.new p3_err = IO::Memory.new
puts "Pushing image...".colorize(:yellow)
p3 = Process.new "ssh", [host, "gunzip | docker load"], p3 = Process.new "ssh", [host, "gunzip | docker load"],
input: pipe2_reader, output: p3_out, error: p3_err input: pipe2_reader, output: p3_out, error: p3_err
@ -135,10 +137,13 @@ class Pushokku
STDERR.puts "- exit status: #{status.exit_status}" STDERR.puts "- exit status: #{status.exit_status}"
STDERR.puts "- err: #{p3_err}" STDERR.puts "- err: #{p3_err}"
end end
puts "Image pushed successfully!".colorize(:green)
end end
def image_deploy(host, app, version) def image_deploy(host, app, version)
puts "Deploying image...".colorize(:yellow)
Process.run "ssh", [host, "dokku tags:deploy #{app} #{version}"] Process.run "ssh", [host, "dokku tags:deploy #{app} #{version}"]
puts "Image deployed successfully!".colorize(:green)
end end
def self.run(args) def self.run(args)