Class: Avm::Stereotypes::EacWebappBase0::Runner::Deploy

Inherits:
EacRubyUtils::Console::DocoptRunner
  • Object
show all
Includes:
EacRubyUtils::Console::Speaker
Defined in:
lib/avm/stereotypes/eac_webapp_base0/runner/deploy.rb

Constant Summary collapse

DOC =
"Deploy for %%STEREOTYPE_NAME%% instance.\n\nUsage:\n  __PROGRAM__ [options]\n  __PROGRAM__ -h | --help\n\nOptions:\n  -h --help                       Show this screen.\n  -r --reference=<git-reference>  Git reference to deploy.\n  -a --append-dirs=<append-dirs>  Append directories to deploy (List separated by \":\").\n"

Instance Method Summary collapse

Constructor Details

#initialize(settings = {}) ⇒ Deploy

Returns a new instance of Deploy.



26
27
28
# File 'lib/avm/stereotypes/eac_webapp_base0/runner/deploy.rb', line 26

def initialize(settings = {})
  super settings.merge(doc: DOC.gsub('%%STEREOTYPE_NAME%%', stereotype_name))
end

Instance Method Details

#deploy_classObject



30
31
32
# File 'lib/avm/stereotypes/eac_webapp_base0/runner/deploy.rb', line 30

def deploy_class
  stereotype_module.const_get('Deploy')
end

#deploy_optionsObject



53
54
55
56
# File 'lib/avm/stereotypes/eac_webapp_base0/runner/deploy.rb', line 53

def deploy_options
  { reference: options.fetch('--reference'),
    appended_directories: ::Avm::PathString.paths(options.fetch('--append-dirs')) }
end

#runObject



44
45
46
47
48
49
50
51
# File 'lib/avm/stereotypes/eac_webapp_base0/runner/deploy.rb', line 44

def run
  result = deploy_class.new(context(:instance), deploy_options).run
  if result.error?
    fatal_error result.to_s
  else
    infov 'Result', result.label
  end
end

#stereotype_moduleObject



34
35
36
37
38
# File 'lib/avm/stereotypes/eac_webapp_base0/runner/deploy.rb', line 34

def stereotype_module
  ::Avm::Stereotypes.const_get(stereotype_name)
rescue ::NameError
  ::Avm.const_get(stereotype_name)
end

#stereotype_nameObject



40
41
42
# File 'lib/avm/stereotypes/eac_webapp_base0/runner/deploy.rb', line 40

def stereotype_name
  self.class.name.deconstantize.demodulize
end