Class: Kerbi::Cli::RootHandler

Inherits:
BaseHandler show all
Defined in:
lib/cli/root_handler.rb

Overview

Top level CLI command handler with Thor.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.start(*args, **kwargs) ⇒ Object

Two things happen here:

  1. Kerbi::Globals.reset is necessary for testing, because memory

is not flushed.



26
27
28
29
30
31
32
33
34
# File 'lib/cli/root_handler.rb', line 26

def self.start(*args, **kwargs)
  begin
    Kerbi::Globals.reset
    super
  rescue Kerbi::Error => e
    #noinspection RubyResolve
    puts e.to_s.colorize(:red).bold
  end
end

Instance Method Details

#consoleObject



48
49
50
51
52
53
54
55
56
57
# File 'lib/cli/root_handler.rb', line 48

def console
  utils::Cli.load_kerbifile(run_opts.project_root)
  values = compile_values
  default_values = compile_default_values
  ARGV.clear
  IRB.setup(eval("__FILE__"), argv: [])
  wrapper = Console.new(values, default_values)
  workspace = IRB::WorkSpace.new(wrapper)
  IRB::Irb.new(workspace).run(IRB.conf)
end

#template(release_name, project_uri) ⇒ Object

Parameters:

  • release_name (String)

    helm-like Kubernetes release name

  • project_uri (String)

    local path like ‘.’ or remote URI



39
40
41
42
43
44
45
# File 'lib/cli/root_handler.rb', line 39

def template(release_name, project_uri)
  mem_dna(release_name, project_uri)
  utils::Cli.load_kerbifile(run_opts.project_root)
  res_dicts = perform_templating
  persist_compiled_values
  echo_data(res_dicts, coerce_type: "Array")
end

#versionObject



60
61
62
# File 'lib/cli/root_handler.rb', line 60

def version
  puts "1"
end