os 0.6.1 → 0.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (5) hide show
  1. data/README.rdoc +7 -1
  2. data/VERSION +1 -1
  3. data/lib/os.rb +9 -6
  4. data/spec/spec.os.rb +6 -1
  5. metadata +1 -1
@@ -25,6 +25,12 @@ github.com/rdp/os
25
25
 
26
26
  Related:
27
27
 
28
- Gem.ruby method
28
+ rubygems:
29
+ Gem::Platform.local
30
+ Gem.ruby
31
+
32
+ facets gem (similar)
33
+ require 'facets/platform'
34
+ Platform.local
29
35
 
30
36
  the Platform gem
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.1
1
+ 0.6.3
data/lib/os.rb CHANGED
@@ -1,10 +1,8 @@
1
+ # a set of friendly files for determining your Ruby runtime
2
+ # treats cygwin as linux
3
+ # also treats IronRuby on mono as...linux
1
4
  class OS
2
5
 
3
- # treat cygwin as linux
4
- # also treat IronRuby on mono as...linux
5
-
6
-
7
- # OS.windows?
8
6
  # true if on windows [and/or jruby]
9
7
  # false if on linux or cygwin
10
8
  def self.windows?
@@ -50,8 +48,13 @@ class OS
50
48
  def self.bits
51
49
  @bits ||= begin
52
50
  require 'rbconfig'
53
- if RbConfig::CONFIG['host_cpu'] =~ /_64$/ # x86_64
51
+ host_cpu = RbConfig::CONFIG['host_cpu']
52
+ if host_cpu =~ /_64$/ # x86_64
54
53
  64
54
+ elsif RUBY_PLATFORM == 'java' && ENV_JAVA['sun.arch.data.model'] # "32" or "64" http://www.ruby-forum.com/topic/202173#880613
55
+ ENV_JAVA['sun.arch.data.model'].to_i
56
+ elsif host_cpu == 'i386'
57
+ 32
55
58
  elsif RbConfig::CONFIG['host_os'] =~ /32$/ # mingw32, mswin32
56
59
  32
57
60
  else # cygwin only...I think
@@ -1,6 +1,7 @@
1
1
  require 'rubygems' if RUBY_VERSION < '1.9'
2
- require File.dirname(__FILE__) + '/../lib/os' # load before sane
2
+ require File.dirname(__FILE__) + '/../lib/os.rb' # load before sane
3
3
  require 'sane'
4
+ load File.dirname(__FILE__) + '/../lib/os.rb'
4
5
  require 'spec/autorun'
5
6
 
6
7
  describe "OS" do
@@ -27,6 +28,10 @@ describe "OS" do
27
28
  assert OS.bits == 32
28
29
  elsif RUBY_PLATFORM =~ /java/ && RbConfig::CONFIG['host_os'] =~ /32$/
29
30
  assert OS.bits == 32
31
+ elsif RUBY_PLATFORM =~ /java/ && RbConfig::CONFIG['host_cpu'] =~ /i386/
32
+ assert OS.bits == 32
33
+ elsif RUBY_PLATFORM =~ /i386/
34
+ assert OS.bits == 32
30
35
  else
31
36
  pending "os bits not tested!" + RUBY_PLATFORM + ' ' + RbConfig::CONFIG['host_os']
32
37
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: os
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - rdp