os 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (6) hide show
  1. data/README.rdoc +3 -0
  2. data/VERSION +1 -1
  3. data/lib/os.rb +13 -1
  4. data/spec/spec.os.rb +12 -6
  5. metadata +1 -2
  6. data/spec/go.rb +0 -3
@@ -10,6 +10,9 @@ require 'os'
10
10
  >> OS.bits
11
11
  => 32
12
12
 
13
+ >> OS.java?
14
+ => true
15
+
13
16
  If there are any other features you'd like, let me know.
14
17
 
15
18
  github.com/rdp/os
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.3.0
data/lib/os.rb CHANGED
@@ -15,6 +15,14 @@ class OS
15
15
  WINDOZE
16
16
  end
17
17
 
18
+ def self.linux?
19
+ !WINDOZE
20
+ end
21
+
22
+ class << self
23
+ alias :windoze? :windows? #the joke one
24
+ end
25
+
18
26
  if host_os =~ /32/
19
27
  BITS = 32
20
28
  else
@@ -35,7 +43,11 @@ class OS
35
43
  end
36
44
 
37
45
  def self.java?
38
- RUBY_PLATFORM =~ /java/
46
+ if RUBY_PLATFORM =~ /java/
47
+ true
48
+ else
49
+ false
50
+ end
39
51
  end
40
52
 
41
53
  end
@@ -1,6 +1,8 @@
1
1
  require 'rubygems' if RUBY_VERSION < '1.9'
2
+ # try to help sane gem out a bit
3
+ $: << File.dirname(__FILE__) + '/../lib'
4
+ require 'os'
2
5
  require 'sane'
3
- require_rel '../lib/os'
4
6
  require 'spec/autorun'
5
7
 
6
8
  describe "OS" do
@@ -8,9 +10,13 @@ describe "OS" do
8
10
  it "has a windows? method" do
9
11
  if RUBY_PLATFORM =~ /mingw|mswin/
10
12
  assert OS.windows? == true
11
- else
12
- puts OS.windows?
13
- assert OS.windows? == false
13
+ assert OS.windoze? == true
14
+ assert OS.linux? == false
15
+ else # ltodo jruby
16
+ if RUBY_PLATFORM =~ /linux/
17
+ assert OS.windows? == false
18
+ assert OS.linux? == true
19
+ end
14
20
  end
15
21
  end
16
22
 
@@ -22,9 +28,9 @@ describe "OS" do
22
28
 
23
29
  it "should know if you're on java" do
24
30
  if RUBY_PLATFORM == 'java'
25
- assert OS.java?
31
+ assert OS.java? == true
26
32
  else
27
- assert !OS.java?
33
+ assert OS.java? == false
28
34
  end
29
35
  end
30
36
  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.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - rdp
@@ -77,5 +77,4 @@ signing_key:
77
77
  specification_version: 3
78
78
  summary: Simple and easy way to know if you're on windows or not (reliably), as well as how many bits the OS is, etc.
79
79
  test_files:
80
- - spec/go.rb
81
80
  - spec/spec.os.rb
data/spec/go.rb DELETED
@@ -1,3 +0,0 @@
1
- require 'rbconfig'
2
- require 'pp'
3
- pp RbConfig::CONFIG