Sha256: ef394aee44b4bf974106a30d35a455f41d97c9eea78bb6affdfec064ba95f7d1

Contents?: true

Size: 1.41 KB

Versions: 7

Compression:

Stored size: 1.41 KB

Contents

require 'trollop'

module SimpleDeploy
  module CLI

    class Instances
      include Shared

      def list
        @opts = Trollop::options do
          version SimpleDeploy::VERSION
          banner <<-EOS

List instances for stack.

simple_deploy instances -n STACK_NAME -e ENVIRONMENT

EOS
          opt :help, "Display Help"
          opt :environment, "Set the target environment", :type => :string
          opt :name, "Stack name to manage", :type => :string
          opt :internal, "Use internal IP for ssh commands"
        end

        valid_options? :provided => @opts,
                       :required => [:environment, :name]

        config = Config.new.environment @opts[:environment]

        stack = Stack.new :environment => @opts[:environment],
                          :name        => @opts[:name],
                          :config      => config,
                          :logger      => logger,
                          :internal    => @opts[:internal]

        exit 1 unless stack.exists?

        instances = stack.instances

        if instances.nil? || instances.empty?
          logger.info "Stack '#{@opts[:name]}' does not have any instances."
        else
          puts stack.instances
        end
      end

      def logger
        @logger ||= SimpleDeployLogger.new :log_level => @opts[:log_level]
      end

      def command_summary
        'List instances for stack'
      end

    end

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
simple_deploy-0.7.2 lib/simple_deploy/cli/instances.rb
simple_deploy-0.7.2.beta.1 lib/simple_deploy/cli/instances.rb
simple_deploy-0.7.1 lib/simple_deploy/cli/instances.rb
simple_deploy-0.7.0 lib/simple_deploy/cli/instances.rb
simple_deploy-0.6.7 lib/simple_deploy/cli/instances.rb
simple_deploy-0.6.6 lib/simple_deploy/cli/instances.rb
simple_deploy-0.6.5 lib/simple_deploy/cli/instances.rb