Class: NeetoDeploy::CLI::UI
- Inherits:
-
Object
- Object
- NeetoDeploy::CLI::UI
- Defined in:
- lib/neeto_deploy/cli/ui.rb
Instance Attribute Summary collapse
-
#shell ⇒ Object
Returns the value of attribute shell.
Instance Method Summary collapse
- #ask(question, echo = true) ⇒ Object
- #error(statement) ⇒ Object
- #execute_with_loading(msg) ⇒ Object
- #info(statement) ⇒ Object
-
#initialize ⇒ UI
constructor
A new instance of UI.
- #say(statement, color = Thor::Shell::Color::YELLOW) ⇒ Object
- #success(statement) ⇒ Object
- #yes?(question) ⇒ Boolean
Constructor Details
#initialize ⇒ UI
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
#shell ⇒ Object
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
22 23 24 |
# File 'lib/neeto_deploy/cli/ui.rb', line 22 def yes?(question) shell.yes?(question) end |