Module: Afterlife::BaseCli

Included in:
Cdn::Cli, Cli, Config::Cli, Deploy::Cli, Release::Cli
Defined in:
lib/afterlife/base_cli.rb

Instance Method Summary collapse

Instance Method Details

#fatal!(msg) ⇒ Object



34
35
36
37
# File 'lib/afterlife/base_cli.rb', line 34

def fatal!(msg)
  log_error "ERROR: #{msg}"
  exit 1
end

#log_error(message) ⇒ Object



12
13
14
15
# File 'lib/afterlife/base_cli.rb', line 12

def log_error(message)
  say set_color(message, :red)
  say "\n"
end

#log_info(message) ⇒ Object



17
18
19
20
# File 'lib/afterlife/base_cli.rb', line 17

def log_info(message)
  say set_color(message, :cyan)
  say "\n"
end

#log_interruptedObject



22
23
24
25
# File 'lib/afterlife/base_cli.rb', line 22

def log_interrupted
  say ''
  fatal! 'Interrupted'
end

#log_success(message) ⇒ Object



7
8
9
10
# File 'lib/afterlife/base_cli.rb', line 7

def log_success(message)
  say set_color(message, :green)
  say "\n"
end

#sure?(msg) ⇒ Boolean

Returns:

  • (Boolean)


27
28
29
30
31
32
# File 'lib/afterlife/base_cli.rb', line 27

def sure?(msg)
  say msg
  return true if yes?('Are you sure? [y/n]')

  fatal! 'Good bye'
end