Class: Moku::Command::Rollback

Inherits:
Command
  • Object
show all
Defined in:
lib/moku/command/rollback.rb

Overview

Rollback to a cached release

Instance Attribute Summary

Attributes inherited from Command

#instance_name, #logger, #user

Instance Method Summary collapse

Methods inherited from Command

#authorized?, #instance

Constructor Details

#initialize(instance_name:, user:, cache_id: nil) ⇒ Rollback

Returns a new instance of Rollback.


11
12
13
14
# File 'lib/moku/command/rollback.rb', line 11

def initialize(instance_name:, user:, cache_id: nil)
  super(instance_name: instance_name, user: user)
  @cache_id = cache_id
end

Instance Method Details

#actionObject


16
17
18
# File 'lib/moku/command/rollback.rb', line 16

def action
  :rollback
end

#cacheObject


20
21
22
23
24
25
26
# File 'lib/moku/command/rollback.rb', line 20

def cache
  @cache ||= if cache_id
    instance.caches.find {|cache| cache.id == cache_id }
  else
    instance.caches.first
  end
end