os 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/os.rb +49 -44
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.2
|
data/lib/os.rb
CHANGED
@@ -1,53 +1,58 @@
|
|
1
1
|
class OS
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
3
|
+
# treat cygwin as linux
|
4
|
+
# also treat IronRuby on mono as...linux
|
5
|
+
|
6
|
+
if RUBY_PLATFORM =~ /cygwin/ # i386-cygwin
|
7
|
+
WINDOZE = false
|
8
|
+
elsif ENV['OS'] == 'Windows_NT'
|
9
|
+
WINDOZE = true
|
10
|
+
else
|
11
|
+
WINDOZE = false
|
12
|
+
end
|
13
|
+
|
14
|
+
# OS.windows?
|
15
|
+
# true if on windows [and/or jruby]
|
16
|
+
# false if on linux or cygwin
|
17
|
+
def self.windows?
|
18
|
+
WINDOZE
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.linux?
|
22
|
+
!WINDOZE
|
23
|
+
end
|
24
|
+
|
25
|
+
class << self
|
26
|
+
alias :windoze? :windows? #the joke one
|
27
|
+
end
|
28
|
+
|
29
|
+
require 'rbconfig'
|
30
|
+
host_os = RbConfig::CONFIG['host_os']
|
31
|
+
if host_os =~ /32/
|
32
|
+
BITS = 32
|
33
|
+
else
|
34
|
+
if host_os =~ /64/
|
35
|
+
BITS = 64
|
36
|
+
else # cygwin
|
37
|
+
if (1<<32).class == Fixnum
|
30
38
|
BITS = 64
|
31
|
-
else
|
32
|
-
|
33
|
-
BITS = 64
|
34
|
-
else
|
35
|
-
BITS = 32
|
36
|
-
end
|
39
|
+
else
|
40
|
+
BITS = 32
|
37
41
|
end
|
38
42
|
end
|
43
|
+
end
|
39
44
|
|
40
45
|
|
41
|
-
|
42
|
-
|
43
|
-
|
46
|
+
def self.bits
|
47
|
+
BITS
|
48
|
+
end
|
44
49
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
50
|
+
def self.java?
|
51
|
+
if RUBY_PLATFORM =~ /java/
|
52
|
+
true
|
53
|
+
else
|
54
|
+
false
|
55
|
+
end
|
56
|
+
end
|
52
57
|
|
53
|
-
end
|
58
|
+
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.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- rdp
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-12-
|
12
|
+
date: 2009-12-29 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|