class Lamma::CLI::Rollback
Attributes
options[R]
path[R]
thor[R]
Public Class Methods
new(options, thor)
click to toggle source
# File lib/lamma/cli/rollback.rb, line 14 def initialize(options, thor) @options = options @thor = thor @conf_path = search_conf_path(options['conf_path'] || Lamma::DEFAULT_CONF_PATH) end
Public Instance Methods
run()
click to toggle source
# File lib/lamma/cli/rollback.rb, line 20 def run unless File.exist?(@conf_path) abort("Config file #{@conf_path} is missing.") end f = Lamma::Function.new(@conf_path) unless f.remote_exist? abort("Remote function #{f.name} doesn't seem to be exists. You have to create or deploy it first") end unless options['alias'] abort("You can't rollback with alias (-a) option.") end a = Lamma::Alias.new(f, options['alias']) unless a.remote_exist? abort("Alias #{a.name} doesn't exist. You have to deploy the function first.") end la = Lamma::Alias.new(f, "#{options['alias']}_#{Lamma::LAST_DEPLOY_SUFFIX}") unless la.remote_exist? abort("Alias #{la.name} doesn't exist. You have to deploy the function first.") end v = a.remote_version lv = la.remote_version if v == lv abort("Aliases #{a.name} and #{la.name} indicates same version #{v}. Deploy it first?") end a.version = lv Lamma.logger.info("Updating alias configuration") a.update end
Private Instance Methods
templates_path()
click to toggle source
# File lib/lamma/cli/rollback.rb, line 61 def templates_path File.expand_path(File.join(File.dirname(__FILE__), '../templates')) end