Class: Lamma::CLI::Deploy

Inherits:
Object
  • Object
show all
Includes:
SharedHelpers
Defined in:
lib/lamma/cli/deploy.rb

Constant Summary

Constants included from SharedHelpers

SharedHelpers::DEFAULT_PROFILE

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from SharedHelpers

#ini_config, #ini_credentials, #region_or_raise, #search_conf_path

Constructor Details

#initialize(options, thor) ⇒ Deploy

Returns a new instance of Deploy.



14
15
16
17
18
# File 'lib/lamma/cli/deploy.rb', line 14

def initialize(options, thor)
  @options = options
  @thor = thor
  @conf_path = search_conf_path(options['conf_path'] || Lamma::DEFAULT_CONF_PATH)
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



12
13
14
# File 'lib/lamma/cli/deploy.rb', line 12

def options
  @options
end

#thorObject (readonly)

Returns the value of attribute thor.



12
13
14
# File 'lib/lamma/cli/deploy.rb', line 12

def thor
  @thor
end

Instance Method Details

#runObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/lamma/cli/deploy.rb', line 20

def run
  unless File.exist?(@conf_path)
    abort("Config file #{@conf_path} is missing.")
  end

  f = Lamma::Function.new(@conf_path)
  update_or_create_function(f)

  new_version = f.publish_version(options['message']).version

  if options['alias']
    update_or_create_alias(f, new_version)
  end
end