os 1.1.0 → 1.1.1

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.
Files changed (8) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +104 -0
  3. data/Rakefile +2 -1
  4. data/VERSION +1 -1
  5. data/lib/os.rb +1 -0
  6. data/os.gemspec +3 -3
  7. metadata +4 -4
  8. data/README.rdoc +0 -78
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e244d18c5f73cd59e53bbad8432687377e660f83122ceaf9c0bec6605fa1944c
4
- data.tar.gz: 124c84467cf346ab9d24dc2853938deb6fea0c0d4d7235d1e6591ad9f732e6d0
3
+ metadata.gz: 267756c34a9e72581c6861c1d50a2b670f579fba25e6e156bf9cd2b3974f60a4
4
+ data.tar.gz: 2bfef965fa2e0da6edad906075fbf82e89d26a33af36c12840da6f28b8e84d3f
5
5
  SHA512:
6
- metadata.gz: d1cb09a1f1fa56c5c669cec11c19209b80cc00a6b409a358fc4f3a217bf6b50e02944be480fca3f4836e29905af6bcb98b68d43a96327f771275e5294becf901
7
- data.tar.gz: b0631f672df0de823538583b577418b8e243c1a588bca03cdeb3af8c1e89b44216f9ae91df7030430040d471e91f998348cd97ab560a4343618f1916502344e1
6
+ metadata.gz: 399f7df8d9e900a3d72e4702cbe2f1a73c62f107a2733074447e22d638b85434bf1368a2a1bb8894357d69fbc1ee692179439ed869d425add596869abbca0a37
7
+ data.tar.gz: c96bf1ba08052c88f1729a326d50a5672cc8c854e9d6149aa5e8428b30136f53392a3d6675813d9c3aeb7be14b076e597e836d2a004e6346cbe6b5c882afc31b
@@ -0,0 +1,104 @@
1
+ The OS gem allows for some easy telling if you're on windows or not.
2
+
3
+ ```ruby
4
+ require 'os'
5
+
6
+ >> OS.windows?
7
+ => true # or OS.doze?
8
+
9
+ >> OS.bits
10
+ => 32
11
+
12
+ >> OS.java?
13
+ => true # if you're running in jruby. Also OS.jruby?
14
+
15
+ >> OS.ruby_bin
16
+ => "c:\ruby18\bin\ruby.exe" # or "/usr/local/bin/ruby" or what not
17
+
18
+ >> OS.posix?
19
+ => false # true for linux, os x, cygwin
20
+
21
+ >> OS.mac? # or OS.osx? or OS.x?
22
+ => false
23
+
24
+ >> OS.dev_null
25
+ => "NUL" # or "/dev/null" depending on which platform
26
+
27
+ >> OS.rss_bytes
28
+ => 12300033 # number of rss bytes this process is using currently. Basically "total in memory footprint" (doesn't include RAM used by the process that's in swap/page file)
29
+
30
+ >> puts OS.report
31
+ ==> # a yaml report of helpful values
32
+ ---
33
+ arch: x86_64-darwin10.6.0
34
+ target_os: darwin10.6.0
35
+ target_vendor: apple
36
+ target_cpu: x86_64
37
+ target: x86_64-apple-darwin10.6.0
38
+ host_os: darwin10.6.0
39
+ host_vendor: apple
40
+ host_cpu: i386
41
+ host: i386-apple-darwin10.6.0
42
+ RUBY_PLATFORM: x86_64-darwin10.6.0
43
+
44
+ >> OS.cpu_count
45
+ => 2 # number of cores, doesn't include hyper-threaded cores.
46
+
47
+ >> OS.open_file_command
48
+ => "start" # or open on mac, or xdg-open on linux (all designed to open a file)
49
+
50
+ >> OS::Underlying.windows?
51
+ => true # true for cygwin or MRI, whereas OS.windows? is false for cygwin
52
+
53
+ >> OS::Underlying.bsd?
54
+ => true # true for OS X
55
+
56
+ >> OS::Underlying.docker?
57
+ => false # true if running inside a Docker container
58
+
59
+ >> pp OS.parse_os_release
60
+ ==> # A hash of details on the current Linux distro (or an exception if not Linux)
61
+ {:NAME=>"Ubuntu",
62
+ :VERSION=>"18.04.4 LTS (Bionic Beaver)",
63
+ :ID=>"ubuntu",
64
+ :ID_LIKE=>"debian",
65
+ :PRETTY_NAME=>"Ubuntu 18.04.4 LTS",
66
+ :VERSION_ID=>"18.04",
67
+ :HOME_URL=>"https://www.ubuntu.com/",
68
+ :SUPPORT_URL=>"https://help.ubuntu.com/",
69
+ :BUG_REPORT_URL=>"https://bugs.launchpad.net/ubuntu/",
70
+ :PRIVACY_POLICY_URL=>
71
+ "https://www.ubuntu.com/legal/terms-and-policies/privacy-policy",
72
+ :VERSION_CODENAME=>"bionic",
73
+ :UBUNTU_CODENAME=>"bionic"}
74
+ ```
75
+
76
+ If there are any other features you'd like, let me know, I'll do what I can to add them :)
77
+
78
+ http://github.com/rdp/os for feedback et al
79
+
80
+ Related projects:
81
+
82
+ rubygems:
83
+
84
+ ```ruby
85
+ Gem::Platform.local
86
+ Gem.ruby
87
+ ```
88
+
89
+ The reason Gem::Platform.local felt wrong to me is that it treated cygwin as windows--which for most build environments, is wrong. Hence the creation of this gem.
90
+
91
+ the facets gem (has a class similar to rubygems, above)
92
+
93
+ ```ruby
94
+ require 'facets/platform'
95
+ Platform.local
96
+ ```
97
+
98
+ the ["platform" gem](http://rubydoc.info/github/ffi/ffi/master/FFI/Platform), itself (a different gem)
99
+
100
+ ```ruby
101
+ FFI::Platform::OS
102
+ ```
103
+
104
+ License: MIT (see LICENSE file)
data/Rakefile CHANGED
@@ -2,7 +2,8 @@ require 'rubygems' if RUBY_VERSION < '1.9.0'
2
2
 
3
3
  # Don't forget to run rake gemspec with each release! ... I think...
4
4
  # then manually edit os.gemspec remove duplicatee rspecs, circular dependency? HUH?
5
- # # also, to release, run gem release pkg/XXXX
5
+ # # then gem build os.gemspec
6
+ # rake build doesn't work???
6
7
 
7
8
  begin
8
9
  require 'jeweler'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.0
1
+ 1.1.1
data/lib/os.rb CHANGED
@@ -288,6 +288,7 @@ class OS
288
288
 
289
289
  File.read('/etc/os-release').each_line do |line|
290
290
  parsed_line = line.chomp.tr('"', '').split('=')
291
+ next if parsed_line.empty?
291
292
  output[parsed_line[0].to_sym] = parsed_line[1]
292
293
  end
293
294
  output
data/os.gemspec CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "os".freeze
9
- s.version = "1.1.0"
9
+ s.version = "1.1.1"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib".freeze]
@@ -17,7 +17,7 @@ Gem::Specification.new do |s|
17
17
  s.extra_rdoc_files = [
18
18
  "ChangeLog",
19
19
  "LICENSE",
20
- "README.rdoc"
20
+ "README.md"
21
21
  ]
22
22
  s.files = [
23
23
  ".autotest",
@@ -26,7 +26,7 @@ Gem::Specification.new do |s|
26
26
  "Gemfile",
27
27
  "Gemfile.lock",
28
28
  "LICENSE",
29
- "README.rdoc",
29
+ "README.md",
30
30
  "Rakefile",
31
31
  "VERSION",
32
32
  "autotest/discover.rb",
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: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - rdp
@@ -61,7 +61,7 @@ extensions: []
61
61
  extra_rdoc_files:
62
62
  - ChangeLog
63
63
  - LICENSE
64
- - README.rdoc
64
+ - README.md
65
65
  files:
66
66
  - ".autotest"
67
67
  - ".document"
@@ -69,7 +69,7 @@ files:
69
69
  - Gemfile
70
70
  - Gemfile.lock
71
71
  - LICENSE
72
- - README.rdoc
72
+ - README.md
73
73
  - Rakefile
74
74
  - VERSION
75
75
  - autotest/discover.rb
@@ -99,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
99
99
  version: '0'
100
100
  requirements: []
101
101
  rubyforge_project:
102
- rubygems_version: 2.7.6
102
+ rubygems_version: 2.7.6.2
103
103
  signing_key:
104
104
  specification_version: 4
105
105
  summary: Simple and easy way to know if you're on windows or not (reliably), as well
@@ -1,78 +0,0 @@
1
- The OS gem allows for some easy telling if you're on windows or not.
2
-
3
- require 'os'
4
-
5
- >> OS.windows?
6
- => true # or OS.doze?
7
-
8
- >> OS.bits
9
- => 32
10
-
11
- >> OS.java?
12
- => true # if you're running in jruby. Also OS.jruby?
13
-
14
- >> OS.ruby_bin
15
- => "c:\ruby18\bin\ruby.exe" # or "/usr/local/bin/ruby" or what not
16
-
17
- >> OS.posix?
18
- => false # true for linux, os x, cygwin
19
-
20
- >> OS.mac? # or OS.osx? or OS.x?
21
- => false
22
-
23
- >> OS.dev_null
24
- => "NUL" # or "/dev/null" depending on which platform
25
-
26
- >> OS.rss_bytes
27
- => 12300033 # number of rss bytes this process is using currently. Basically "total in memory footprint" (doesn't include RAM used by the process that's in swap/page file)
28
-
29
- >> puts OS.report
30
- ==> # a yaml report of helpful values
31
- ---
32
- arch: x86_64-darwin10.6.0
33
- target_os: darwin10.6.0
34
- target_vendor: apple
35
- target_cpu: x86_64
36
- target: x86_64-apple-darwin10.6.0
37
- host_os: darwin10.6.0
38
- host_vendor: apple
39
- host_cpu: i386
40
- host: i386-apple-darwin10.6.0
41
- RUBY_PLATFORM: x86_64-darwin10.6.0
42
-
43
- >> OS.cpu_count
44
- => 2 # number of cores, doesn't include hyper-threaded cores.
45
-
46
- >> OS.open_file_command
47
- => "start" # or open on mac, or xdg-open on linux (all designed to open a file)
48
-
49
- >> OS::Underlying.windows?
50
- => true # true for cygwin or MRI, whereas OS.windows? is false for cygwin
51
-
52
- >> OS::Underlying.bsd?
53
- => true # true for OS X
54
-
55
- >> OS::Underlying.docker?
56
- => false # true if running inside a Docker container
57
-
58
- If there are any other features you'd like, let me know, I'll do what I can to add them :)
59
-
60
- http://github.com/rdp/os for feedback et al
61
-
62
- Related projects:
63
-
64
- rubygems:
65
- Gem::Platform.local
66
- Gem.ruby
67
- The reason Gem::Platform.local felt wrong to me is that it treated cygwin as windows--which for most build environments, is wrong. Hence the creation of this gem.
68
-
69
- the facets gem (has a class similar to rubygems, above)
70
- require 'facets/platform'
71
- Platform.local
72
-
73
- the "platform" gem, itself (a different gem)
74
-
75
- FFI::Platform::OS
76
- http://rubydoc.info/github/ffi/ffi/master/FFI/Platform
77
-
78
- License: MIT (see LICENSE file)