sysinfo 0.6.3 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES.txt +11 -1
- data/lib/sysinfo.rb +22 -22
- data/sysinfo.gemspec +1 -1
- metadata +2 -2
data/CHANGES.txt
CHANGED
@@ -1,5 +1,16 @@
|
|
1
1
|
SYSINFO, CHANGES
|
2
2
|
|
3
|
+
|
4
|
+
#### 0.7.0 (2009-08-24) #############################
|
5
|
+
|
6
|
+
NOTE: SysInfo strings are not compatible with previous releases.
|
7
|
+
|
8
|
+
* FIXED: Don't require Win32API when running in JRuby
|
9
|
+
* CHANGE: All references to "win32" are now "windows". This resolves
|
10
|
+
the ambiguity between the OS and the Win32 API.
|
11
|
+
* CHANGE: All references to "i386" are now "x86"
|
12
|
+
|
13
|
+
|
3
14
|
#### 0.6.3 (2009-08-03) #############################
|
4
15
|
|
5
16
|
* FIXED: "warning: already initialized constant System" in JRuby
|
@@ -9,7 +20,6 @@ SYSINFO, CHANGES
|
|
9
20
|
* CHANGE: Updated bin/sysinfo for Drydock 0.6.6
|
10
21
|
* CHANGE: Removed "require 'rubygems'"
|
11
22
|
|
12
|
-
|
13
23
|
#### 0.6.1 (2009-05-25) #############################
|
14
24
|
|
15
25
|
* CHANGE: Removed RedCloth dependency from gemspec.
|
data/lib/sysinfo.rb
CHANGED
@@ -9,20 +9,19 @@ require 'time'
|
|
9
9
|
# specifically lib/platform.rb.
|
10
10
|
class SysInfo < Storable
|
11
11
|
unless defined?(IMPLEMENTATIONS)
|
12
|
-
VERSION = "0.
|
12
|
+
VERSION = "0.7.0".freeze
|
13
13
|
IMPLEMENTATIONS = [
|
14
14
|
|
15
15
|
# These are for JRuby, System.getproperty('os.name').
|
16
16
|
# For a list of all values, see: http://lopica.sourceforge.net/os.html
|
17
|
+
|
17
18
|
#regexp matcher os implementation
|
18
19
|
[/mac\s*os\s*x/i, :unix, :osx ],
|
19
20
|
[/sunos/i, :unix, :solaris ],
|
20
|
-
[/windows\s*ce/i, :
|
21
|
-
[/windows/i, :
|
21
|
+
[/windows\s*ce/i, :windows, :wince ],
|
22
|
+
[/windows/i, :windows, :windows ],
|
22
23
|
[/osx/i, :unix, :osx ],
|
23
|
-
|
24
|
-
# TODO: implement other windows matches: # /djgpp|(cyg|ms|bcc)win|mingw/ (from mongrel)
|
25
|
-
|
24
|
+
|
26
25
|
# These are for RUBY_PLATFORM and JRuby
|
27
26
|
[/java/i, :java, :java ],
|
28
27
|
[/darwin/i, :unix, :osx ],
|
@@ -32,25 +31,26 @@ class SysInfo < Storable
|
|
32
31
|
[/solaris/i, :unix, :solaris ],
|
33
32
|
[/irix/i, :unix, :irix ],
|
34
33
|
[/cygwin/i, :unix, :cygwin ],
|
35
|
-
[/mswin/i, :
|
36
|
-
[/
|
37
|
-
[/
|
38
|
-
[/
|
34
|
+
[/mswin/i, :windows, :windows ],
|
35
|
+
[/djgpp/i, :windows, :djgpp ],
|
36
|
+
[/mingw/i, :windows, :mingw ],
|
37
|
+
[/bccwin/i, :windows, :bccwin ],
|
38
|
+
[/wince/i, :windows, :wince ],
|
39
39
|
[/vms/i, :vms, :vms ],
|
40
40
|
[/os2/i, :os2, :os2 ],
|
41
41
|
[nil, :unknown, :unknown ],
|
42
42
|
].freeze
|
43
43
|
|
44
44
|
ARCHITECTURES = [
|
45
|
-
[/(i\d86)/i, :
|
45
|
+
[/(i\d86)/i, :x86 ],
|
46
46
|
[/x86_64/i, :x86_64 ],
|
47
|
-
[/x86/i, :
|
47
|
+
[/x86/i, :x86 ], # JRuby
|
48
48
|
[/ia64/i, :ia64 ],
|
49
49
|
[/alpha/i, :alpha ],
|
50
50
|
[/sparc/i, :sparc ],
|
51
51
|
[/mips/i, :mips ],
|
52
52
|
[/powerpc/i, :powerpc ],
|
53
|
-
[/universal/i,:
|
53
|
+
[/universal/i,:x86_64 ],
|
54
54
|
[nil, :unknown ],
|
55
55
|
].freeze
|
56
56
|
end
|
@@ -77,7 +77,7 @@ class SysInfo < Storable
|
|
77
77
|
def initialize
|
78
78
|
@vm, @os, @impl, @arch = find_platform_info
|
79
79
|
@hostname, @ipaddress_internal, @uptime = find_network_info
|
80
|
-
require 'Win32API' if @os == :
|
80
|
+
require 'Win32API' if @os == :windows && @vm == :ruby
|
81
81
|
end
|
82
82
|
|
83
83
|
# Returns [vm, os, impl, arch]
|
@@ -180,26 +180,26 @@ class SysInfo < Storable
|
|
180
180
|
end
|
181
181
|
|
182
182
|
def paths_ruby_unix; (ENV['PATH'] || '').split(':'); end
|
183
|
-
def
|
183
|
+
def paths_ruby_windows; (ENV['PATH'] || '').split(';'); end # Not tested!
|
184
184
|
def paths_java
|
185
185
|
delim = @impl == :windows ? ';' : ':'
|
186
186
|
(ENV['PATH'] || '').split(delim)
|
187
187
|
end
|
188
188
|
|
189
189
|
def tmpdir_ruby_unix; (ENV['TMPDIR'] || '/tmp'); end
|
190
|
-
def
|
190
|
+
def tmpdir_ruby_windows; (ENV['TMPDIR'] || 'C:\\temp'); end
|
191
191
|
def tmpdir_java
|
192
192
|
default = @impl == :windows ? 'C:\\temp' : '/tmp'
|
193
193
|
(ENV['TMPDIR'] || default)
|
194
194
|
end
|
195
195
|
|
196
196
|
def shell_ruby_unix; (ENV['SHELL'] || 'bash').to_sym; end
|
197
|
-
def
|
197
|
+
def shell_ruby_windows; :dos; end
|
198
198
|
alias_method :shell_java_unix, :shell_ruby_unix
|
199
|
-
alias_method :
|
199
|
+
alias_method :shell_java_windows, :shell_ruby_windows
|
200
200
|
|
201
201
|
def home_ruby_unix; File.expand_path(ENV['HOME']); end
|
202
|
-
def
|
202
|
+
def home_ruby_windows; File.expand_path(ENV['USERPROFILE']); end
|
203
203
|
def home_java
|
204
204
|
if @impl == :windows
|
205
205
|
File.expand_path(ENV['USERPROFILE'])
|
@@ -209,15 +209,15 @@ class SysInfo < Storable
|
|
209
209
|
end
|
210
210
|
|
211
211
|
# Ya, this is kinda wack. Ruby -> Java -> Kernel32. See:
|
212
|
-
# http://www.oreillynet.com/ruby/blog/2008/01/jruby_meets_the_windows_api_1.html
|
212
|
+
# http://www.oreillynet.com/ruby/blog/2008/01/jruby_meets_the_windows_api_1.html
|
213
213
|
# http://msdn.microsoft.com/en-us/library/ms724408(VS.85).aspx
|
214
214
|
# Ruby 1.9.1: Win32API is now deprecated in favor of using the DL library.
|
215
|
-
def
|
215
|
+
def find_uptime_java_windows_windows
|
216
216
|
kernel32 = com.sun.jna.NativeLibrary.getInstance('kernel32')
|
217
217
|
buf = java.nio.ByteBuffer.allocate(256)
|
218
218
|
(kernel32.getFunction('GetTickCount').invokeInt([256, buf].to_java).to_f / 1000).to_f
|
219
219
|
end
|
220
|
-
def
|
220
|
+
def find_uptime_ruby_windows_windows
|
221
221
|
# Win32API is required in self.guess
|
222
222
|
getTickCount = Win32API.new("kernel32", "GetTickCount", nil, 'L')
|
223
223
|
((getTickCount.call()).to_f / 1000).to_f
|
data/sysinfo.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
@spec = Gem::Specification.new do |s|
|
2
2
|
s.name = "sysinfo"
|
3
3
|
s.rubyforge_project = "sysinfo"
|
4
|
-
s.version = "0.
|
4
|
+
s.version = "0.7.0"
|
5
5
|
s.summary = "SysInfo: All your system-independent infoz in one handy class. "
|
6
6
|
s.description = s.summary
|
7
7
|
s.author = "Delano Mandelbaum"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sysinfo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Delano Mandelbaum
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-08-
|
12
|
+
date: 2009-08-24 00:00:00 -04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|