sys-proctable 1.0.0-universal-mingw32 → 1.1.0-universal-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +2 -3
- data/CHANGES +367 -357
- data/MANIFEST +33 -34
- data/README +110 -118
- data/Rakefile +215 -218
- data/benchmarks/bench_ps.rb +21 -21
- data/doc/top.txt +46 -46
- data/examples/example_ps.rb +20 -20
- data/lib/sys-proctable.rb +1 -1
- data/lib/sys/proctable/version.rb +6 -6
- data/lib/sys/top.rb +31 -31
- data/lib/windows/sys/proctable.rb +207 -207
- data/sys-proctable.gemspec +40 -40
- data/test/test_sys_proctable_all.rb +98 -87
- data/test/test_sys_proctable_windows.rb +324 -324
- data/test/test_sys_top.rb +65 -46
- metadata +4 -4
- metadata.gz.sig +0 -0
data/MANIFEST
CHANGED
@@ -1,34 +1,33 @@
|
|
1
|
-
* CHANGES
|
2
|
-
* MANIFEST
|
3
|
-
* Rakefile
|
4
|
-
* README
|
5
|
-
* sys-proctable.gemspec
|
6
|
-
* doc/aix.txt
|
7
|
-
* doc/bsd.txt
|
8
|
-
* doc/hpux.txt
|
9
|
-
* doc/linux.txt
|
10
|
-
* doc/solaris.txt
|
11
|
-
* doc/top.txt
|
12
|
-
* doc/windows.txt
|
13
|
-
* example/example_ps.rb
|
14
|
-
* ext/
|
15
|
-
* ext/
|
16
|
-
*
|
17
|
-
*
|
18
|
-
* lib/sys
|
19
|
-
* lib/sys/
|
20
|
-
* lib/sys/proctable
|
21
|
-
* lib/
|
22
|
-
* lib/
|
23
|
-
* lib/
|
24
|
-
* lib/
|
25
|
-
*
|
26
|
-
* test/
|
27
|
-
* test/
|
28
|
-
* test/
|
29
|
-
* test/
|
30
|
-
* test/
|
31
|
-
* test/
|
32
|
-
* test/
|
33
|
-
* test/
|
34
|
-
* test/test_sys_top.rb
|
1
|
+
* CHANGES
|
2
|
+
* MANIFEST
|
3
|
+
* Rakefile
|
4
|
+
* README
|
5
|
+
* sys-proctable.gemspec
|
6
|
+
* doc/aix.txt
|
7
|
+
* doc/bsd.txt
|
8
|
+
* doc/hpux.txt
|
9
|
+
* doc/linux.txt
|
10
|
+
* doc/solaris.txt
|
11
|
+
* doc/top.txt
|
12
|
+
* doc/windows.txt
|
13
|
+
* example/example_ps.rb
|
14
|
+
* ext/hpux/extconf.rb
|
15
|
+
* ext/hpux/sys/proctable.c
|
16
|
+
* lib/sys-proctable.rb
|
17
|
+
* lib/sys/top.rb
|
18
|
+
* lib/sys/proctable/version.rb
|
19
|
+
* lib/aix/sys/proctable.rb
|
20
|
+
* lib/darwin/sys/proctable.rb
|
21
|
+
* lib/freebsd/sys/proctable.rb
|
22
|
+
* lib/linux/sys/proctable.rb
|
23
|
+
* lib/sunos/sys/proctable.rb
|
24
|
+
* lib/windows/sys/proctable.rb
|
25
|
+
* test/test_sys_proctable_aix.rb
|
26
|
+
* test/test_sys_proctable_all.rb
|
27
|
+
* test/test_sys_proctable_darwin.rb
|
28
|
+
* test/test_sys_proctable_freebsd.rb
|
29
|
+
* test/test_sys_proctable_hpux.rb
|
30
|
+
* test/test_sys_proctable_linux.rb
|
31
|
+
* test/test_sys_proctable_sunos.rb
|
32
|
+
* test/test_sys_proctable_windows.rb
|
33
|
+
* test/test_sys_top.rb
|
data/README
CHANGED
@@ -1,118 +1,110 @@
|
|
1
|
-
== Description
|
2
|
-
A Ruby interface for gathering process information.
|
3
|
-
|
4
|
-
== Prerequisites
|
5
|
-
* Test::Unit 2.x (development only)
|
6
|
-
|
7
|
-
== Supported Platforms
|
8
|
-
* Windows 2000 or later
|
9
|
-
* Linux 2.6+
|
10
|
-
* FreeBSD
|
11
|
-
* Solaris 8+
|
12
|
-
* HP-UX 10+
|
13
|
-
* OS X 10.
|
14
|
-
* AIX 5.3+
|
15
|
-
|
16
|
-
== Installation
|
17
|
-
gem install sys-proctable
|
18
|
-
|
19
|
-
You may need to specify a platform in some cases. For example:
|
20
|
-
|
21
|
-
gem install sys-proctable --platform mswin32 # Windows
|
22
|
-
gem install sys-proctable --platform sunos # Solaris
|
23
|
-
gem install sys-proctable --platform linux # Linux
|
24
|
-
gem install sys-proctable --platform freebsd # FreeBSD
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
puts p.
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
puts s.
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
a
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
to
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
== Contributions
|
112
|
-
Although this library is free, please consider having your company
|
113
|
-
setup a gittip if used by your company professionally.
|
114
|
-
|
115
|
-
http://www.gittip.com/djberg96/
|
116
|
-
|
117
|
-
== Author
|
118
|
-
Daniel J. Berger
|
1
|
+
== Description
|
2
|
+
A Ruby interface for gathering process information.
|
3
|
+
|
4
|
+
== Prerequisites
|
5
|
+
* Test::Unit 2.x (development only)
|
6
|
+
|
7
|
+
== Supported Platforms
|
8
|
+
* Windows 2000 or later
|
9
|
+
* Linux 2.6+
|
10
|
+
* FreeBSD
|
11
|
+
* Solaris 8+
|
12
|
+
* HP-UX 10+
|
13
|
+
* OS X 10.7+
|
14
|
+
* AIX 5.3+
|
15
|
+
|
16
|
+
== Installation
|
17
|
+
gem install sys-proctable
|
18
|
+
|
19
|
+
You may need to specify a platform in some cases. For example:
|
20
|
+
|
21
|
+
gem install sys-proctable --platform mswin32 # Windows
|
22
|
+
gem install sys-proctable --platform sunos # Solaris
|
23
|
+
gem install sys-proctable --platform linux # Linux
|
24
|
+
gem install sys-proctable --platform freebsd # FreeBSD
|
25
|
+
gem install sys-proctable --platform darwin # OS X
|
26
|
+
|
27
|
+
== Synopsis
|
28
|
+
require 'sys/proctable'
|
29
|
+
include Sys
|
30
|
+
|
31
|
+
# Everything
|
32
|
+
ProcTable.ps{ |p|
|
33
|
+
puts p.pid.to_s
|
34
|
+
puts p.comm
|
35
|
+
# ...
|
36
|
+
}
|
37
|
+
|
38
|
+
# Just one process
|
39
|
+
s = ProcTable.ps(2123)
|
40
|
+
puts s.pid.to_s
|
41
|
+
puts s.comm
|
42
|
+
# ...
|
43
|
+
|
44
|
+
# Return the results as an array of ProcTableStructs
|
45
|
+
a = ProcTable.ps
|
46
|
+
a.each do |p|
|
47
|
+
puts p.pid
|
48
|
+
# ...
|
49
|
+
end
|
50
|
+
|
51
|
+
== Notes
|
52
|
+
Windows users may pass a host name as a second argument to get process
|
53
|
+
information from a different host. This relies on the WMI service running.
|
54
|
+
|
55
|
+
== Known Issues
|
56
|
+
=== FreeBSD
|
57
|
+
A kvm interface is used. That means the owner of the process using the
|
58
|
+
sys-proctable library needs to be a member of the kvm group (or root).
|
59
|
+
|
60
|
+
=== Solaris
|
61
|
+
The cmdline member on Solaris is limited to 80 characters unless you (or
|
62
|
+
your program) own the process. This is a Solaris design flaw/feature.
|
63
|
+
|
64
|
+
=== OS X
|
65
|
+
The libproc interface is used. That means you will only get list of
|
66
|
+
processes that you have access to. To get a full listing, run as root.
|
67
|
+
|
68
|
+
== Future Plans
|
69
|
+
Add support for NetBSD and OpenBSD.
|
70
|
+
Convert remaining C code (just HP-UX at this point) to FFI.
|
71
|
+
|
72
|
+
== Acknowledgements
|
73
|
+
This library was originally based on the Perl module Proc::ProcessTable
|
74
|
+
by Dan Urist. Many ideas, as well as large chunks of code, were taken
|
75
|
+
from his work. So, a big THANK YOU goes out to Dan Urist.
|
76
|
+
|
77
|
+
A big thanks also goes out to Mike Hall who was very helpful with ideas,
|
78
|
+
logic and testing.
|
79
|
+
|
80
|
+
Thanks also go to Sean Chittenden for providing an account on one of his
|
81
|
+
FreeBSD machines. This is how the FreeBSD support was (initially) added.
|
82
|
+
|
83
|
+
Thanks go to James Hranicky for providing a patch that grabs name, eid,
|
84
|
+
euid, gid and guid info in the Linux version, along with some general
|
85
|
+
debugging help.
|
86
|
+
|
87
|
+
Thanks go to David Felstead for the original OS X code. Thanks also go
|
88
|
+
to Matthias Zirnstein for adding the original cmdline support for OS X.
|
89
|
+
|
90
|
+
Finally I'd like to thank all the folks who have submitted bug reports
|
91
|
+
and/or patches.
|
92
|
+
|
93
|
+
== Help Wanted
|
94
|
+
I do not have access to all platforms. If your platform is not supported
|
95
|
+
then you will need to either submit a patch or give me a remote account
|
96
|
+
on a box with a compiler so that I can write the code.
|
97
|
+
|
98
|
+
== More documentation
|
99
|
+
See the documentation under the 'doc' directory for more information,
|
100
|
+
including platform specific notes and issues.
|
101
|
+
|
102
|
+
== License
|
103
|
+
Apache 2.0
|
104
|
+
|
105
|
+
== Copyright
|
106
|
+
(C) 2003-2016 Daniel J. Berger
|
107
|
+
All Rights Reserved.
|
108
|
+
|
109
|
+
== Author
|
110
|
+
Daniel J. Berger
|
data/Rakefile
CHANGED
@@ -1,218 +1,215 @@
|
|
1
|
-
require 'rake'
|
2
|
-
require 'rake/clean'
|
3
|
-
require 'rake/testtask'
|
4
|
-
require 'rbconfig'
|
5
|
-
include RbConfig
|
6
|
-
|
7
|
-
CLEAN.include(
|
8
|
-
'**/*.core', # Core dump files
|
9
|
-
'**/*.gem', # Gem files
|
10
|
-
'**/*.rbc', # Rubinius
|
11
|
-
'**/*.rbx', # Rubinius
|
12
|
-
'**/*.o', # C object file
|
13
|
-
'**/*.log', # Ruby extension build log
|
14
|
-
'**/Makefile', # C Makefile
|
15
|
-
'**/conftest.dSYM', # OS X build directory
|
16
|
-
"**/*.#{CONFIG['DLEXT']}" # C shared object
|
17
|
-
)
|
18
|
-
|
19
|
-
desc 'Build the sys-proctable library for C versions of sys-proctable'
|
20
|
-
task :build => [:clean] do
|
21
|
-
if RUBY_PLATFORM == 'java'
|
22
|
-
if ENV['JRUBY_OPTS']
|
23
|
-
ENV['JRUBY_OPTS'] += ' -Xcext.enabled=true'
|
24
|
-
else
|
25
|
-
ENV['JRUBY_OPTS'] = '-Xcext.enabled=true'
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
case CONFIG['host_os']
|
30
|
-
when /
|
31
|
-
dir = 'ext/
|
32
|
-
ext = '.
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
dir = File.join(CONFIG['
|
79
|
-
file = File.join(dir, 'proctable.'
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
when /
|
105
|
-
t.test_files = FileList['test/
|
106
|
-
t.libs << 'lib/
|
107
|
-
when /
|
108
|
-
t.test_files = FileList['test/
|
109
|
-
t.libs << 'lib/
|
110
|
-
when /
|
111
|
-
t.test_files = FileList['test/
|
112
|
-
t.libs << 'lib/
|
113
|
-
when /
|
114
|
-
t.test_files = FileList['test/
|
115
|
-
t.libs << 'lib/
|
116
|
-
when /
|
117
|
-
t.
|
118
|
-
t.
|
119
|
-
when /
|
120
|
-
t.libs << 'ext/
|
121
|
-
t.test_files = FileList['test/
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
os = args
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
spec
|
141
|
-
|
142
|
-
|
143
|
-
#
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
spec.
|
150
|
-
spec.
|
151
|
-
|
152
|
-
spec.
|
153
|
-
spec.
|
154
|
-
|
155
|
-
spec.
|
156
|
-
spec.
|
157
|
-
|
158
|
-
spec.
|
159
|
-
spec.
|
160
|
-
|
161
|
-
spec.
|
162
|
-
spec.
|
163
|
-
|
164
|
-
spec.
|
165
|
-
spec.
|
166
|
-
|
167
|
-
spec.
|
168
|
-
|
169
|
-
spec.
|
170
|
-
spec.
|
171
|
-
|
172
|
-
spec.
|
173
|
-
|
174
|
-
spec.
|
175
|
-
spec.
|
176
|
-
|
177
|
-
spec.
|
178
|
-
|
179
|
-
spec.
|
180
|
-
spec.
|
181
|
-
|
182
|
-
spec.
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
spec.
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
end
|
217
|
-
|
218
|
-
task :default => :test
|
1
|
+
require 'rake'
|
2
|
+
require 'rake/clean'
|
3
|
+
require 'rake/testtask'
|
4
|
+
require 'rbconfig'
|
5
|
+
include RbConfig
|
6
|
+
|
7
|
+
CLEAN.include(
|
8
|
+
'**/*.core', # Core dump files
|
9
|
+
'**/*.gem', # Gem files
|
10
|
+
'**/*.rbc', # Rubinius
|
11
|
+
'**/*.rbx', # Rubinius
|
12
|
+
'**/*.o', # C object file
|
13
|
+
'**/*.log', # Ruby extension build log
|
14
|
+
'**/Makefile', # C Makefile
|
15
|
+
'**/conftest.dSYM', # OS X build directory
|
16
|
+
"**/*.#{CONFIG['DLEXT']}" # C shared object
|
17
|
+
)
|
18
|
+
|
19
|
+
desc 'Build the sys-proctable library for C versions of sys-proctable'
|
20
|
+
task :build => [:clean] do
|
21
|
+
if RUBY_PLATFORM == 'java'
|
22
|
+
if ENV['JRUBY_OPTS']
|
23
|
+
ENV['JRUBY_OPTS'] += ' -Xcext.enabled=true'
|
24
|
+
else
|
25
|
+
ENV['JRUBY_OPTS'] = '-Xcext.enabled=true'
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
case CONFIG['host_os']
|
30
|
+
when /hpux/i
|
31
|
+
dir = 'ext/hpux'
|
32
|
+
ext = '.sl'
|
33
|
+
end
|
34
|
+
|
35
|
+
if CONFIG['host_os'] =~ /hpux/i
|
36
|
+
Dir.chdir(dir) do
|
37
|
+
ruby 'extconf.rb'
|
38
|
+
sh 'make'
|
39
|
+
cp 'proctable' + ext, 'sys'
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
desc 'Install the sys-proctable library'
|
45
|
+
task :install => [:build] do
|
46
|
+
file = nil
|
47
|
+
dir = File.join(CONFIG['sitelibdir'], 'sys')
|
48
|
+
|
49
|
+
Dir.mkdir(dir) unless File.exists?(dir)
|
50
|
+
|
51
|
+
case CONFIG['host_os']
|
52
|
+
when /mswin|win32|msdos|cygwin|mingw|windows/i
|
53
|
+
file = 'lib/windows/sys/proctable.rb'
|
54
|
+
when /linux/i
|
55
|
+
file = 'lib/linux/sys/proctable.rb'
|
56
|
+
when /sunos|solaris/i
|
57
|
+
file = 'lib/sunos/sys/proctable.rb'
|
58
|
+
when /aix/i
|
59
|
+
file = 'lib/aix/sys/proctable.rb'
|
60
|
+
when /freebsd/i
|
61
|
+
file = 'lib/freebsd/sys/proctable.rb'
|
62
|
+
when /darwin/i
|
63
|
+
file = 'lib/darwin/sys/proctable.rb'
|
64
|
+
when /hpux/i
|
65
|
+
Dir.chdir('ext/hpux'){ sh 'make install' }
|
66
|
+
end
|
67
|
+
|
68
|
+
cp(file, dir, :verbose => true) if file
|
69
|
+
end
|
70
|
+
|
71
|
+
desc 'Uninstall the sys-proctable library'
|
72
|
+
task :uninstall do
|
73
|
+
case CONFIG['host_os']
|
74
|
+
when /hpux/i
|
75
|
+
dir = File.join(CONFIG['sitearchdir'], 'sys')
|
76
|
+
file = File.join(dir, 'proctable.' + CONFIG['DLEXT'])
|
77
|
+
else
|
78
|
+
dir = File.join(CONFIG['sitelibdir'], 'sys')
|
79
|
+
file = File.join(dir, 'proctable.rb')
|
80
|
+
end
|
81
|
+
|
82
|
+
rm(file)
|
83
|
+
end
|
84
|
+
|
85
|
+
desc 'Run the benchmark suite'
|
86
|
+
task :bench => [:build] do
|
87
|
+
sh "ruby -Ilib benchmarks/bench_ps.rb"
|
88
|
+
end
|
89
|
+
|
90
|
+
desc 'Run the example program'
|
91
|
+
task :example => [:build] do
|
92
|
+
sh 'ruby -Ilib -Iext examples/example_ps.rb'
|
93
|
+
end
|
94
|
+
|
95
|
+
desc 'Run the test suite'
|
96
|
+
Rake::TestTask.new do |t|
|
97
|
+
task :test => :build
|
98
|
+
t.libs << 'test' << '.'
|
99
|
+
|
100
|
+
case CONFIG['host_os']
|
101
|
+
when /mswin|msdos|cygwin|mingw|windows/i
|
102
|
+
t.test_files = FileList['test/test_sys_proctable_windows.rb']
|
103
|
+
t.libs << 'lib/windows'
|
104
|
+
when /linux/i
|
105
|
+
t.test_files = FileList['test/test_sys_proctable_linux.rb']
|
106
|
+
t.libs << 'lib/linux'
|
107
|
+
when /sunos|solaris/i
|
108
|
+
t.test_files = FileList['test/test_sys_proctable_sunos.rb']
|
109
|
+
t.libs << 'lib/sunos'
|
110
|
+
when /aix/i
|
111
|
+
t.test_files = FileList['test/test_sys_proctable_aix.rb']
|
112
|
+
t.libs << 'lib/aix'
|
113
|
+
when /freebsd/i
|
114
|
+
t.test_files = FileList['test/test_sys_proctable_freebsd.rb']
|
115
|
+
t.libs << 'lib/freebsd'
|
116
|
+
when /darwin/i
|
117
|
+
t.libs << 'lib/darwin'
|
118
|
+
t.test_files = FileList['test/test_sys_proctable_darwin.rb']
|
119
|
+
when /hpux/i
|
120
|
+
t.libs << 'ext/hpux'
|
121
|
+
t.test_files = FileList['test/test_sys_proctable_hpux.rb']
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
namespace :gem do
|
126
|
+
desc 'Create a gem for the specified OS, or your current OS by default'
|
127
|
+
task :create, [:os] => [:clean] do |_task, args|
|
128
|
+
require 'rubygems/package'
|
129
|
+
|
130
|
+
if args.is_a?(String)
|
131
|
+
os = args
|
132
|
+
else
|
133
|
+
args.with_defaults(:os => CONFIG['host_os'])
|
134
|
+
os = args[:os]
|
135
|
+
end
|
136
|
+
|
137
|
+
spec = eval(IO.read('sys-proctable.gemspec'))
|
138
|
+
spec.files += ['lib/sys-proctable.rb']
|
139
|
+
|
140
|
+
# I've had to manually futz with the spec here in some cases
|
141
|
+
# in order to get the universal platform settings I want because
|
142
|
+
# of some bugginess in Rubygems' platform.rb.
|
143
|
+
#
|
144
|
+
case os
|
145
|
+
when /freebsd/i
|
146
|
+
spec.platform = Gem::Platform.new(['universal', 'freebsd'])
|
147
|
+
spec.require_paths = ['lib', 'lib/freebsd']
|
148
|
+
spec.files += ['lib/freebsd/sys/proctable.rb']
|
149
|
+
spec.test_files << 'test/test_sys_proctable_freebsd.rb'
|
150
|
+
spec.add_dependency('ffi')
|
151
|
+
when /darwin/i
|
152
|
+
spec.platform = Gem::Platform.new(['universal', 'darwin'])
|
153
|
+
spec.require_paths = ['lib', 'lib/darwin']
|
154
|
+
spec.files += ['lib/darwin/sys/proctable.rb']
|
155
|
+
spec.test_files << 'test/test_sys_proctable_darwin.rb'
|
156
|
+
spec.add_dependency('ffi')
|
157
|
+
when /hpux/i
|
158
|
+
spec.platform = Gem::Platform.new(['universal', 'hpux'])
|
159
|
+
spec.files << 'ext/hpux/sys/proctable.c'
|
160
|
+
spec.extra_rdoc_files << 'ext/hpux/sys/proctable.c'
|
161
|
+
spec.test_files << 'test/test_sys_proctable_hpux.rb'
|
162
|
+
spec.extensions = ['ext/hpux/extconf.rb']
|
163
|
+
when /linux/i
|
164
|
+
spec.platform = Gem::Platform.new(['universal', 'linux'])
|
165
|
+
spec.require_paths = ['lib', 'lib/linux']
|
166
|
+
spec.files += ['lib/linux/sys/proctable.rb', 'lib/linux/sys/proctable/cgroup_entry.rb', 'lib/linux/sys/proctable/smaps.rb']
|
167
|
+
spec.test_files << 'test/test_sys_proctable_linux.rb'
|
168
|
+
when /sunos|solaris/i
|
169
|
+
spec.platform = Gem::Platform.new(['universal', 'solaris'])
|
170
|
+
spec.require_paths = ['lib', 'lib/sunos']
|
171
|
+
spec.files += ['lib/sunos/sys/proctable.rb']
|
172
|
+
spec.test_files << 'test/test_sys_proctable_sunos.rb'
|
173
|
+
when /aix/i
|
174
|
+
spec.platform = Gem::Platform.new(['universal', 'aix5'])
|
175
|
+
spec.require_paths = ['lib', 'lib/aix']
|
176
|
+
spec.files += ['lib/aix/sys/proctable.rb']
|
177
|
+
spec.test_files << 'test/test_sys_proctable_aix.rb'
|
178
|
+
when /mswin|win32|dos|cygwin|mingw|windows/i
|
179
|
+
spec.platform = Gem::Platform.new(['universal', 'mingw32'])
|
180
|
+
spec.require_paths = ['lib', 'lib/windows']
|
181
|
+
spec.files += ['lib/windows/sys/proctable.rb']
|
182
|
+
spec.test_files << 'test/test_sys_proctable_windows.rb'
|
183
|
+
else
|
184
|
+
raise "Unsupported platform: #{os}"
|
185
|
+
end
|
186
|
+
|
187
|
+
spec.test_files << 'test/test_sys_top.rb'
|
188
|
+
|
189
|
+
# https://github.com/rubygems/rubygems/issues/147
|
190
|
+
spec.original_platform = spec.platform
|
191
|
+
|
192
|
+
spec.signing_key = File.join(Dir.home, '.ssh', 'gem-private_key.pem')
|
193
|
+
|
194
|
+
Gem::Package.build(spec, true)
|
195
|
+
end
|
196
|
+
|
197
|
+
desc 'Create a gem for each supported OS'
|
198
|
+
task :create_all => [:clean] do
|
199
|
+
platforms = %w[aix darwin freebsd hpux linux solaris windows]
|
200
|
+
Rake::Task["clean"].execute
|
201
|
+
platforms.each{ |os|
|
202
|
+
FileUtils.mkdir_p("pkg/#{os}")
|
203
|
+
Rake::Task["gem:create"].execute(os)
|
204
|
+
Dir.glob("*.gem").each{ |gem| FileUtils.mv(gem, "pkg/#{os}") }
|
205
|
+
}
|
206
|
+
end
|
207
|
+
|
208
|
+
desc 'Install the sys-proctable library as a gem'
|
209
|
+
task :install => [:create] do
|
210
|
+
gem_name = Dir['*.gem'].first
|
211
|
+
sh "gem install -l #{gem_name}"
|
212
|
+
end
|
213
|
+
end
|
214
|
+
|
215
|
+
task :default => :test
|