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.



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

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



46
47
48
49
50
51
52
53
# File 'lib/cli/root_handler.rb', line 46

def console
  utils::Cli.load_kerbifile(run_opts.project_root)
  values = compile_values
  ARGV.clear
  IRB.setup(eval("__FILE__"), argv: [])
  workspace = IRB::WorkSpace.new(Console.new(values))
  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



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

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



56
57
58
# File 'lib/cli/root_handler.rb', line 56

def version
  puts "1"
end