Class: GDK::Command::Start

Inherits:
BaseCommand show all
Defined in:
lib/gdk/command/start.rb

Overview

Start all enabled services or specified ones only

Instance Attribute Summary

Attributes inherited from BaseCommand

#stderr, #stdout

Instance Method Summary collapse

Methods inherited from BaseCommand

#config, #display_help_message, #initialize, #print_help, #print_ready_message, #ready_messages, validate_config?

Constructor Details

This class inherits a constructor from GDK::Command::BaseCommand

Instance Method Details

#helpObject



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/gdk/command/start.rb', line 7

def help
  <<~HELP
    Usage: gdk start [<args>]

      -h, --help         Display help
      --quiet            Don't display any output
      --show-progress    Indicate when GDK is ready to use
        or
      --open-when-ready  Open the GitLab web UI running in your local GDK installation, using your default web browser
  HELP
end

#run(args = []) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/gdk/command/start.rb', line 19

def run(args = [])
  return true if print_help(args)

  quiet = !args.delete('--quiet').nil?
  show_progress = !args.delete('--show-progress').nil?
  open_when_ready = !args.delete('--open-when-ready').nil?

  result = GDK::Hooks.with_hooks(config.gdk.start_hooks, 'gdk start') do
    Runit.start(args, quiet: quiet)
  end

  if args.empty?
    # Only print if run like `gdk start`, not like `gdk start rails-web`
    print_ready_message
  end

  if show_progress
    GDK::Output.puts
    test_url
  elsif open_when_ready
    GDK::Output.puts
    open_in_web_browser
  end

  result
end