Class: NeetoDeploy::CLI::UI

Inherits:
Object
  • Object
show all
Defined in:
lib/neeto_deploy/cli/ui.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeUI

Returns a new instance of UI.



10
11
12
# File 'lib/neeto_deploy/cli/ui.rb', line 10

def initialize
  @shell = Thor::Base.shell.new
end

Instance Attribute Details

#shellObject

Returns the value of attribute shell.



8
9
10
# File 'lib/neeto_deploy/cli/ui.rb', line 8

def shell
  @shell
end

Instance Method Details

#ask(question, echo = true) ⇒ Object



18
19
20
# File 'lib/neeto_deploy/cli/ui.rb', line 18

def ask(question, echo = true)
  shell.ask(question, echo:)
end

#error(statement) ⇒ Object



26
27
28
# File 'lib/neeto_deploy/cli/ui.rb', line 26

def error(statement)
  shell.say(statement, Thor::Shell::Color::RED)
end

#execute_with_loading(msg) ⇒ Object



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

def execute_with_loading(msg)
  @spinner = TTY::Spinner.new("[:spinner] #{msg}", format: :classic)
  @spinner.auto_spin
  yield
  @spinner.stop
end

#info(statement) ⇒ Object



34
35
36
# File 'lib/neeto_deploy/cli/ui.rb', line 34

def info(statement)
  shell.say(statement)
end

#say(statement, color = Thor::Shell::Color::YELLOW) ⇒ Object



14
15
16
# File 'lib/neeto_deploy/cli/ui.rb', line 14

def say(statement, color = Thor::Shell::Color::YELLOW)
  shell.say(statement, color)
end

#success(statement) ⇒ Object



30
31
32
# File 'lib/neeto_deploy/cli/ui.rb', line 30

def success(statement)
  shell.say(statement, Thor::Shell::Color::GREEN)
end

#yes?(question) ⇒ Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/neeto_deploy/cli/ui.rb', line 22

def yes?(question)
  shell.yes?(question)
end