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 =
<<~DOCOPT
  Deploy for %%STEREOTYPE_NAME%% instance.

  Usage:
    __PROGRAM__ [options]
    __PROGRAM__ -h | --help

  Options:
    -h --help                       Show this screen.
    -r --reference=<git-reference>  Git reference to deploy.
    -a --append-dirs=<append-dirs>  Append directories to deploy (List separated by ":").
DOCOPT

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



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

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

#runObject



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

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
# File 'lib/avm/stereotypes/eac_webapp_base0/runner/deploy.rb', line 34

def stereotype_module
  "Avm::Stereotypes::#{stereotype_name}".constantize
end

#stereotype_nameObject



38
39
40
# File 'lib/avm/stereotypes/eac_webapp_base0/runner/deploy.rb', line 38

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