os 0.9.6 → 1.0.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.
Files changed (9) hide show
  1. checksums.yaml +7 -0
  2. data/ChangeLog +6 -1
  3. data/README.rdoc +5 -3
  4. data/Rakefile +0 -1
  5. data/VERSION +1 -1
  6. data/lib/os.rb +279 -271
  7. data/os.gemspec +56 -51
  8. data/spec/os_spec.rb +10 -2
  9. metadata +62 -66
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: dc56c95ef4834741ffeced9727a5750f13fafe33
4
+ data.tar.gz: a2844070c1b7e6abcc8ed1d121f9b7d47e360be3
5
+ SHA512:
6
+ metadata.gz: 9defce3f1298173d446d40af5d7c1b99c945f8daf02159874cc90ad39ba7148327bc004a5891c864ed7df5bfe480280546aa01f2160d9924a4fd7c7a899842b7
7
+ data.tar.gz: e554eef3d21a36fbf876f6230050d43837ba9f4eb8a77c40c9d11ec5966d77839742cad6b621d5320ba362771e6089600a7d9c16d7a5099c8271806bb7cd75a3
data/ChangeLog CHANGED
@@ -1,3 +1,8 @@
1
+ 0.10.0
2
+ freebsd? also some cleanup
3
+
4
+ 0.9.7 use same version number in VERSION and os.gemspec
5
+
1
6
  0.9.6 add changelog, license
2
7
 
3
- 0.9.5 don't count hyper thread by default windows [TODO check linux ]
8
+ 0.9.5 don't count hyper thread by default windows [TODO check linux ]
@@ -1,4 +1,4 @@
1
- The OS gem allows for some easy telling if you're on windows or not.
1
+ The OS gem allows for some easy telling if you're on windows or not.
2
2
 
3
3
  require 'os'
4
4
 
@@ -61,6 +61,7 @@ Related projects:
61
61
  rubygems:
62
62
  Gem::Platform.local
63
63
  Gem.ruby
64
+ 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.
64
65
 
65
66
  the facets gem (has a class similar to rubygems, above)
66
67
  require 'facets/platform'
@@ -68,6 +69,7 @@ the facets gem (has a class similar to rubygems, above)
68
69
 
69
70
  the "platform" gem, itself (a different gem)
70
71
 
71
- 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.
72
+ FFI::Platform::OS
73
+ http://rubydoc.info/github/ffi/ffi/master/FFI/Platform
72
74
 
73
- License: MIT (see LICENSE file)
75
+ License: MIT (see LICENSE file)
data/Rakefile CHANGED
@@ -1,5 +1,4 @@
1
1
  require 'rubygems' if RUBY_VERSION < '1.9.0'
2
- require 'rake'
3
2
 
4
3
  # Don't forget to run rake gemspec with each release! ... I think...
