aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Vandenberg2009-11-16 09:35:19 -0800
committerAdam Vandenberg2009-11-19 14:03:06 -0800
commitef39adab33d8cb7491e29a9d91f1c67294af25e8 (patch)
tree4657bed1d6e8eb829c5a00ba9618abd2329bb9c7
parent944751f36af79760c4a48f80909d0c98239f680d (diff)
downloadhomebrew-ef39adab33d8cb7491e29a9d91f1c67294af25e8.tar.bz2
Move some helper functions into Hardware
-rw-r--r--Library/Homebrew/hardware.rb14
-rwxr-xr-xbin/brew10
2 files changed, 16 insertions, 8 deletions
diff --git a/Library/Homebrew/hardware.rb b/Library/Homebrew/hardware.rb
index 18d4e6665..b86e06e67 100644
--- a/Library/Homebrew/hardware.rb
+++ b/Library/Homebrew/hardware.rb
@@ -59,10 +59,24 @@ class Hardware
def self.processor_count
@@processor_count ||= `/usr/sbin/sysctl -n hw.ncpu`.to_i
end
+
+ def self.cores_as_words
+ case Hardware.processor_count
+ when 1 then 'single'
+ when 2 then 'dual'
+ when 4 then 'quad'
+ else
+ Hardware.processor_count
+ end
+ end
def self.is_64_bit?
self.sysctl_bool("hw.cpu64bit_capable")
end
+
+ def self.bits
+ Hardware.is_64_bit? ? 64 : 32
+ end
protected
def self.sysctl_bool(property)
diff --git a/bin/brew b/bin/brew
index 2040bd16f..16e07a54a 100755
--- a/bin/brew
+++ b/bin/brew
@@ -42,14 +42,8 @@ end
def dump_config
require 'hardware'
- bits = Hardware.is_64_bit? ? 64 : 32
- cores = case Hardware.processor_count
- when 1 then 'single'
- when 2 then 'dual'
- when 4 then 'quad'
- else
- Hardware.processor_count
- end
+ bits = Hardware.bits
+ cores = Hardware.cores_as_words
llvm = llvm_build
sha = `git rev-parse --verify HEAD`.chomp
kernel_arch = `uname -m`.chomp