From fcb747112764c3c02daf853beabc52b1b6ce4e09 Mon Sep 17 00:00:00 2001 From: Corey Donohoe Date: Thu, 27 May 2010 20:55:30 -0700 Subject: [PATCH] updates to make the executable a little more aware of what it needs --- bin/cider | 23 +++++++++++++++++++++++ lib/cider.rb | 1 + 2 files changed, 24 insertions(+) diff --git a/bin/cider b/bin/cider index 6637b3b..9799a0b 100755 --- a/bin/cider +++ b/bin/cider @@ -10,6 +10,29 @@ ENV['EMAIL'] ||= 'noreploy@gmail.com' ENV['EDITOR'] ||= 'vim' ENV['FULLNAME'] ||= 'Marlon Brando' +RECOMMENDED_LLVM = 2206 +MACOS_FULL_VERSION = `/usr/bin/sw_vers -productVersion`.chomp +MACOS_VERSION = /(10\.\d+)(\.\d+)?/.match(MACOS_FULL_VERSION).captures.first.to_f + +if MACOS_VERSION >= 10.6 + begin + xcode_path = `/usr/bin/xcode-select -print-path`.chomp + return nil if xcode_path.empty? + if `#{xcode_path}/usr/bin/llvm-gcc-4.2 -v 2>&1` =~ /LLVM build (\d{4,})/ + if $1.to_i < RECOMMENDED_LLVM + $stderr.puts "You should really upgrade your xcode install" + end + end + rescue + $stderr.puts "You need xcode for this to work :\\" + exit(1) + end +else + $stderr.puts "You should really upgrade to snow leopard" + $stderr.puts "Make sure you have xcode installed and cross your fingers" + $stderr.puts "I've seen it work on leopard though..." +end + Cider::Runner.run # vim:ft=ruby diff --git a/lib/cider.rb b/lib/cider.rb index 2800b8a..4b27b6b 100644 --- a/lib/cider.rb +++ b/lib/cider.rb @@ -11,6 +11,7 @@ def self.run def run system("rm -rf ~/.cider") system("chef-solo -c #{config}") + exit($?) end def config