Class: PodUpdater::UI

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

Class Method Summary collapse

Class Method Details

.err(msg) ⇒ Object



6
7
8
9
# File 'lib/pod_updater/ui.rb', line 6

def self.err(msg)
  puts msg.colorize(:red)
  self.notification(title: 'pod_updater get error', message: msg)
end

.log_cmd(msg) ⇒ Object



23
24
25
26
27
28
# File 'lib/pod_updater/ui.rb', line 23

def self.log_cmd(msg)
  if msg.kind_of?(Array)
    msg = msg.join(' && ')
  end
  puts msg.to_s.colorize(:blue)
end

.msg(msg) ⇒ Object



15
16
17
# File 'lib/pod_updater/ui.rb', line 15

def self.msg(msg)
  puts msg.colorize(:green)
end

.notification(title: "", message: "", **args) ⇒ Object



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

def self.notification(title: "", message: "", **args)
  `terminal-notifier -title '#{title}' -message '#{message}' -activate 'com.apple.Terminal'`
end

.notification_openurl(title: "", message: "", url: "", **args) ⇒ Object



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

def self.notification_openurl(title: "", message: "", url: "", **args) 
  `terminal-notifier -title '#{title}' -message '#{message}' -open '#{url}'`
end

.success(msg) ⇒ Object



11
12
13
# File 'lib/pod_updater/ui.rb', line 11

def self.success(msg)
  puts msg.colorize(:green)
end

.warning(msg) ⇒ Object



19
20
21
# File 'lib/pod_updater/ui.rb', line 19

def self.warning(msg)
  puts msg.colorize(:yellow)
end