Class: Releasinator::Printer

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

Class Method Summary collapse

Class Method Details

.ask(msg) ⇒ Object



21
22
23
24
# File 'lib/printer.rb', line 21

def self.ask(msg)
  puts msg.yellow
  $stdin.gets.chomp.downcase
end

.ask_binary(msg) ⇒ Object



26
27
28
29
30
31
32
33
34
35
# File 'lib/printer.rb', line 26

def self.ask_binary(msg)
  answer = self.ask("#{msg} (Y/n)")

  while answer != "y" && answer != "n" do
    puts "Please answer y or n".red
    answer = self.ask("#{msg} (Y/n)")
  end

  return answer == "y"
end

.check_proceed(warning_msg, abort_msg) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/printer.rb', line 13

def self.check_proceed(warning_msg, abort_msg)
  puts "#{warning_msg}  Continue?  (Y/n)".yellow
  if 'n' == $stdin.gets.strip
    self.fail(abort_msg)
    abort()
  end
end

.comment(msg) ⇒ Object



37
38
39
# File 'lib/printer.rb', line 37

def self.comment(msg)
  puts msg.yellow
end

.fail(msg) ⇒ Object



9
10
11
# File 'lib/printer.rb', line 9

def self.fail(msg)
  puts "\xE2\x9C\x98 FAILURE: #{msg}".red
end

.success(msg) ⇒ Object



5
6
7
# File 'lib/printer.rb', line 5

def self.success(msg)
  puts "\xE2\x9C\x94\xEF\xB8\x8E ".light_green + "SUCCESS: #{msg}".green
end