Class: ThreeScaleToolbox::Commands::ProxyConfigCommand::Promote::PromoteSubcommand

Inherits:
Cri::CommandRunner
  • Object
show all
Includes:
ThreeScaleToolbox::Command
Defined in:
lib/3scale_toolbox/commands/proxy_config_command/promote_command.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ThreeScaleToolbox::Command

#config, #config_file, #exit_with_message, #fetch_required_option, included, #remotes, #threescale_client, #verbose, #verify_ssl

Class Method Details

.commandObject



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/3scale_toolbox/commands/proxy_config_command/promote_command.rb', line 8

def self.command
  Cri::Command.define do
    name        'promote'
    usage       'promote <remote> <service>'
    summary     'Promote latest staging Proxy Configuration to the production environment'
    description 'Promote latest staging Proxy Configuration to the production environment'
    runner PromoteSubcommand

    param   :remote
    param   :service_ref
  end
end

Instance Method Details

#runObject



21
22
23
24
25
26
27
28
# File 'lib/3scale_toolbox/commands/proxy_config_command/promote_command.rb', line 21

def run
  if promotable?
    latest_proxy_config_from.promote(to: to_env)
    puts "Proxy Configuration version #{latest_proxy_config_from.version} promoted to '#{to_env}'"
  else
    warn "warning: Nothing to promote. Proxy Configuration version #{latest_proxy_config_from.version} already promoted to production"
  end
end