os 0.4.0 → 0.5.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 +10 -3
- data/VERSION +1 -1
- data/lib/os.rb +20 -2
- data/spec/spec.os.rb +3 -3
- metadata +2 -2
data/README.rdoc
CHANGED
@@ -1,6 +1,3 @@
|
|
1
|
-
OS
|
2
|
-
|
3
|
-
|
4
1
|
The OS gem allows for some easy telling if you're on windows or not.
|
5
2
|
|
6
3
|
require 'os'
|
@@ -13,7 +10,17 @@ require 'os'
|
|
13
10
|
>> OS.java?
|
14
11
|
=> true
|
15
12
|
|
13
|
+
>> OS.ruby_exe
|
14
|
+
=> "c:\ruby18\bin\ruby.exe" # or "/usr/local/bin/ruby" or what not
|
15
|
+
|
16
|
+
>> OS.posix?
|
17
|
+
=> false
|
18
|
+
|
16
19
|
If there are any other features you'd like, let me know.
|
17
20
|
|
18
21
|
github.com/rdp/os
|
19
22
|
|
23
|
+
|
24
|
+
Related:
|
25
|
+
Gem.ruby
|
26
|
+
Platform gem
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.5.0
|
data/lib/os.rb
CHANGED
@@ -22,7 +22,25 @@ class OS
|
|
22
22
|
|
23
23
|
# true for linux, os x, cygwin
|
24
24
|
def self.posix?
|
25
|
-
|
25
|
+
@posix ||=
|
26
|
+
begin
|
27
|
+
if OS.windows?
|
28
|
+
begin
|
29
|
+
begin
|
30
|
+
# what if we're on interix...
|
31
|
+
# untested, of course
|
32
|
+
Process.wait fork{}
|
33
|
+
true
|
34
|
+
rescue NotImplementedError
|
35
|
+
false
|
36
|
+
end
|
37
|
+
end
|
38
|
+
else
|
39
|
+
# assume non windows is posix
|
40
|
+
true
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
26
44
|
end
|
27
45
|
|
28
46
|
class << self
|
@@ -60,7 +78,7 @@ class OS
|
|
60
78
|
end
|
61
79
|
end
|
62
80
|
|
63
|
-
def self.
|
81
|
+
def self.ruby_bin
|
64
82
|
@ruby_exe ||= begin
|
65
83
|
require 'rbconfig'
|
66
84
|
config = RbConfig::CONFIG
|
data/spec/spec.os.rb
CHANGED
@@ -8,7 +8,7 @@ describe "OS" do
|
|
8
8
|
it "has a windows? method" do
|
9
9
|
if RUBY_PLATFORM =~ /mingw|mswin/
|
10
10
|
assert OS.windows? == true
|
11
|
-
assert OS.
|
11
|
+
assert OS.doze? == true
|
12
12
|
assert OS.posix? == false
|
13
13
|
else # ltodo jruby
|
14
14
|
if RUBY_PLATFORM =~ /linux/
|
@@ -34,9 +34,9 @@ describe "OS" do
|
|
34
34
|
|
35
35
|
it "should have a ruby.exe method" do
|
36
36
|
if OS.windows?
|
37
|
-
assert OS.
|
37
|
+
assert OS.ruby_bin.include?('ruby.exe')
|
38
38
|
else
|
39
|
-
OS.ruby
|
39
|
+
assert OS.ruby_bin.include?('ruby') && OS.ruby_bin.include?('/')
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
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.5.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-14 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|