Class: Neptuno::Docker::Down
- Defined in:
- lib/neptuno/docker/down.rb
Overview
Stop docker containers for Neptuno project
Constant Summary
Constants inherited from CLI::Base
Constants included from TTY::Command
TTY::Command::TTY, TTY::Command::TTYP
Constants included from TTY::Config
TTY::Config::ABORT_MESSAGE, TTY::Config::TTY
Constants included from TTY::File
TTY::File::ABORT_MESSAGE, TTY::File::TTY
Constants included from TTY::Prompt
Instance Method Summary collapse
Methods inherited from CLI::Base
#command_service_to, #command_services_to, #initialize
Methods included from TTY::Command
#command, #command_p, #neptuno_command
Methods included from TTY::Config
#auto_restart_procs, #config, #configured_services, #docker_compose_hash, #docker_compose_services, #get_dependants, #healthy_services, #json_services_status, #running_services, #services, #services_with_procs, #starting_services
Methods included from TTY::File
#file, #in_service?, #make_service_files, #neptuno_path, #project, #service
Methods included from TTY::Prompt
Constructor Details
This class inherits a constructor from Neptuno::CLI::Base
Instance Method Details
#call(services: [], **options) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/neptuno/docker/down.rb', line 13 def call(services: [], **) command_services_to("go down", all: .fetch(:all), services_as_args: services) do |services| services_to_stop = services.intersection(services_with_procs).intersection(running_services) make_service_files(services_to_stop) system("cd #{neptuno_path} && docker compose stop -t 0 #{services.join(" ")}") system("cd #{neptuno_path} && docker compose rm -f #{services.join(" ")}") system("cd #{neptuno_path} && docker compose down -v #{services.join(" ")}") if .fetch(:volumes) if config.fetch("procfile_manager") == "tmux" services_to_stop.each do |service| system("tmux kill-session -t #{service} 2>/dev/null ") puts "Neptuno killed Tmux session for: #{service}" if `echo $TMUX`.strip.empty? end else system("cd #{neptuno_path} && tmux kill-session -t neptuno") if .fetch(:all) services_to_stop.each do system("cd #{neptuno_path}/procfiles/#{service} && rm .overmind.sock > /dev/null 2>&1") end end end end |