Class: ConfigKit::Cli::Rollback

Inherits:
Command
  • Object
show all
Defined in:
lib/config_kit/cli/commands/rollback.rb

Instance Attribute Summary

Attributes inherited from Command

#leftover

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Command

inherited, run

Constructor Details

#initialize(args) ⇒ Rollback

Returns a new instance of Rollback.



5
6
7
8
# File 'lib/config_kit/cli/commands/rollback.rb', line 5

def initialize(args)
  @app = nil
  super(args)
end

Class Method Details

.commandObject



3
# File 'lib/config_kit/cli/commands/rollback.rb', line 3

def self.command; "rollback"; end

Instance Method Details

#runObject



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/config_kit/cli/commands/rollback.rb', line 10

def run
  begin
    @output = ConfigKit::Manager.rollback(@app, @version)
    pp @output.to_h.to_json
  rescue ConfigKit::Cli::Command::CommandFailure
    raise
  rescue => e
    ConfigKit.logger.error "Unexpected error attempting to get config data #{@uri} in env #{@env} for #{@app.nil? ? 'all' : @app}"
    ConfigKit.logger.debug "#{e}: #{e.backtrace.join("\n   ")}"
    raise ConfigKit::Cli::Command::CommandFailure.new(e.to_s)
  end
end