Sha256: 7900c6529ea7931d212feaf87875ea228fe2d7b1ba32b71bf866edfa53ecd42e

Contents?: true

Size: 1.03 KB

Versions: 4

Compression:

Stored size: 1.03 KB

Contents

# frozen_string_literal: true

module Neptuno
  module Docker
    # Stop docker containers for Neptuno project
    class Down < Neptuno::CLI::Base
      desc 'Docker: Stop docker containers for current project'

      option :tmux, type: :boolean, default: false, desc: 'Kill tmux session'
      option :all, type: :boolean, default: false, desc: 'Run on all services'
      argument :services, type: :array, required: false, desc: 'Optional list of services'

      def call(services: [], **options)
        command_services_to('go down', all: options.fetch(:all), services_as_args: services) do |services|
          make_service_files(services)
          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} && tmux kill-session -t neptuno") if options.fetch(:tmux)
          system("cd #{neptuno_path}/procfiles/#{service} && rm .overmind.sock  > /dev/null 2>&1")
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
neptuno-1.0.10 lib/neptuno/docker/down.rb
neptuno-1.0.9 lib/neptuno/docker/down.rb
neptuno-1.0.8 lib/neptuno/docker/down.rb
neptuno-1.0.7 lib/neptuno/docker/down.rb