Sha256: 64ecbbe7a5caa407eb3bbce493ac892b3146487a6033a50ba8fbaa05861817a3

Contents?: true

Size: 1016 Bytes

Versions: 6

Compression:

Stored size: 1016 Bytes

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|
          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

6 entries across 6 versions & 1 rubygems

Version Path
neptuno-1.0.6 lib/neptuno/docker/down.rb
neptuno-1.0.5 lib/neptuno/docker/down.rb
neptuno-1.0.3 lib/neptuno/docker/down.rb
neptuno-1.0.2 lib/neptuno/docker/down.rb
neptuno-1.0.1 lib/neptuno/docker/down.rb
neptuno-1.0.0 lib/neptuno/docker/down.rb