Top Level Namespace

Defined Under Namespace

Modules: HDIUtil, IESD, KextCache, PKGUtil, Tty, Utility Classes: Array

Instance Method Summary collapse

Instance Method Details

#odie(error) ⇒ Object



64
65
66
67
# File 'lib/iesd/utility/tty.rb', line 64

def odie error
  onoe error
  exit 1
end

#oh1(title) ⇒ Object



49
50
51
52
# File 'lib/iesd/utility/tty.rb', line 49

def oh1 title
  title = Tty.truncate(title) if $stdout.tty? && ENV['VERBOSE'].nil?
  puts "#{Tty.green}==>#{Tty.white} #{title}#{Tty.reset}"
end

#ohai(title, *sput) ⇒ Object



43
44
45
46
47
# File 'lib/iesd/utility/tty.rb', line 43

def ohai title, *sput
  title = Tty.truncate(title) if $stdout.tty? && ENV['VERBOSE'].nil?
  puts "#{Tty.blue}==>#{Tty.white} #{title}#{Tty.reset}"
  puts sput unless sput.empty?
end

#onoe(error) ⇒ Object



58
59
60
61
62
# File 'lib/iesd/utility/tty.rb', line 58

def onoe error
  lines = error.to_s.split("\n")
  STDERR.puts "#{Tty.red}Error#{Tty.reset}: #{lines.shift}"
  STDERR.puts lines unless lines.empty?
end

#opoo(warning) ⇒ Object



54
55
56
# File 'lib/iesd/utility/tty.rb', line 54

def opoo warning
  STDERR.puts "#{Tty.red}Warning#{Tty.reset}: #{warning}"
end

#sudo(*args) ⇒ Object



73
74
75
76
77
78
79
80
81
# File 'lib/iesd/utility/tty.rb', line 73

def sudo *args
  args = if args.length > 1
    args.unshift "/usr/bin/sudo"
  else
    "/usr/bin/sudo #{args.first}"
  end
  ohai *args
  system *args
end

#system(*args) ⇒ Object



69
70
71
# File 'lib/iesd/utility/tty.rb', line 69

def system *args
  abort "Failed during: #{args.shell_s}" unless Kernel.system *args
end