Sha256: 5e92c35f8c5c50e411169e4e432707705e255947196166013c33030c819d4fc2

Contents?: true

Size: 1.14 KB

Versions: 22

Compression:

Stored size: 1.14 KB

Contents

require_relative 'common'

module Kontena::Cli::Apps
  class StartCommand < Clamp::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 start"

    attr_reader :services

    def execute
      require_config_file(filename)

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

    end

    def start_services(services)
      services.each do |service_name, opts|
        if service_exists?(service_name)
          puts "starting #{prefixed_name(service_name)}"
          start_service(token, prefixed_name(service_name))
        else
          puts "No such service: #{service_name}".colorize(:red)
        end
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
kontena-cli-0.15.5 lib/kontena/cli/apps/start_command.rb
kontena-cli-0.15.5.rc2 lib/kontena/cli/apps/start_command.rb
kontena-cli-0.15.5.rc1 lib/kontena/cli/apps/start_command.rb
kontena-cli-0.15.4 lib/kontena/cli/apps/start_command.rb
kontena-cli-0.15.4.rc2 lib/kontena/cli/apps/start_command.rb
kontena-cli-0.15.4.rc1 lib/kontena/cli/apps/start_command.rb
kontena-cli-0.15.4.pre1 lib/kontena/cli/apps/start_command.rb
kontena-cli-0.15.3 lib/kontena/cli/apps/start_command.rb
kontena-cli-0.15.2 lib/kontena/cli/apps/start_command.rb
kontena-cli-0.15.1 lib/kontena/cli/apps/start_command.rb
kontena-cli-0.15.0 lib/kontena/cli/apps/start_command.rb
kontena-cli-0.15.0.rc3 lib/kontena/cli/apps/start_command.rb
kontena-cli-0.15.0.rc2 lib/kontena/cli/apps/start_command.rb
kontena-cli-0.15.0.rc1 lib/kontena/cli/apps/start_command.rb
kontena-cli-0.14.7 lib/kontena/cli/apps/start_command.rb
kontena-cli-0.14.6 lib/kontena/cli/apps/start_command.rb
kontena-cli-0.14.5 lib/kontena/cli/apps/start_command.rb
kontena-cli-0.14.4 lib/kontena/cli/apps/start_command.rb
kontena-cli-0.14.3 lib/kontena/cli/apps/start_command.rb
kontena-cli-0.14.2 lib/kontena/cli/apps/start_command.rb