Sha256: 9cd8572f856b8fee09549f5db88dec043937f080fc982feeef7cfba13d5f05f1

Contents?: true

Size: 1.17 KB

Versions: 100

Compression:

Stored size: 1.17 KB

Contents

require_relative 'common'

module Kontena::Cli::Apps
  class StopCommand < Kontena::Command
    include Kontena::Cli::Common
    include Kontena::Cli::GridOptions
    include Common

    option ['-f', '--file'], 'FILE', 'Specify an alternate Kontena compose file', attribute_name: :filename, default: 'kontena.yml'
    option ['-p', '--project-name'], 'NAME', 'Specify an alternate project name (default: directory name)'

    parameter "[SERVICE] ...", "Services to stop"

    attr_reader :services

    def execute
      require_config_file(filename)

      @services = services_from_yaml(filename, service_list, service_prefix, true)
      if services.size > 0
        stop_services(services)
      elsif !service_list.empty?
        puts "No such service: #{service_list.join(', ')}".colorize(:red)
      end

    end

    def stop_services(services)
      services.each do |service_name, opts|
        if service_exists?(service_name)
          spinner "Sending stop signal to #{service_name.colorize(:cyan)} " do
            stop_service(token, prefixed_name(service_name))
          end
        else
          warning "No such service: #{service_name}"
        end
      end
    end
  end
end

Version data entries

100 entries across 100 versions & 2 rubygems

Version Path
kontena-cli-1.3.5 lib/kontena/cli/apps/stop_command.rb
kontena-cli-1.3.5.rc1 lib/kontena/cli/apps/stop_command.rb
kontena-plugin-app-command-0.1.0 lib/kontena/cli/apps/stop_command.rb
kontena-plugin-app-command-0.1.0.rc1 lib/kontena/cli/apps/stop_command.rb
kontena-cli-1.4.0.pre6 lib/kontena/cli/apps/stop_command.rb
kontena-cli-1.4.0.pre5 lib/kontena/cli/apps/stop_command.rb
kontena-cli-1.4.0.pre4 lib/kontena/cli/apps/stop_command.rb
kontena-cli-1.4.0.pre3 lib/kontena/cli/apps/stop_command.rb
kontena-cli-1.4.0.pre2 lib/kontena/cli/apps/stop_command.rb
kontena-cli-1.4.0.pre1 lib/kontena/cli/apps/stop_command.rb
kontena-cli-1.3.4 lib/kontena/cli/apps/stop_command.rb
kontena-cli-1.3.4.rc1 lib/kontena/cli/apps/stop_command.rb
kontena-cli-1.3.3 lib/kontena/cli/apps/stop_command.rb
kontena-cli-1.3.3.rc1 lib/kontena/cli/apps/stop_command.rb
kontena-cli-1.3.2 lib/kontena/cli/apps/stop_command.rb
kontena-cli-1.3.2.rc2 lib/kontena/cli/apps/stop_command.rb
kontena-cli-1.3.2.rc1 lib/kontena/cli/apps/stop_command.rb
kontena-cli-1.3.1 lib/kontena/cli/apps/stop_command.rb
kontena-cli-1.3.1.rc2 lib/kontena/cli/apps/stop_command.rb
kontena-cli-1.3.1.rc1 lib/kontena/cli/apps/stop_command.rb