aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Howell2011-08-23 23:19:32 +0100
committerMax Howell2011-08-24 22:30:42 +0100
commit26a66f80f6738747404bcc38dbedd74d2cac1b25 (patch)
tree109eaec6f0287de23fd122f619f9e4c7c149c268
parentdb4e971064a0c01944730455d5a357c64f3c96d4 (diff)
downloadhomebrew-26a66f80f6738747404bcc38dbedd74d2cac1b25.tar.bz2
oh1 stdout display function
-rw-r--r--Library/Homebrew/utils.rb20
1 files changed, 16 insertions, 4 deletions
diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb
index e5d7fa81a..a26a6ab93 100644
--- a/Library/Homebrew/utils.rb
+++ b/Library/Homebrew/utils.rb
@@ -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?