Class: Shell

Inherits:
Object
  • Object
show all
Defined in:
lib/core/shell.rb

Class Method Summary collapse

Class Method Details

.abort(message) ⇒ Object



28
29
30
# File 'lib/core/shell.rb', line 28

def self.abort(message)
  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(message, color_key)
  shell.set_color(message, color_key)
end

.confirm(message) ⇒ Object



16
17
18
# File 'lib/core/shell.rb', line 16

def self.confirm(message)
  shell.yes?("#{message} (y/n)")
end

.shellObject



4
5
6
# File 'lib/core/shell.rb', line 4

def self.shell
  @shell ||= Thor::Shell::Color.new
end

.stderrObject



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(message)
  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(message)
  stderr.puts(color("DEPRECATED: #{message}\n", :yellow))
end