Class: Shell
- Inherits:
-
Object
- Object
- Shell
- Defined in:
- lib/core/shell.rb
Class Method Summary collapse
- .abort(message) ⇒ Object
- .color(message, color_key) ⇒ Object
- .confirm(message) ⇒ Object
- .shell ⇒ Object
- .stderr ⇒ Object
- .warn(message) ⇒ Object
- .warn_deprecated(message) ⇒ Object
Class Method Details
.abort(message) ⇒ Object
28 29 30 |
# File 'lib/core/shell.rb', line 28 def self.abort() Kernel.abort(color("ERROR: #{message}\n", :red)) end |
.color(message, color_key) ⇒ Object
12 13 14 |
# File 'lib/core/shell.rb', line 12 def self.color(, color_key) shell.set_color(, color_key) end |
.confirm(message) ⇒ Object
16 17 18 |
# File 'lib/core/shell.rb', line 16 def self.confirm() shell.yes?("#{message} (y/n)") end |
.shell ⇒ Object
4 5 6 |
# File 'lib/core/shell.rb', line 4 def self.shell @shell ||= Thor::Shell::Color.new end |
.stderr ⇒ Object
8 9 10 |
# File 'lib/core/shell.rb', line 8 def self.stderr @stderr ||= $stderr end |
.warn(message) ⇒ Object
20 21 22 |
# File 'lib/core/shell.rb', line 20 def self.warn() stderr.puts(color("WARNING: #{message}\n", :yellow)) end |
.warn_deprecated(message) ⇒ Object
24 25 26 |
# File 'lib/core/shell.rb', line 24 def self.warn_deprecated() stderr.puts(color("DEPRECATED: #{message}\n", :yellow)) end |