Sha256: df4223ac6f5c185553cf2d7a5f04ced439705bcef2cfee056b83abbec215fe0c

Contents?: true

Size: 1.33 KB

Versions: 1

Compression:

Stored size: 1.33 KB

Contents

require 'trollop'

module SimpleDeploy
  module CLI
    class Protect
      def protect
        opts = Trollop::options do
          version SimpleDeploy::VERSION
          banner <<-EOS

Protect a stack.

simple_deploy protect -n STACK_NAME -e ENVIRONMENT -a PROTECTION=ON_OFF

EOS
          opt :help, "Display Help"
          opt :environment, "Set the target environment", :type => :string
          opt :log_level, "Log level:  debug, info, warn, error", :type    => :string,
                                                                  :default => 'info'
          opt :name, "Stack name of stack to protect", :type => :string
        end

        CLI::Shared.valid_options? :provided => opts,
                                   :required => [:environment, :name]

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

        logger = SimpleDeployLogger.new :log_level => opts[:log_level]

        attributes = CLI::Shared.parse_attributes :attributes => opts[:attributes],
                                                  :logger     => logger

        stack = Stack.new :environment => opts[:environment],
                          :name        => opts[:name],
                          :config      => config,
                          :logger      => logger
        stack.update :attributes => attributes
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
simple_deploy-0.5.0 lib/simple_deploy/cli/protect.rb