os 0.6.1 → 0.6.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +7 -1
- data/VERSION +1 -1
- data/lib/os.rb +9 -6
- data/spec/spec.os.rb +6 -1
- metadata +1 -1
data/README.rdoc
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.6.
|
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
|
-
|
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
|
data/spec/spec.os.rb
CHANGED
@@ -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
|