sys-uname 0.8.6 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sys-uname
3
3
  version: !ruby/object:Gem::Version
4
- hash: 51
4
+ hash: 59
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 8
9
- - 6
10
- version: 0.8.6
8
+ - 9
9
+ - 0
10
+ version: 0.9.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Daniel J. Berger
@@ -15,55 +15,55 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-09-02 00:00:00 Z
18
+ date: 2011-12-08 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
- name: test-unit
21
+ name: ffi
22
22
  prerelease: false
23
23
  requirement: &id001 !ruby/object:Gem::Requirement
24
24
  none: false
25
25
  requirements:
26
26
  - - ">="
27
27
  - !ruby/object:Gem::Version
28
- hash: 11
28
+ hash: 23
29
29
  segments:
30
- - 2
31
30
  - 1
32
31
  - 0
33
- version: 2.1.0
34
- type: :development
32
+ - 0
33
+ version: 1.0.0
34
+ type: :runtime
35
35
  version_requirements: *id001
36
36
  description: " The sys-uname library provides an interface for gathering information\n about your current platform. The library is named after the Unix 'uname'\n command but also works on MS Windows. Available information includes\n OS name, OS version, system name and so on. Additional information is\n available for certain platforms.\n"
37
37
  email: djberg96@gmail.com
38
38
  executables: []
39
39
 
40
- extensions:
41
- - ext/extconf.rb
40
+ extensions: []
41
+
42
42
  extra_rdoc_files:
43
43
  - CHANGES
44
44
  - README
45
45
  - MANIFEST
46
46
  - doc/uname.txt
47
- - ext/sys/uname.c
48
47
  files:
49
48
  - CHANGES
50
49
  - doc/uname.txt
51
50
  - examples/uname_test.rb
52
- - ext/extconf.rb
53
- - ext/sys/uname.c
51
+ - lib/unix/sys/uname.rb
52
+ - lib/windows/sys/uname.rb
54
53
  - MANIFEST
55
54
  - Rakefile
56
55
  - README
57
56
  - sys-uname.gemspec
58
57
  - test/test_sys_uname.rb
59
58
  homepage: http://www.rubyforge.org/projects/sysutils
60
- licenses:
61
- - Artistic 2.0
59
+ licenses: []
60
+
62
61
  post_install_message:
63
62
  rdoc_options: []
64
63
 
65
64
  require_paths:
66
65
  - lib
66
+ - lib/unix
67
67
  required_ruby_version: !ruby/object:Gem::Requirement
68
68
  none: false
69
69
  requirements:
@@ -88,6 +88,6 @@ rubyforge_project: sysutils
88
88
  rubygems_version: 1.8.10
89
89
  signing_key:
90
90
  specification_version: 3
91
- summary: An interface for returning system platform information
91
+ summary: An interface for returning uname (platform) information
92
92
  test_files:
93
93
  - test/test_sys_uname.rb
