os 0.5.0 → 0.6.0
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.
- data/README.rdoc +8 -4
- data/VERSION +1 -1
- data/lib/os.rb +19 -17
- data/spec/spec.os.rb +12 -2
- metadata +2 -2
data/README.rdoc
CHANGED
@@ -10,17 +10,21 @@ require 'os'
|
|
10
10
|
>> OS.java?
|
11
11
|
=> true
|
12
12
|
|
13
|
-
>> OS.
|
13
|
+
>> OS.ruby_bin
|
14
14
|
=> "c:\ruby18\bin\ruby.exe" # or "/usr/local/bin/ruby" or what not
|
15
15
|
|
16
16
|
>> OS.posix?
|
17
17
|
=> false
|
18
18
|
|
19
|
+
>> OS.mac?
|
20
|
+
=> false
|
21
|
+
|
19
22
|
If there are any other features you'd like, let me know.
|
20
23
|
|
21
24
|
github.com/rdp/os
|
22
25
|
|
23
|
-
|
24
26
|
Related:
|
25
|
-
|
26
|
-
|
27
|
+
|
28
|
+
Gem.ruby method
|
29
|
+
|
30
|
+
the Platform gem
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.6.0
|
data/lib/os.rb
CHANGED
@@ -34,13 +34,13 @@ class OS
|
|
34
34
|
rescue NotImplementedError
|
35
35
|
false
|
36
36
|
end
|
37
|
+
end
|
38
|
+
else
|
39
|
+
# assume non windows is posix
|
40
|
+
true
|
37
41
|
end
|
38
|
-
else
|
39
|
-
# assume non windows is posix
|
40
|
-
true
|
41
|
-
end
|
42
42
|
end
|
43
|
-
|
43
|
+
|
44
44
|
end
|
45
45
|
|
46
46
|
class << self
|
@@ -50,18 +50,15 @@ class OS
|
|
50
50
|
def self.bits
|
51
51
|
@bits ||= begin
|
52
52
|
require 'rbconfig'
|
53
|
-
|
54
|
-
|
53
|
+
if RbConfig::CONFIG['host_cpu'] =~ /_64$/ # x86_64
|
54
|
+
64
|
55
|
+
elsif RbConfig::CONFIG['host_os'] =~ /32$/ # mingw32, mswin32
|
55
56
|
32
|
56
|
-
else
|
57
|
-
if
|
57
|
+
else # cygwin only...I think
|
58
|
+
if 1.size == 8
|
58
59
|
64
|
59
|
-
else
|
60
|
-
|
61
|
-
64
|
62
|
-
else
|
63
|
-
32
|
64
|
-
end
|
60
|
+
else
|
61
|
+
32
|
65
62
|
end
|
66
63
|
end
|
67
64
|
end
|
@@ -77,7 +74,7 @@ class OS
|
|
77
74
|
end
|
78
75
|
end
|
79
76
|
end
|
80
|
-
|
77
|
+
|
81
78
|
def self.ruby_bin
|
82
79
|
@ruby_exe ||= begin
|
83
80
|
require 'rbconfig'
|
@@ -85,4 +82,9 @@ class OS
|
|
85
82
|
File::join(config['bindir'], config['ruby_install_name']) + config['EXEEXT']
|
86
83
|
end
|
87
84
|
end
|
88
|
-
|
85
|
+
|
86
|
+
def self.mac?
|
87
|
+
RUBY_PLATFORM =~ /darwin/
|
88
|
+
end
|
89
|
+
|
90
|
+
end
|
data/spec/spec.os.rb
CHANGED
@@ -21,6 +21,8 @@ describe "OS" do
|
|
21
21
|
it "has a bits method" do
|
22
22
|
if RUBY_PLATFORM =~ /mingw32/
|
23
23
|
assert OS.bits == 32
|
24
|
+
elsif RUBY_PLATFORM =~ /64/ # linux...
|
25
|
+
assert OS.bits == 64
|
24
26
|
end
|
25
27
|
end
|
26
28
|
|
@@ -34,9 +36,17 @@ describe "OS" do
|
|
34
36
|
|
35
37
|
it "should have a ruby.exe method" do
|
36
38
|
if OS.windows?
|
37
|
-
assert OS.ruby_bin.include?('ruby.exe')
|
39
|
+
assert OS.ruby_bin.include?('ruby.exe')
|
38
40
|
else
|
39
|
-
assert OS.ruby_bin.include?('ruby') && OS.ruby_bin.include?('/')
|
41
|
+
assert OS.ruby_bin.include?('ruby') && OS.ruby_bin.include?('/')
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
it "should have a mac? method" do
|
46
|
+
if RUBY_PLATFORM =~ /darwin/
|
47
|
+
assert OS.mac?
|
48
|
+
else
|
49
|
+
assert !OS.mac?
|
40
50
|
end
|
41
51
|
end
|
42
52
|
|
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.
|
4
|
+
version: 0.6.0
|
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: 2010-01-
|
12
|
+
date: 2010-01-15 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|