From aa5a2e00a7a89169c23623c217247fac73c4e19d Mon Sep 17 00:00:00 2001 From: Max Howell Date: Sat, 1 Aug 2009 17:54:44 +0100 Subject: [PATCH] Refactor and clean up code --- Library/Homebrew/brewkit.rb | 2 +- Library/Homebrew/hw.model.rb | 44 +++++++++-------------------------- Library/Homebrew/unittest.rb | 45 ++++++++++++++++++------------------ 3 files changed, 34 insertions(+), 57 deletions(-) diff --git a/Library/Homebrew/brewkit.rb b/Library/Homebrew/brewkit.rb index bc208236a5ed..efd55913ec69 100644 --- a/Library/Homebrew/brewkit.rb +++ b/Library/Homebrew/brewkit.rb @@ -41,7 +41,7 @@ #ENV['CFLAGS']="#{ENV['CFLAGS']} -march=nocona -msse3 -mmmx -m64" #ENV['LDFLAGS']="-arch x86_64" - when :xeon, :macpro + when :xeon # TODO what optimisations for xeon? when :ppc then abort "Sorry, Homebrew does not support PowerPC architectures" diff --git a/Library/Homebrew/hw.model.rb b/Library/Homebrew/hw.model.rb index 87e6a6b3c720..6ff81fb6e3b4 100644 --- a/Library/Homebrew/hw.model.rb +++ b/Library/Homebrew/hw.model.rb @@ -13,66 +13,44 @@ def hw_model when "iMac" if major <=4 :core1 - elsif major <=8 - :core2 else - $unknown_hw_model=true + $unknown_hw_model=true if major >8 :core2 end when "MacBookAir" - if major <= 1 - :core2 - else - $unknown_hw_model=true - :core2 - end + $unknown_hw_model=true if major > 1 + :core2 when "MacBook" if major <= 1 :core1 - elsif major <= 4 - :core2 else - $unknown_hw_model=true + $unknown_hw_model=true if major > 4 :core2 end when "MacBookPro" if major <= 1 :core1 - elsif major <= 5 - :core2 else - $unknown_hw_model=true + $unknown_hw_model=true if major > 5 :core2 end when "Macmini" # Mac mini (Core Duo/Solo) - if major <= 1 - :core - else - $unknown_hw_model=true - :core - end + $unknown_hw_model=true if major > 1 + :core when "MacPro" - if major <= 3 - :xeon - else - $unknown_hw_model=true - :xeon - end + $unknown_hw_model=true if major > 3 + :xeon when "PowerBook", "PowerMac", "RackMac" then :ppc when "Xserve" - if major <=2 - :xeon - else - $unknown_hw_model=true - :xeon - end + $unknown_hw_model=true if major > 2 + :xeon when "ADP" then :dunno # Developer Transition Kit when "M43ADP" then :dunno # Development Mac Pro diff --git a/Library/Homebrew/unittest.rb b/Library/Homebrew/unittest.rb index b23db7d58de4..5371ee36e29e 100755 --- a/Library/Homebrew/unittest.rb +++ b/Library/Homebrew/unittest.rb @@ -19,10 +19,9 @@ require 'test/unit' # must be after at_exit -class TestFormula