5
4
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.9.6
1
+ 1.0.0
data/lib/os.rb CHANGED
@@ -1,272 +1,280 @@
1
- require 'rbconfig'
2
- require 'yaml'
3
-
4
- # a set of friendly files for determining your Ruby runtime
5
- # treats cygwin as linux
6
- # also treats IronRuby on mono as...linux
7
- class OS
8
- attr_reader :config
9
-
10
- def self.config
11
- @config ||= RbConfig::CONFIG
12
- end
13
-
14
- # true if on windows [and/or jruby]
15
- # false if on linux or cygwin on windows
16
-
17
- def self.windows?
18
- @windows ||= begin
19
- if RUBY_PLATFORM =~ /cygwin/ # i386-cygwin
20
- false
21
- elsif ENV['OS'] == 'Windows_NT'
22
- true
23
- else
24
- false
25
- end
26
- end
27
-
28
- end
29
-
30
- # true for linux, os x, cygwin
31
- def self.posix?
32
- @posix ||=
33
- begin
34
- if OS.windows?
35
- begin
36
- begin
37
- # what if we're on interix...
38
- # untested, of course
39
- Process.wait fork{}
40
- true
41
- rescue NotImplementedError, NoMethodError
42
- false
43
- end
44
- end
45
- else
46
- # assume non windows is posix
47
- true
48
- end
49
- end
50
-
51
- end
52
-
53
- # true for linux, false for windows, os x, cygwin
54
- def self.linux?
55
- if (host_os =~ /linux/)
56
- true
57
- else
58
- false
59
- end
60
- end
61
-
62
- def self.iron_ruby?
63
- @iron_ruby ||= begin
64
- if defined?(RUBY_ENGINE) && (RUBY_ENGINE == 'ironruby')
65
- true
66
- else
67
- false
68
- end
69
- end
70
- end
71
-
72
- def self.bits
73
- @bits ||= begin
74
- if host_cpu =~ /_64$/ || RUBY_PLATFORM =~ /x86_64/
75
- 64
76
- elsif RUBY_PLATFORM == 'java' && ENV_JAVA['sun.arch.data.model'] # "32" or "64":http://www.ruby-forum.com/topic/202173#880613
77
- ENV_JAVA['sun.arch.data.model'].to_i
78
- elsif host_cpu == 'i386'
79
- 32
80
- elsif host_os =~ /32$/ # mingw32, mswin32
81
- 32
82
- else # cygwin only...I think
83
- if 1.size == 8
84
- 64
85
- else
86
- 32
87
- end
88
- end
89
- end
90
- end
91
-
92
-
93
- def self.java?
94
- @java ||= begin
95
- if RUBY_PLATFORM =~ /java/
96
- true
97
- else
98
- false
99
- end
100
- end
101
- end
102
-
103
- def self.ruby_bin
104
- @ruby_exe ||= begin
105
- File::join(config['bindir'], config['ruby_install_name']) + config['EXEEXT']
106
- end
107
- end
108
-
109
- def self.mac?
110
- @mac = begin
111
- if host_os =~ /darwin/
112
- true
113
- else
114
- false
115
- end
116
- end
117
- end
118
-
119
- def self.osx?
120
- mac?
121
- end
122
-
123
- def self.x?
124
- mac?
125
- end
126
-
127
-
128
- # amount of memory the current process "is using", in RAM
129
- # (doesn't include any swap memory that it may be using, just that in actual RAM)
130
- # raises 'unknown' on jruby currently
131
- def self.rss_bytes
132
- # attempt to do this in a jruby friendly way
133
- if OS::Underlying.windows?
134
- # MRI, Java, IronRuby, Cygwin
135
- if OS.java?
136
- # no win32ole on 1.5.x, so leave here for compatibility...maybe for awhile :P
137
- require 'java'
138
- mem_bean = java.lang.management.ManagementFactory.getMemoryMXBean
139
- mem_bean.heap_memory_usage.used + mem_bean.non_heap_memory_usage.used
140
- else
141
- wmi = nil
142
- begin
143
- require 'win32ole'
144
- wmi = WIN32OLE.connect("winmgmts://")
145
- rescue LoadError, NoMethodError => e # NoMethod for IronRuby currently [sigh]
146
- raise 'rss unknown for this platform ' + e.to_s
147
- end
148
- processes = wmi.ExecQuery("select * from win32_process where ProcessId = #{Process.pid}")
149
- memory_used = nil
150
- # only allow for one...
151
- for process in processes
152
- raise if memory_used
153
- memory_used = process.WorkingSetSize.to_i
154
- end
155
- memory_used
156
- end
157
- elsif OS.posix? # linux [though I've heard it works in OS X]
158
- kb = `ps -o rss= -p #{Process.pid}`.to_i # in kilobytes
159
- else
160
- raise 'unknown rss for this platform'
161
- end
162
- end
163
-
164
- class Underlying
165
-
166
- def self.bsd?
167
- OS.osx?
168
- end
169
-
170
- def self.windows?
171
- ENV['OS'] == 'Windows_NT'
172
- end
173
-
174
- def self.linux?
175
- OS.host_os =~ /linux/ ? true : false
176
- end
177
-
178
- end
179
-
180
- def self.cygwin?
181
- @cygwin = begin
182
- if RUBY_PLATFORM =~ /-cygwin/
183
- true
184
- else
185
- false
186
- end
187
- end
188
- end
189
-
190
- def self.dev_null
191
- @dev_null ||= begin
192
- if OS.windows?
193
- "NUL"
194
- else
195
- "/dev/null"
196
- end
197
- end
198
- end
199
-
200
- # provides easy way to see the relevant config entries
201
- def self.report
202
- relevant_keys = [
203
- 'arch',
204
- 'host',
205
- 'host_cpu',
206
- 'host_os',
207
- 'host_vendor',
208
- 'target',
209
- 'target_cpu',
210
- 'target_os',
211
- 'target_vendor',
212
- ]
213
- RbConfig::CONFIG.reject {|key, val| !relevant_keys.include? key }.merge({'RUBY_PLATFORM' => RUBY_PLATFORM}).to_yaml
214
- end
215
-
216
- def self.cpu_count
217
- @cpu_count ||=
218
- case RUBY_PLATFORM
219
- when /darwin9/
220
- `hwprefs cpu_count`.to_i
221
- when /darwin10/
222
- (hwprefs_available? ? `hwprefs thread_count` : `sysctl -n hw.ncpu`).to_i
223
- when /linux/
224
- `cat /proc/cpuinfo | grep processor | wc -l`.to_i
225
- when /freebsd/
226
- `sysctl -n hw.ncpu`.to_i
227
- else
228
- if RbConfig::CONFIG['host_os'] =~ /darwin/
229
- (hwprefs_available? ? `hwprefs thread_count` : `sysctl -n hw.ncpu`).to_i
230
- elsif self.windows?
231
- # ENV counts hyper threaded...not good.
232
- # out = ENV['NUMBER_OF_PROCESSORS'].to_i
233
- require 'win32ole'
1
+ require 'rbconfig'
2
+ require 'yaml'
3
+
4
+ # a set of friendly files for determining your Ruby runtime
5
+ # treats cygwin as linux
6
+ # also treats IronRuby on mono as...linux
7
+ class OS
8
+ attr_reader :config
9
+
10
+ def self.config
11
+ @config ||= RbConfig::CONFIG
12
+ end
13
+
14
+ # true if on windows [and/or jruby]
15
+ # false if on linux or cygwin on windows
16
+
17
+ def self.windows?
18
+ @windows ||= begin
19
+ if RUBY_PLATFORM =~ /cygwin/ # i386-cygwin
20
+ false
21
+ elsif ENV['OS'] == 'Windows_NT'
22
+ true
23
+ else
24
+ false
25
+ end
26
+ end
27
+
28
+ end
29
+
30
+ # true for linux, os x, cygwin
31
+ def self.posix?
32
+ @posix ||=
33
+ begin
34
+ if OS.windows?
35
+ begin
36
+ begin
37
+ # what if we're on interix...
38
+ # untested, of course
39
+ Process.wait fork{}
40
+ true
41
+ rescue NotImplementedError, NoMethodError
42
+ false
43
+ end
44
+ end
45
+ else
46
+ # assume non windows is posix
47
+ true
48
+ end
49
+ end
50
+
51
+ end
52
+
53
+ # true for linux, false for windows, os x, cygwin
54
+ def self.linux?
55
+ if (host_os =~ /linux/)
56
+ true
57
+ else
58
+ false
59
+ end
60
+ end
61
+
62
+ def self.freebsd?
63
+ if (host_os =~ /freebsd/)
64
+ true
65
+ else
66
+ false
67
+ end
68
+ end
69
+
70
+ def self.iron_ruby?
71
+ @iron_ruby ||= begin
72
+ if defined?(RUBY_ENGINE) && (RUBY_ENGINE == 'ironruby')
73
+ true
74
+ else
75
+ false
76
+ end
77
+ end
78
+ end
79
+
80
+ def self.bits
81
+ @bits ||= begin
82
+ if host_cpu =~ /_64$/ || RUBY_PLATFORM =~ /x86_64/
83
+ 64
84
+ elsif RUBY_PLATFORM == 'java' && ENV_JAVA['sun.arch.data.model'] # "32" or "64":http://www.ruby-forum.com/topic/202173#880613
85
+ ENV_JAVA['sun.arch.data.model'].to_i
86
+ elsif host_cpu == 'i386'
87
+ 32
88
+ elsif host_os =~ /32$/ # mingw32, mswin32
89
+ 32
90
+ else # cygwin only...I think
91
+ if 1.size == 8
92
+ 64
93
+ else
94
+ 32
95
+ end
96
+ end
97
+ end
98
+ end
99
+
100
+
101
+ def self.java?
102
+ @java ||= begin
103
+ if RUBY_PLATFORM =~ /java/
104
+ true
105
+ else
106
+ false
107
+ end
108
+ end
109
+ end
110
+
111
+ def self.ruby_bin
112
+ @ruby_exe ||= begin
113
+ File::join(config['bindir'], config['ruby_install_name']) + config['EXEEXT']
114
+ end
115
+ end
116
+
117
+ def self.mac?
118
+ @mac = begin
119
+ if host_os =~ /darwin/
120
+ true
121
+ else
122
+ false
123
+ end
124
+ end
125
+ end
126
+
127
+ def self.osx?
128
+ mac?
129
+ end
130
+
131
+ def self.x?
132
+ mac?
133
+ end
134
+
135
+
136
+ # amount of memory the current process "is using", in RAM
137
+ # (doesn't include any swap memory that it may be using, just that in actual RAM)
138
+ # raises 'unknown' on jruby currently
139
+ def self.rss_bytes
140
+ # attempt to do this in a jruby friendly way
141
+ if OS::Underlying.windows?
142
+ # MRI, Java, IronRuby, Cygwin
143
+ if OS.java?
144
+ # no win32ole on 1.5.x, so leave here for compatibility...maybe for awhile :P
145
+ require 'java'
146
+ mem_bean = java.lang.management.ManagementFactory.getMemoryMXBean
147
+ mem_bean.heap_memory_usage.used + mem_bean.non_heap_memory_usage.used
148
+ else
149
+ wmi = nil
150
+ begin
151
+ require 'win32ole'
234
152
  wmi = WIN32OLE.connect("winmgmts://")