@@ -1,12 +0,0 @@
1
- require 'mkmf'
2
-
3
- # Linux has sysctl, but not the expected mibs
4
- unless RUBY_PLATFORM.match('linux')
5
- have_func('sysctl')
6
- end
7
-
8
- if RUBY_PLATFORM =~ /sunos|solaris/i
9
- have_header('sys/systeminfo.h')
10
- end
11
-
12
- create_makefile('sys/uname', 'sys')
@@ -1,307 +0,0 @@
1
- /******************************************************************************
2
- * uname.c - Ruby extension for returning uname information on Unix platforms.
3
- *
4
- * Author: Daniel Berger
5
- *****************************************************************************/
6
- #include <ruby.h>
7
- #include <sys/utsname.h>
8
-
9
- #define SYS_UNAME_VERSION "0.8.6"
10
-
11
- /* Solaris */
12
- #ifdef HAVE_SYS_SYSTEMINFO_H
13
- #define BUFSIZE 257 /* Set as per the sysinfo(2) manpage */
14
- #include <sys/systeminfo.h>
15
- #endif
16
-
17
- /* BSD platforms, including OS X */
18
- #ifdef HAVE_SYSCTL
19
- #include <sys/sysctl.h>
20
- static int get_model(char *buf, int n)
21
- {
22
- size_t sz = n;
23
- int mib[2];
24
-
25
- mib[0] = CTL_HW;
26
- mib[1] = HW_MODEL;
27
- return sysctl(mib, 2, buf, &sz, NULL, 0);
28
- }
29
- #endif
30
-
31
- #ifdef __cplusplus
32
- extern "C"
33
- {
34
- #endif
35
-
36
- VALUE sUname;
37
-
38
- /*
39
- * Returns a struct of type UnameStruct that contains sysname, nodename,
40
- * machine, version, and release. On Solaris, it will also include
41
- * architecture and platform. On HP-UX, it will also include id_number.
42
- */
43
- static VALUE uname_uname_all()
44
- {
45
- struct utsname u;
46
- uname(&u);
47
-
48
- /* Extra brackets are for C89 compliance */
49
- {
50
- #ifdef HAVE_SYS_SYSTEMINFO_H
51
- char platform[BUFSIZE];
52
- char arch[BUFSIZE];
53
- sysinfo(SI_ARCHITECTURE, arch, BUFSIZE);
54
- sysinfo(SI_PLATFORM, platform, BUFSIZE);
55
- #endif
56
-
57
- #ifdef HAVE_SYSCTL
58
- char model[BUFSIZ];
59
- get_model(model, sizeof(model));
60
- #endif
61
-
62
- return rb_struct_new(sUname,
63
- rb_str_new2(u.sysname),
64
- rb_str_new2(u.nodename),
65
- rb_str_new2(u.machine),
66
- rb_str_new2(u.version),
67
- rb_str_new2(u.release)
68
- #ifdef HAVE_SYS_SYSTEMINFO_H
69
- ,rb_str_new2(arch),
70
- rb_str_new2(platform)
71
- #endif
72
-
73
- #ifdef HAVE_SYSCTL
74
- ,rb_str_new2(model)
75
- #endif
76
-
77
- #if defined(__hpux)
78
- ,rb_str_new2(u.__idnumber)
79
- #endif
80
- );
81
- }
82
- }
83
-
84
- /*
85
- * Returns the nodename. This is usually, but not necessarily, the
86
- * same as the system's hostname.
87
- */
88
- static VALUE uname_nodename()
89
- {
90
- struct utsname u;
91
- uname(&u);
92
- return rb_str_new2(u.nodename);
93
- }
94
-
95
- /*
96
- * Returns the machine hardware type, e.g. "i686".
97
- */
98
- static VALUE uname_machine()
99
- {
100
- struct utsname u;
101
- uname(&u);
102
- return rb_str_new2(u.machine);
103
- }
104
-
105
- /*
106
- * Returns the operating system version, e.g. "5.8".
107
- */
108
- static VALUE uname_version()
109
- {
110
- struct utsname u;
111
- uname(&u);
112
- return rb_str_new2(u.version);
113
- }
114
-
115
- /*
116
- * Returns the operating system release. e.g. "2.2.16-3".
117
- */
118
- static VALUE uname_release()
119
- {
120
- struct utsname u;
121
- uname(&u);
122
- return rb_str_new2(u.release);
123
- }
124
-
125
- /*
126
- * Returns the operating system name. e.g. "SunOS".
127
- */
128
- static VALUE uname_sysname()
129
- {
130
- struct utsname u;
131
- uname(&u);
132
- return rb_str_new2(u.sysname);
133
- }
134
-
135
- #ifdef HAVE_SYS_SYSTEMINFO_H
136
- /*
137
- * Returns the instruction set architecture, e.g. "sparc".
138
- */
139
- static VALUE uname_architecture()
140
- {
141
- char buf[BUFSIZE];
142
- sysinfo(SI_ARCHITECTURE, buf, BUFSIZE);
143
- return rb_str_new2(buf);
144
- }
145
-
146
- /*
147
- * Returns the platform identifier. e.g. "SUNW,Sun-Blade-100".
148
- */
149
- static VALUE uname_platform()
150
- {
151
- char buf[BUFSIZE];
152
- sysinfo(SI_PLATFORM, buf, BUFSIZE);
153
- return rb_str_new2(buf);
154
- }
155
-
156
- #ifdef SI_ISALIST
157
- /*
158
- * Returns a space separated string containing a list of all variant
159
- * instruction set architectures executable on the current system.
160
- *
161
- * They are listed in order of performance, from best to worst.
162
- */
163
- static VALUE uname_isalist()
164
- {
165
- char buf[BUFSIZE];
166
- sysinfo(SI_ISALIST, buf, BUFSIZE);
167
- return rb_str_new2(buf);
168
- }
169
- #endif
170
-
171
- /*
172
- * Returns the name of the hardware manufacturer.
173
- */
174
- static VALUE uname_hw_provider()
175
- {
176
- char buf[BUFSIZE];
177
- sysinfo(SI_HW_PROVIDER, buf, BUFSIZE);
178
- return rb_str_new2(buf);
179
- }
180
-
181
- /*
182
- * Returns the ASCII representation of the hardware-specific serial number
183
- * of the machine that executes the function.
184
- */
185
- static VALUE uname_hw_serial()
186
- {
187
- char buf[BUFSIZE];
188
- sysinfo(SI_HW_SERIAL, buf, BUFSIZE);
189
- return rb_Integer(rb_str_new2(buf));
190
- }
191
-
192
- /*
193
- * Returns the name of the Secure Remote Procedure Call domain, if any.
194
- */
195
- static VALUE uname_srpc_domain()
196
- {
197
- char buf[BUFSIZE];
198
- sysinfo(SI_SRPC_DOMAIN, buf, BUFSIZE);
199
- return rb_str_new2(buf);
200
- }
201
-
202
- #ifdef SI_DHCP_CACHE
203
- /*
204
- * Returns a hexidecimal encoding, in String form, of the name of the
205
- * interface configured by boot(1M) followed by the DHCPACK reply from
206
- * the server.
207
- */
208
- static VALUE uname_dhcp_cache()
209
- {
210
- char buf[BUFSIZE];
211
- sysinfo(SI_DHCP_CACHE, buf, BUFSIZE);
212
- return rb_str_new2(buf);
213
- }
214
- #endif
215
- #endif
216
-
217
- #ifdef HAVE_SYSCTL
218
- /*
219
- * Returns the model type, e.g. "PowerBook5,1"
220
- */
221
- static VALUE uname_model()
222
- {
223
- char model[BUFSIZ];
224
- get_model(model, sizeof(model));
225
- return rb_str_new2(model);
226
- }
227
- #endif
228
-
229
- #if defined(__hpux)
230
- /*
231
- * Returns the id number, e.g. 234233587. This is a string, not a number.
232
- */
233
- static VALUE uname_id()
234
- {
235
- struct utsname u;
236
- uname(&u);
237
- return rb_str_new2(u.__idnumber);
238
- }
239
- #endif
240
-
241
- /* An interface for returning uname (platform) information. */
242
- void Init_uname()
243
- {
244
- VALUE mSys, cUname;
245
-
246
- /* The Sys module serves only as a toplevel namespace */
247
- mSys = rb_define_module("Sys");
248
-
249
- /* The Uname serves as the base class from which system information can
250
- * be obtained via various class methods.
251
- */
252
- cUname = rb_define_class_under(mSys, "Uname", rb_cObject);
253
-
254
- rb_define_singleton_method(cUname, "sysname", uname_sysname, 0);
255
- rb_define_singleton_method(cUname, "nodename",uname_nodename,0);
256
- rb_define_singleton_method(cUname, "machine", uname_machine, 0);
257
- rb_define_singleton_method(cUname, "version", uname_version, 0);
258
- rb_define_singleton_method(cUname, "release", uname_release, 0);
259
- rb_define_singleton_method(cUname, "uname", uname_uname_all, 0);
260
-
261
- #ifdef HAVE_SYS_SYSTEMINFO_H
262
- rb_define_singleton_method(cUname, "architecture", uname_architecture, 0);
263
- rb_define_singleton_method(cUname, "platform", uname_platform, 0);
264
- rb_define_singleton_method(cUname, "hw_provider", uname_hw_provider, 0);
265
- rb_define_singleton_method(cUname, "hw_serial_number", uname_hw_serial, 0);
266
- rb_define_singleton_method(cUname, "srpc_domain", uname_srpc_domain, 0);
267
- #ifdef SI_ISALIST
268
- rb_define_singleton_method(cUname, "isa_list", uname_isalist, 0);
269
- #endif
270
- #ifdef SI_DHCP_CACHE
271
- rb_define_singleton_method(cUname, "dhcp_cache", uname_dhcp_cache, 0);
272
- #endif
273
- #endif
274
-
275
- #ifdef HAVE_SYSCTL
276
- rb_define_singleton_method(cUname, "model", uname_model, 0);
277
- #endif
278
-
279
- #if defined(__hpux)
280
- rb_define_singleton_method(cUname, "id_number", uname_id, 0);
281
- #endif
282
-
283
- /* The UnameStruct encapsulates information associated with system
284
- * information, such as operating system version, release, etc.
285
- */
286
- sUname = rb_struct_define("UnameStruct","sysname","nodename",
287
- "machine","version","release",
288
- #ifdef HAVE_SYS_SYSTEMINFO_H
289
- "architecture","platform",
290
- #endif
291
-
292
- #ifdef HAVE_SYSCTL
293
- "model",
294
- #endif
295
-
296
- #if defined(__hpux)
297
- "id_number",
298
- #endif
299
- NULL);
300
-
301
- /* 0.8.6: The version of the sys-uname library */
302
- rb_define_const(cUname, "VERSION", rb_str_new2(SYS_UNAME_VERSION));
303
- }
304
-
305
- #ifdef __cplusplus
306
- }
307
- #endif