os-name 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +10 -10
- data/lib/os-name.rb +26 -14
- data/lib/os-name/version.rb +1 -1
- metadata +1 -2
- data/Rakefile +0 -1
data/README.md
CHANGED
@@ -2,6 +2,15 @@
|
|
2
2
|
|
3
3
|
A miniscule Ruby gem for checking host OS.
|
4
4
|
|
5
|
+
## Usage
|
6
|
+
|
7
|
+
```ruby
|
8
|
+
require 'os-name'
|
9
|
+
|
10
|
+
OS.name
|
11
|
+
#=> "OS X"
|
12
|
+
```
|
13
|
+
|
5
14
|
## Installation
|
6
15
|
|
7
16
|
Add this line to your application's Gemfile:
|
@@ -14,13 +23,4 @@ And then execute:
|
|
14
23
|
|
15
24
|
Or install it yourself as:
|
16
25
|
|
17
|
-
$ gem install os-name
|
18
|
-
|
19
|
-
## Usage
|
20
|
-
|
21
|
-
```ruby
|
22
|
-
require 'os-name'
|
23
|
-
|
24
|
-
OS.name
|
25
|
-
#=> "OS X"
|
26
|
-
```
|
26
|
+
$ gem install os-name
|
data/lib/os-name.rb
CHANGED
@@ -2,21 +2,33 @@ require 'os-name/version'
|
|
2
2
|
require 'rbconfig'
|
3
3
|
|
4
4
|
module OS
|
5
|
-
|
6
|
-
|
5
|
+
class << self
|
6
|
+
def name
|
7
|
+
case RbConfig::CONFIG['host_os']
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
9
|
+
when /linux/
|
10
|
+
'Linux'
|
11
|
+
when /darwin/
|
12
|
+
'OS X'
|
13
|
+
when /mswin|mingw32|windows/
|
14
|
+
'Windows'
|
15
|
+
when /solaris/
|
16
|
+
'Solaris'
|
17
|
+
when /bsd/
|
18
|
+
'BSD'
|
19
|
+
else
|
20
|
+
RbConfig::CONFIG['host_os']
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
alias to_s name
|
25
|
+
|
26
|
+
def osx?
|
27
|
+
name == 'OS X'
|
28
|
+
end
|
29
|
+
|
30
|
+
def windows?
|
31
|
+
name == 'Windows'
|
20
32
|
end
|
21
33
|
end
|
22
34
|
end
|
data/lib/os-name/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: os-name
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -22,7 +22,6 @@ files:
|
|
22
22
|
- Gemfile
|
23
23
|
- LICENSE.txt
|
24
24
|
- README.md
|
25
|
-
- Rakefile
|
26
25
|
- lib/os-name.rb
|
27
26
|
- lib/os-name/version.rb
|
28
27
|
- os-name.gemspec
|
data/Rakefile
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
require "bundler/gem_tasks"
|