Class: KZ::KZLog

Inherits:
Object
  • Object
show all
Defined in:
lib/cocoapods-kz/helpers/kz_log.rb

Class Method Summary collapse

Class Method Details

.log(log_string, type = :normal, skip_count = 1) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/cocoapods-kz/helpers/kz_log.rb', line 15

def self.log(log_string, type = :normal, skip_count = 1)
  if KZGlobalHelper.instance.debug || type == :error || type == :warning
    loc = caller_locations(skip_count, 1).first
    puts "#{loc.path}:#{loc.lineno} ⬇️"
    puts "\e[36m【Cocoapods-kz】\e[0m#{@log_types[type]}【#{type}】#{@log_types[:reset]}#{log_string}"
  end
end

.run_shell(cmd) ⇒ Object



23
24
25
26
27
28
29
30
# File 'lib/cocoapods-kz/helpers/kz_log.rb', line 23

def self.run_shell(cmd)
  stdout, stderr, status = Open3.capture3(cmd)

  self.log(stdout, :normal, 2) unless stdout.empty?
  self.log(stderr, :error, 2) unless stderr.empty?

  return status.success?
end