235
- cpu = wmi.ExecQuery("select NumberOfCores from Win32_Processor") # don't count hyper-threaded in this
236
- cpu.to_enum.first.NumberOfCores
237
- else
238
- raise 'unknown platform processor_count'
239
- end
240
- end
241
- end
242
-
243
- def self.open_file_command
244
- if OS.doze? || OS.cygwin?
245
- "start"
246
- elsif OS.mac?
247
- "open"
248
- else
249
- # linux...what about cygwin?
250
- "xdg-open"
251
- end
252
-
253
- end
254
-
255
- class << self
256
- alias :doze? :windows? # a joke name but I use it and like it :P
257
- alias :jruby? :java?
258
-
259
- # delegators for relevant config values
260
- %w(host host_cpu host_os).each do |method_name|
261
- define_method(method_name) { config[method_name] }
262
- end
263
-
264
- end
265
-
266
- private
267
-
268
- def self.hwprefs_available?
269
- `which hwprefs` != ''
270
- end
271
-
272
- end
153
+ rescue LoadError, NoMethodError => e # NoMethod for IronRuby currently [sigh]
154
+ raise 'rss unknown for this platform ' + e.to_s
155
+ end
156
+ processes = wmi.ExecQuery("select * from win32_process where ProcessId = #{Process.pid}")
157
+ memory_used = nil
158
+ # only allow for one...
159
+ for process in processes
160
+ raise if memory_used
161
+ memory_used = process.WorkingSetSize.to_i
162
+ end
163
+ memory_used
164
+ end
165
+ elsif OS.posix? # linux [though I've heard it works in OS X]
166
+ `ps -o rss= -p #{Process.pid}`.to_i # in kilobytes
167
+ else
168
+ raise 'unknown rss for this platform'
169
+ end
170
+ end
171
+
172
+ class Underlying
173
+
174
+ def self.bsd?
175
+ OS.osx?
176
+ end
177
+
178
+ def self.windows?
179
+ ENV['OS'] == 'Windows_NT'
180
+ end
181
+
182
+ def self.linux?
183
+ OS.host_os =~ /linux/ ? true : false
184
+ end
185
+
186
+ end
187
+
188
+ def self.cygwin?
189
+ @cygwin = begin
190
+ if RUBY_PLATFORM =~ /-cygwin/
191
+ true
192
+ else
193
+ false
194
+ end
195
+ end
196
+ end
197
+
198
+ def self.dev_null # File::NULL in 1.9.3+
199
+ @dev_null ||= begin
200
+ if OS.windows?
201
+ "NUL"
202
+ else
203
+ "/dev/null"
204
+ end
205
+ end
206
+ end
207
+
208
+ # provides easy way to see the relevant config entries
209
+ def self.report
210
+ relevant_keys = [
211
+ 'arch',
212
+ 'host',
213
+ 'host_cpu',
214
+ 'host_os',
215
+ 'host_vendor',
216
+ 'target',
217
+ 'target_cpu',
218
+ 'target_os',
219
+ 'target_vendor',
220
+ ]
221
+ RbConfig::CONFIG.reject {|key, val| !relevant_keys.include? key }.merge({'RUBY_PLATFORM' => RUBY_PLATFORM}).to_yaml
222
+ end
223
+
224
+ def self.cpu_count
225
+ @cpu_count ||=
226
+ case RUBY_PLATFORM
227
+ when /darwin9/
228
+ `hwprefs cpu_count`.to_i
229
+ when /darwin10/
230
+ (hwprefs_available? ? `hwprefs thread_count` : `sysctl -n hw.ncpu`).to_i
231
+ when /linux/
232
+ `cat /proc/cpuinfo | grep processor | wc -l`.to_i
233
+ when /freebsd/
234
+ `sysctl -n hw.ncpu`.to_i
235
+ else
236
+ if RbConfig::CONFIG['host_os'] =~ /darwin/
237
+ (hwprefs_available? ? `hwprefs thread_count` : `sysctl -n hw.ncpu`).to_i
238
+ elsif self.windows?
239
+ # ENV counts hyper threaded...not good.
240
+ # out = ENV['NUMBER_OF_PROCESSORS'].to_i
241
+ require 'win32ole'
242
+ wmi = WIN32OLE.connect("winmgmts://")
243
+ cpu = wmi.ExecQuery("select NumberOfCores from Win32_Processor") # don't count hyper-threaded in this
244
+ cpu.to_enum.first.NumberOfCores
245
+ else
246
+ raise 'unknown platform processor_count'
247
+ end
248
+ end
249
+ end
250
+
251
+ def self.open_file_command
252
+ if OS.doze? || OS.cygwin?
253
+ "start"
254
+ elsif OS.mac?
255
+ "open"
256
+ else
257
+ # linux...what about cygwin?
258
+ "xdg-open"
259
+ end
260
+
261
+ end
262
+
263
+ class << self
264
+ alias :doze? :windows? # a joke name but I use it and like it :P
265
+ alias :jruby? :java?
266
+
267
+ # delegators for relevant config values
268
+ %w(host host_cpu host_os).each do |method_name|
269
+ define_method(method_name) { config[method_name] }
270
+ end
271
+
272
+ end
273
+
274
+ private
275
+
276
+ def self.hwprefs_available?
277
+ `which hwprefs` != ''
278
+ end
279
+
280
+ end
data/os.gemspec CHANGED
@@ -1,51 +1,56 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in rakefile, and run 'rake gemspec'
4
- # -*- encoding: utf-8 -*-
5
-
6
- Gem::Specification.new do |s|
7
- s.name = %q{os}
8
- s.version = "0.9.4"
9
-
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["rdp", "David McCullars"]
12
- s.date = %q{2011-08-11}
13
- s.description = %q{The OS gem allows for some useful and easy functions, like OS.windows? (=> true or false) OS.bits ( => 32 or 64) etc"}
14
- s.email = %q{rogerpack2005@gmail.com}
15
- s.extra_rdoc_files = [
16
- "README.rdoc"
17
- ]
18
- s.files = [
19
- ".autotest",
20
- ".document",
21
- "Gemfile",
22
- "Gemfile.lock",
23
- "README.rdoc",
24
- "Rakefile",
25
- "VERSION",
26
- "autotest/discover.rb",
27
- "lib/os.rb",
28
- "os.gemspec",
29
- "spec/linux_spec.rb",
30
- "spec/os_spec.rb",
31
- "spec/osx_spec.rb",
32
- "spec/spec_helper.rb"
33
- ]
34
- s.homepage = %q{http://github.com/rdp/os}
35
- s.require_paths = ["lib"]
36
- s.rubygems_version = %q{1.7.2}
37
- s.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.}
38
-
39
- if s.respond_to? :specification_version then
40
- s.specification_version = 3
41
-
42
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
43
- s.add_development_dependency(%q<rspec>, [">= 2.0"])
44
- else
45
- s.add_dependency(%q<rspec>, [">= 2.0"])
46
- end
47
- else
48
- s.add_dependency(%q<rspec>, [">= 2.0"])
49
- end
50
- end
51
-
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+ # stub: os 1.0.0 ruby lib
6
+
7
+ Gem::Specification.new do |s|
8
+ s.name = "os".freeze
9
+ s.version = "1.0.0"
10
+
11
+ s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
12
+ s.require_paths = ["lib".freeze]
13
+ s.authors = ["rdp".freeze, "David McCullars".freeze]
14
+ s.date = "2017-02-20"
15
+ s.description = "The OS gem allows for some useful and easy functions, like OS.windows? (=> true or false) OS.bits ( => 32 or 64) etc\"".freeze
16
+ s.email = "rogerpack2005@gmail.com".freeze
17
+ s.extra_rdoc_files = [
18
+ "ChangeLog",
19
+ "LICENSE",
20
+ "README.rdoc"
21
+ ]
22
+ s.files = [
23
+ ".autotest",
24
+ ".document",
25
+ "ChangeLog",
26
+ "Gemfile",
27
+ "Gemfile.lock",
28
+ "LICENSE",
29
+ "README.rdoc",
30
+ "Rakefile",
31
+ "VERSION",
32
+ "autotest/discover.rb",
33
+ "lib/os.rb",
34
+ "os.gemspec",
35
+ "spec/linux_spec.rb",
36
+ "spec/os_spec.rb",
37
+ "spec/osx_spec.rb",
38
+ "spec/spec_helper.rb"
39
+ ]
40
+ s.homepage = "http://github.com/rdp/os".freeze
41
+ s.rubygems_version = "2.5.2".freeze
42
+ s.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.".freeze
43
+
44
+ if s.respond_to? :specification_version then
45
+ s.specification_version = 4
46
+
47
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
48
+ s.add_development_dependency(%q<rspec>.freeze, [">= 2.0"])
49
+ else
50
+ s.add_dependency(%q<rspec>.freeze, [">= 2.0"])
51
+ end
52
+ else
53
+ s.add_dependency(%q<rspec>.freeze, [">= 2.0"])
54
+ end
55
+ end
56
+
@@ -124,7 +124,7 @@ describe "OS" do
124
124
  assert OS.cpu_count == 2 # my own developer box :P
125
125
  end
126
126
  end
127
-
127
+
128
128
  it "has working cpu count method with no env. variable" do
129
129
  OS.instance_variable_set(:@cpu_count, nil) # reset it
130
130
  if OS.windows?
@@ -132,7 +132,7 @@ describe "OS" do
132
132
  assert OS.cpu_count >= 1
133
133
  end
134
134
  end
135
-
135
+
136
136
  it "should have a start/open command helper" do
137
137
  if OS.doze?
138
138
  assert OS.open_file_command == "start"
@@ -143,6 +143,14 @@ describe "OS" do
143
143
  end
144
144
  end
145
145
 
146
+ it "should have a freebsd? method" do
147
+ if OS.host_os =~ /freebsd/
148
+ assert OS.freebsd? == true
149
+ else
150
+ assert OS.freebsd? == false
151
+ end
152
+ end
153
+
146
154
  end
147
155
 
148
156
  describe OS, "provides access to to underlying config values" do
metadata CHANGED
@@ -1,82 +1,78 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: os
3
- version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 0.9.6
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
6
5
  platform: ruby
7
- authors:
8
- - rdp
9
- - David McCullars
6
+ authors:
7
+ - rdp
8
+ - David McCullars
10
9
  autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
-
14
- date: 2012-02-17 00:00:00 Z
15
- dependencies:
16
- - !ruby/object:Gem::Dependency
17
- name: rspec
18
- version_requirements: &id001 !ruby/object:Gem::Requirement
19
- none: false
20
- requirements:
21
- - - ">="
22
- - !ruby/object:Gem::Version
23
- version: "2.0"
24
- requirement: *id001
25
- prerelease: false
26
- type: :development
27
- description: The OS gem allows for some useful and easy functions, like OS.windows? (=> true or false) OS.bits ( => 32 or 64) etc"
12
+ date: 2017-02-20 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rspec
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ">="
19
+ - !ruby/object:Gem::Version
20
+ version: '2.0'
21
+ type: :development
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ version: '2.0'
28
+ description: The OS gem allows for some useful and easy functions, like OS.windows?
29
+ (=> true or false) OS.bits ( => 32 or 64) etc"
28
30
  email: rogerpack2005@gmail.com
29
31
  executables: []
30
-
31
32
  extensions: []
32
-
33
- extra_rdoc_files:
34
- - ChangeLog
35
- - LICENSE
36
- - README.rdoc
37
- files:
38
- - .autotest
39
- - .document
40
- - ChangeLog
41
- - Gemfile
42
- - Gemfile.lock
43
- - LICENSE
44
- - README.rdoc
45
- - Rakefile
46
- - VERSION
47
- - autotest/discover.rb
48
- - lib/os.rb
49
- - os.gemspec
50
- - spec/linux_spec.rb
51
- - spec/os_spec.rb
52
- - spec/osx_spec.rb
53
- - spec/spec_helper.rb
33
+ extra_rdoc_files:
34
+ - ChangeLog
35
+ - LICENSE
36
+ - README.rdoc
37
+ files:
38
+ - ".autotest"
39
+ - ".document"
40
+ - ChangeLog
41
+ - Gemfile
42
+ - Gemfile.lock
43
+ - LICENSE
44
+ - README.rdoc
45
+ - Rakefile
46
+ - VERSION
47
+ - autotest/discover.rb
48
+ - lib/os.rb
49
+ - os.gemspec
50
+ - spec/linux_spec.rb
51
+ - spec/os_spec.rb
52
+ - spec/osx_spec.rb
53
+ - spec/spec_helper.rb
54
54
  homepage: http://github.com/rdp/os
55
55
  licenses: []
56
-
56
+ metadata: {}
57
57
  post_install_message:
58
58
  rdoc_options: []
59
-
60
- require_paths:
61
- - lib
62
- required_ruby_version: !ruby/object:Gem::Requirement
63
- none: false
64
- requirements:
65
- - - ">="
66
- - !ruby/object:Gem::Version
67
- version: "0"
68
- required_rubygems_version: !ruby/object:Gem::Requirement
69
- none: false
70
- requirements:
71
- - - ">="
72
- - !ruby/object:Gem::Version
73
- version: "0"
59
+ require_paths:
60
+ - lib
61
+ required_ruby_version: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ required_rubygems_version: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
74
71
  requirements: []
75
-
76
72
  rubyforge_project:
77
- rubygems_version: 1.8.13
73
+ rubygems_version: 2.5.2
78
74
  signing_key:
79
- specification_version: 3
80
- 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.
75
+ specification_version: 4
76
+ summary: Simple and easy way to know if you're on windows or not (reliably), as well
77
+ as how many bits the OS is, etc.
81
78
  test_files: []
82
-