Sha256: 6ad5daa801546d931044a6ed40a142e1d8434bff3aa0eac879bb352291b2d647

Contents?: true

Size: 1.52 KB

Versions: 29

Compression:

Stored size: 1.52 KB

Contents

require 'ey-core/cli/subcommand'

module Ey
  module Core
    module Cli
      module Web
        class Disable < Ey::Core::Cli::Subcommand
          title "disable"
          summary "Put up the maintenance page for this application in the given environment."

          option :app,
            short: "a",
            long: "app",
            description: "Name or id of the application whose maintenance page will be put up",
            argument: "app"

          option :environment,
            short: "e",
            long: "environment",
            description: "Name or id of the environment to deploy to.",
            argument: "Environment"

          option :account,
            short: 'c',
            long: 'account',
            description: 'Name or ID of the account that the environment resides in.',
            argument: 'Account name or id'

          def handle
            operator, environment = core_operator_and_environment_for(self.options)
            application           = core_application_for(environment, self.options)

            puts "Enabling maintenance page for #{application.name} on #{environment.name}".green

            request = environment.maintenance(application, "enable")
            request.wait_for { |r| r.ready? }

            if request.successful
              puts "Successfully put up maintenance page".green
            else
              puts "Enabling maintenance mode was not successful".red
              ap request
            end
          end
        end
      end
    end
  end
end

Version data entries

29 entries across 29 versions & 2 rubygems

Version Path
ey-core-3.1.11 lib/ey-core/cli/web/disable.rb
ey-core-3.1.10 lib/ey-core/cli/web/disable.rb
ey-core-3.1.9 lib/ey-core/cli/web/disable.rb
ey-core-3.1.8 lib/ey-core/cli/web/disable.rb
ey-core-3.1.7 lib/ey-core/cli/web/disable.rb
ey-core-3.1.6 lib/ey-core/cli/web/disable.rb
ey-core-3.1.5 lib/ey-core/cli/web/disable.rb
ey-core-3.1.4 lib/ey-core/cli/web/disable.rb
ey-core-3.1.3 lib/ey-core/cli/web/disable.rb