os 0.0.0 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +3 -2
- data/VERSION +1 -1
- data/lib/os.rb +25 -0
- data/spec/os_spec.rb +17 -4
- metadata +13 -6
- data/spec/spec.opts +0 -1
- data/spec/spec_helper.rb +0 -9
data/Rakefile
CHANGED
@@ -5,13 +5,14 @@ begin
|
|
5
5
|
require 'jeweler'
|
6
6
|
Jeweler::Tasks.new do |gem|
|
7
7
|
gem.name = "os"
|
8
|
-
gem.summary = %Q{
|
9
|
-
gem.description = %Q{The OS gem allows for some useful and easy functions, like OS.windows? OS.bits ( => 32 or 64) etc"}
|
8
|
+
gem.summary = %Q{Simple and easy way to know if you're on windows or not (reliably), as well as how many bits the OS is, etc.}
|
9
|
+
gem.description = %Q{The OS gem allows for some useful and easy functions, like OS.windows? (=> true or false) OS.bits ( => 32 or 64) etc"}
|
10
10
|
gem.email = "rogerpack2005@gmail.com"
|
11
11
|
gem.homepage = "http://github.com/rdp/os"
|
12
12
|
gem.authors = ["rdp"]
|
13
13
|
gem.add_development_dependency "rspec", ">= 1.2.9"
|
14
14
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
15
|
+
gem.add_development_dependency "sane"
|
15
16
|
end
|
16
17
|
Jeweler::GemcutterTasks.new
|
17
18
|
rescue LoadError
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.1.0
|
data/lib/os.rb
CHANGED
@@ -0,0 +1,25 @@
|
|
1
|
+
class OS
|
2
|
+
|
3
|
+
require 'rbconfig'
|
4
|
+
host_os = RbConfig::CONFIG['host_os']
|
5
|
+
WINDOZE = true if host_os =~ /mswin|mingw/
|
6
|
+
|
7
|
+
# OS.windows?
|
8
|
+
# true if on windows [and/or jruby]
|
9
|
+
# false if on linux or cygwin
|
10
|
+
def self.windows?
|
11
|
+
WINDOZE
|
12
|
+
end
|
13
|
+
|
14
|
+
if host_os =~ /32/
|
15
|
+
BITS = 32
|
16
|
+
else
|
17
|
+
raise unless host_os =~ /64/
|
18
|
+
BITS = 64
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.bits
|
22
|
+
BITS
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
data/spec/os_spec.rb
CHANGED
@@ -1,7 +1,20 @@
|
|
1
|
-
require
|
1
|
+
require 'sane'
|
2
|
+
require_rel '../lib/os'
|
3
|
+
require 'spec/autorun'
|
2
4
|
|
3
|
-
describe "
|
4
|
-
|
5
|
-
|
5
|
+
describe "OS" do
|
6
|
+
|
7
|
+
it "has a windows? method" do
|
8
|
+
if RUBY_PLATFORM =~ /mingw|mswin/
|
9
|
+
assert OS.windows? == true
|
10
|
+
else
|
11
|
+
assert OS.windows? == false
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
it "has a bits method" do
|
16
|
+
if RUBY_PLATFORM =~ /mingw32/
|
17
|
+
assert OS.bits == 32
|
18
|
+
end
|
6
19
|
end
|
7
20
|
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.
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- rdp
|
@@ -22,7 +22,17 @@ dependencies:
|
|
22
22
|
- !ruby/object:Gem::Version
|
23
23
|
version: 1.2.9
|
24
24
|
version:
|
25
|
-
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: sane
|
27
|
+
type: :development
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: "0"
|
34
|
+
version:
|
35
|
+
description: The OS gem allows for some useful and easy functions, like OS.windows? (=> true or false) OS.bits ( => 32 or 64) etc"
|
26
36
|
email: rogerpack2005@gmail.com
|
27
37
|
executables: []
|
28
38
|
|
@@ -38,8 +48,6 @@ files:
|
|
38
48
|
- VERSION
|
39
49
|
- lib/os.rb
|
40
50
|
- spec/os_spec.rb
|
41
|
-
- spec/spec.opts
|
42
|
-
- spec/spec_helper.rb
|
43
51
|
has_rdoc: true
|
44
52
|
homepage: http://github.com/rdp/os
|
45
53
|
licenses: []
|
@@ -67,7 +75,6 @@ rubyforge_project:
|
|
67
75
|
rubygems_version: 1.3.5
|
68
76
|
signing_key:
|
69
77
|
specification_version: 3
|
70
|
-
summary:
|
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.
|
71
79
|
test_files:
|
72
80
|
- spec/os_spec.rb
|
73
|
-
- spec/spec_helper.rb
|
data/spec/spec.opts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
--color
|