os 0.9.4 → 0.9.5
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +8 -2
- data/VERSION +1 -1
- data/lib/os.rb +6 -9
- metadata +53 -60
data/README.rdoc
CHANGED
@@ -15,7 +15,7 @@ The OS gem allows for some easy telling if you're on windows or not.
|
|
15
15
|
=> "c:\ruby18\bin\ruby.exe" # or "/usr/local/bin/ruby" or what not
|
16
16
|
|
17
17
|
>> OS.posix?
|
18
|
-
=> false
|
18
|
+
=> false # true for linux, os x, cygwin
|
19
19
|
|
20
20
|
>> OS.mac? # or OS.osx? or OS.x?
|
21
21
|
=> false
|
@@ -41,11 +41,17 @@ The OS gem allows for some easy telling if you're on windows or not.
|
|
41
41
|
RUBY_PLATFORM: x86_64-darwin10.6.0
|
42
42
|
|
43
43
|
>> OS.cpu_count
|
44
|
-
=> 2 # number of cores
|
44
|
+
=> 2 # number of cores, doesn't include hyper-threaded cores.
|
45
45
|
|
46
46
|
>> OS.open_file_command
|
47
47
|
=> "start" # or open on mac, or xdg-open on linux (all designed to open a file)
|
48
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
|
+
|
49
55
|
If there are any other features you'd like, let me know, I'll do what I can to add them :)
|
50
56
|
|
51
57
|
http://github.com/rdp/os for feedback et al
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.9.
|
1
|
+
0.9.5
|
data/lib/os.rb
CHANGED
@@ -228,15 +228,12 @@ class OS
|
|
228
228
|
if RbConfig::CONFIG['host_os'] =~ /darwin/
|
229
229
|
(hwprefs_available? ? `hwprefs thread_count` : `sysctl -n hw.ncpu`).to_i
|
230
230
|
elsif self.windows?
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
out = cpu.to_enum.first.NumberOfCores
|
238
|
-
end
|
239
|
-
out
|
231
|
+
# counts hyper threaded...not good.
|
232
|
+
# out = ENV['NUMBER_OF_PROCESSORS'].to_i
|
233
|
+
require 'win32ole'
|
234
|
+
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
|
240
237
|
else
|
241
238
|
raise 'unknown platform processor_count'
|
242
239
|
end
|
metadata
CHANGED
@@ -1,80 +1,73 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: os
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.9.5
|
4
5
|
prerelease:
|
5
|
-
version: 0.9.4
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
8
|
-
|
9
|
-
|
7
|
+
authors:
|
8
|
+
- rdp
|
9
|
+
- David McCullars
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
description: The OS gem allows for some useful and easy functions, like OS.windows? (=> true or false) OS.bits ( => 32 or 64) etc"
|
13
|
+
date: 2011-12-07 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: rspec
|
17
|
+
requirement: &23139372 !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
19
|
+
requirements:
|
20
|
+
- - ! '>='
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '2.0'
|
23
|
+
type: :development
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: *23139372
|
26
|
+
description: The OS gem allows for some useful and easy functions, like OS.windows?
|
27
|
+
(=> true or false) OS.bits ( => 32 or 64) etc"
|
29
28
|
email: rogerpack2005@gmail.com
|
30
29
|
executables: []
|
31
|
-
|
32
30
|
extensions: []
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
- spec/spec_helper.rb
|
51
|
-
has_rdoc: true
|
31
|
+
extra_rdoc_files:
|
32
|
+
- README.rdoc
|
33
|
+
files:
|
34
|
+
- .autotest
|
35
|
+
- .document
|
36
|
+
- Gemfile
|
37
|
+
- Gemfile.lock
|
38
|
+
- README.rdoc
|
39
|
+
- Rakefile
|
40
|
+
- VERSION
|
41
|
+
- autotest/discover.rb
|
42
|
+
- lib/os.rb
|
43
|
+
- os.gemspec
|
44
|
+
- spec/linux_spec.rb
|
45
|
+
- spec/os_spec.rb
|
46
|
+
- spec/osx_spec.rb
|
47
|
+
- spec/spec_helper.rb
|
52
48
|
homepage: http://github.com/rdp/os
|
53
49
|
licenses: []
|
54
|
-
|
55
50
|
post_install_message:
|
56
51
|
rdoc_options: []
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
52
|
+
require_paths:
|
53
|
+
- lib
|
54
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
61
55
|
none: false
|
62
|
-
requirements:
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - ! '>='
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '0'
|
60
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
67
61
|
none: false
|
68
|
-
requirements:
|
69
|
-
|
70
|
-
|
71
|
-
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
72
66
|
requirements: []
|
73
|
-
|
74
67
|
rubyforge_project:
|
75
|
-
rubygems_version: 1.
|
68
|
+
rubygems_version: 1.8.11
|
76
69
|
signing_key:
|
77
70
|
specification_version: 3
|
78
|
-
summary: Simple and easy way to know if you're on windows or not (reliably), as well
|
71
|
+
summary: Simple and easy way to know if you're on windows or not (reliably), as well
|
72
|
+
as how many bits the OS is, etc.
|
79
73
|
test_files: []
|
80
|
-
|