lib/rconf/configurators/ruby_configurator.rb in rconf-1.0.5 vs lib/rconf/configurators/ruby_configurator.rb in rconf-1.0.6

- old
+ new

@@ -141,11 +141,11 @@ # true:: Always return true def install_ruby_darwin(ruby) Platform.dispatch(ruby) { :install_ruby_prerequisites } c_version = `system_profiler SPDeveloperToolsDataType -xml | xpath "//*[text()='_items']/following-sibling::array/dict/child::key[text()='spdevtools_version']/following-sibling::string/text()" 2> /dev/null` env = {} - gcc42 = ['/usr/bin/gcc-4.2', '/usr/local/bin/gcc-4.2'].detect { |p| File.executable?(p) } + gcc42 = ['/usr/local/bin/gcc-4.2', '/usr/bin/gcc-4.2'].detect { |p| File.executable?(p) } if c_version =~ /^4\.2\.[0-9]+/ if !gcc42 report_fatal("The C compiler included with Xcode #{c_version} produces buggy ruby interpreters, please install the C compilers from https://github.com/downloads/kennethreitz/osx-gcc-installer/GCC-10.7-v2.pkg or update your version of Xcode and re-run rconf") else env['CC'] = gcc42 @@ -198,11 +198,18 @@ # No pre-requesites to install ree or Matz ruby on Mac (TBD others) # # === Return # true:: Always return true def install_ruby_prerequisites_darwin(ruby) - if ruby =~ /1\.8/ - report_check("Detected ruby 1.8 install, making sure gcc 4.2 is available") + version_output = `sw_vers` + if m = /ProductVersion:\s*([0-9.]+)/m.match(version_output) + osx_version = m[1].split(".").map { |c| c.to_i } + else + raise RuntimeError, "Can't determine OS X version from sw_vers output (#{version_output})" + end + + if (osx_version[0] > 10 || osx_version[1] > 6) + report_check("installing non-LLVM GCC 4.2") PackageInstaller.install('https://raw.github.com/Homebrew/homebrew-dupes/master/apple-gcc42.rb', :abort_on_failure => "Could not install gcc 4.2") report_success end true