Skip to content
This repository has been archived by the owner on Mar 4, 2018. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Kurtis Rainbolt-Greene committed Nov 23, 2011
2 parents e183c32 + 6c761cf commit 1f4e272
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 27 deletions.
19 changes: 6 additions & 13 deletions README.mdown
Expand Up @@ -14,7 +14,7 @@ Examples
``` ruby
require 'mage'

my_computer = Mage::Profile.new
my_computer = Mage.build

p my_computer.os #=> "Mac OS X 10.6.8 (10K549) (Darwin 10.8.0, 32-bit)"
p my_computer.cpu #=> "Intel Core 2 Duo (2.4 GHz, 2 cores)"
Expand All @@ -28,16 +28,9 @@ Here is an example of the more specific calls:
``` ruby
require 'mage'

my_computer = Mage::Profile.new

case my_computer.platform
when "Darwin"
p my_computer.machine.time_since_boot.class #=> Fixnum
p my_computer.machine.processor_speed #=> "2.4 GHz"
when "Windows"
p my_computer.machine.windows_directory #=> "C:\Windows"
p my_computer.machine.product_id #=> "89578-OEM-7332157-00061"
end
my_computer = Mage.build
p my_computer.time_since_boot.class #=> Fixnum
p my_computer.processor_speed #=> "2.4 GHz"
```


Expand Down Expand Up @@ -65,8 +58,8 @@ That's all you have to do.
To make sure you did everything right do the following:

``` ruby
$ ruby -e "require 'mage'; x = Darwin::Profile.new ; x.platform"
> "Darwin" or "Windows"
ruby -e "require 'mage'; x = Mage.build; p x.os"
"Mac OS X 10.7.2 (11C74) (Darwin 11.2.0, 64-bit)"
```


Expand Down
13 changes: 3 additions & 10 deletions examples/advanced_details.rb
@@ -1,12 +1,5 @@
require 'mage'

my_computer = Mage.build

case my_computer.platform
when "Darwin"
p my_computer.machine.time_since_boot.class #=> Fixnum
p my_computer.machine.processor_speed #=> "2.4 GHz"
when "Windows"
p my_computer.machine.windows_directory #=> "C:\Windows"
p my_computer.machine.product_id #=> "89578-OEM-7332157-00061"
end
my_computer = Mage.build
p my_computer.time_since_boot.class #=> Fixnum
p my_computer.processor_speed #=> "2.4 GHz"
3 changes: 2 additions & 1 deletion lib/mage/darwin.rb
Expand Up @@ -4,12 +4,13 @@ class Mage::Darwin
attr_accessor :data

def initialize
@data = YAML.load prepared `system_profiler SPSoftwareDataType SPNetworkDataType`
@data = YAML.load prepared `system_profiler SPSoftwareDataType SPHardwareDataType`
end

def prepared(profile)
profile.chomp!
profile.gsub!(/\[\d+\]:/,'-')
profile
end
end

Expand Down
6 changes: 3 additions & 3 deletions lib/mage/darwin/hardware.rb
Expand Up @@ -20,15 +20,15 @@ def processor_speed
end

def processor_count
hardware_data["Number Of Processors"]
hardware_data["Number of Processors"]
end

def core_count
hardware_data["Total Number Of Cores"]
hardware_data["Total Number of Cores"]
end

def l2_cache
hardware_data["L2 Cache"]
hardware_data["L2 Cache (per Core)"]
end

def total_memory
Expand Down

0 comments on commit 1f4e272

Please sign in to comment.