oh1 stdout display function

This commit is contained in:
Max Howell 2011-08-23 23:19:32 +01:00
parent 31885c2a99
commit 9713bb76b0

View File

@ -8,6 +8,11 @@ class Tty
def yellow; underline 33 ; end
def reset; escape 0; end
def em; underline 39; end
def green; color 92 end
def width
`/usr/bin/tput cols`.strip.to_i
end
private
def color n
@ -27,11 +32,16 @@ end
# args are additional inputs to puts until a nil arg is encountered
def ohai title, *sput
title = title.to_s[0, `/usr/bin/tput cols`.strip.to_i-4] unless ARGV.verbose?
title = title.to_s[0, Tty.width - 4] unless ARGV.verbose?
puts "#{Tty.blue}==>#{Tty.white} #{title}#{Tty.reset}"
puts sput unless sput.empty?
end
def oh1 title
title = title.to_s[0, Tty.width - 4] unless ARGV.verbose?
puts "#{Tty.green}==> #{Tty.reset}#{title}"
end
def opoo warning
puts "#{Tty.red}Warning#{Tty.reset}: #{warning}"
end
@ -272,8 +282,10 @@ module MacOS extend self
end
def xcode_version
`xcodebuild -version 2>&1` =~ /Xcode (\d(\.\d)*)/
$1
@xcode_version ||= begin
`xcodebuild -version 2>&1` =~ /Xcode (\d(\.\d)*)/
$1
end
end
def llvm_build_version
@ -331,7 +343,7 @@ module MacOS extend self
end
def lion?
10.7 == MACOS_VERSION
10.7 <= MACOS_VERSION #Actually Lion or newer
end
def prefer_64_bit?