Class: Heighliner::Cmds::Show

Inherits:
Heighliner::Cli show all
Defined in:
lib/heighliner/cmds/show.rb

Instance Attribute Summary

Attributes inherited from Heighliner::Cli

#use_steerfile

Instance Method Summary collapse

Methods inherited from Heighliner::Cli

all_subcommands_usage, #define_options, #initialize, register, run_command, #set_config, #start_services, #stop_app, #stop_services

Methods included from Heighliner::CliOptions

#option, #options

Constructor Details

This class inherits a constructor from Heighliner::Cli

Instance Method Details

#execute(_opts) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/heighliner/cmds/show.rb', line 16

def execute(_opts)
  ensure_setup
  cmd = ARGV.shift
  valid_cmds = 'ports cert-source http-suffix'
  return Optimist.die "Available things to show: #{valid_cmds}" unless cmd

  case cmd
  when 'ports'
    Config.info_out.puts "app: #{app_port}"
    Config.info_out.puts "db: #{db_port}"
  when 'cert-source'
    unless Config.config[:cert_source]
      Optimist.die 'No certificate source set.
        see heighliner set help'
    end

    source = Config.config[:cert_source][:url] || Config.config[:cert_source][:folder]
    Config.info_out.puts source
  when 'http-suffix'
    Config.info_out.puts http_suffix
  end
end

#usageObject



6
7
8
9
10
11
12
13
14
# File 'lib/heighliner/cmds/show.rb', line 6

def usage
  <<~EOS
    Subcommand that shows information about the environment such as the TCP ports or the certificate used for HTTPS.

    USAGE: heighliner show ports
           heighliner show cert-source
           heighliner show http-suffix
  EOS
end