sys-proctable 0.9.8-universal-mingw32 → 0.9.9-universal-mingw32

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -1,198 +1,218 @@
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 /darwin/i
31
- dir = 'ext/darwin'
32
- ext = '.bundle'
33
- when /hpux/i
34
- dir = 'ext/hpux'
35
- ext = '.sl'
36
- end
37
-
38
- if CONFIG['host_os'] =~ /darwin|hpux/i
39
- Dir.chdir(dir) do
40
- ruby 'extconf.rb'
41
- sh 'make'
42
- cp 'proctable' + ext, 'sys'
43
- end
44
- end
45
- end
46
-
47
- desc 'Install the sys-proctable library'
48
- task :install => [:build] do
49
- file = nil
50
- dir = File.join(CONFIG['sitelibdir'], 'sys')
51
-
52
- Dir.mkdir(dir) unless File.exists?(dir)
53
-
54
- case CONFIG['host_os']
55
- when /mswin|win32|msdos|cygwin|mingw|windows/i
56
- file = 'lib/windows/sys/proctable.rb'
57
- when /linux/i
58
- file = 'lib/linux/sys/proctable.rb'
59
- when /sunos|solaris/i
60
- file = 'lib/sunos/sys/proctable.rb'
61
- when /aix/i
62
- file = 'lib/aix/sys/proctable.rb'
63
- when /freebsd/i
64
- file = 'lib/freebsd/sys/proctable.rb'
65
- when /darwin/i
66
- Dir.chdir('ext/darwin'){ sh 'make install' }
67
- when /hpux/i
68
- Dir.chdir('ext/hpux'){ sh 'make install' }
69
- end
70
-
71
- cp(file, dir, :verbose => true) if file
72
- end
73
-
74
- desc 'Uninstall the sys-proctable library'
75
- task :uninstall do
76
- case CONFIG['host_os']
77
- when /darwin|hpux/i
78
- dir = File.join(CONFIG['sitearchdir'], 'sys')
79
- file = File.join(dir, 'proctable.' + CONFIG['DLEXT'])
80
- else
81
- dir = File.join(CONFIG['sitelibdir'], 'sys')
82
- file = File.join(dir, 'proctable.rb')
83
- end
84
-
85
- rm(file)
86
- end
87
-
88
- desc 'Run the benchmark suite'
89
- task :bench => [:build] do
90
- sh "ruby -Ilib benchmarks/bench_ps.rb"
91
- end
92
-
93
- desc 'Run the example program'
94
- task :example => [:build] do
95
- sh 'ruby -Ilib -Iext examples/example_ps.rb'
96
- end
97
-
98
- desc 'Run the test suite'
99
- Rake::TestTask.new do |t|
100
- task :test => :build
101
- t.libs << 'test' << '.'
102
-
103
- case CONFIG['host_os']
104
- when /mswin|msdos|cygwin|mingw|windows/i
105
- t.test_files = FileList['test/test_sys_proctable_windows.rb']
106
- t.libs << 'lib/windows'
107
- when /linux/i
108
- t.test_files = FileList['test/test_sys_proctable_linux.rb']
109
- t.libs << 'lib/linux'
110
- when /sunos|solaris/i
111
- t.test_files = FileList['test/test_sys_proctable_sunos.rb']
112
- t.libs << 'lib/sunos'
113
- when /aix/i
114
- t.test_files = FileList['test/test_sys_proctable_aix.rb']
115
- t.libs << 'lib/aix'
116
- when /freebsd/i
117
- t.test_files = FileList['test/test_sys_proctable_freebsd.rb']
118
- t.libs << 'lib/freebsd'
119
- when /darwin/i
120
- t.libs << 'ext/darwin'
121
- t.test_files = FileList['test/test_sys_proctable_darwin.rb']
122
- when /hpux/i
123
- t.libs << 'ext/hpux'
124
- t.test_files = FileList['test/test_sys_proctable_hpux.rb']
125
- end
126
- end
127
-
128
- namespace :gem do
129
- desc 'Create a gem'
130
- task :create => [:clean] do
131
- spec = eval(IO.read('sys-proctable.gemspec'))
132
-
133
- # I've had to manually futz with the spec here in some cases
134
- # in order to get the universal platform settings I want because
135
- # of some bugginess in Rubygems' platform.rb.
136
- #
137
- case CONFIG['host_os']
138
- when /freebsd/i
139
- spec.platform = Gem::Platform.new(['universal', 'freebsd'])
140
- spec.require_paths = ['lib', 'lib/freebsd']
141
- spec.files += ['lib/freebsd/sys/proctable.rb']
142
- spec.test_files << 'test/test_sys_proctable_freebsd.rb'
143
- spec.add_dependency('ffi')
144
- when /darwin/i
145
- spec.platform = Gem::Platform.new(['universal', 'darwin'])
146
- spec.files << 'ext/darwin/sys/proctable.c'
147
- spec.extra_rdoc_files << 'ext/darwin/sys/proctable.c'
148
- spec.test_files << 'test/test_sys_proctable_darwin.rb'
149
- spec.extensions = ['ext/darwin/extconf.rb']
150
- when /hpux/i
151
- spec.platform = Gem::Platform.new(['universal', 'hpux'])
152
- spec.files << 'ext/hpux/sys/proctable.c'
153
- spec.extra_rdoc_files << 'ext/hpux/sys/proctable.c'
154
- spec.test_files << 'test/test_sys_proctable_hpux.rb'
155
- spec.extensions = ['ext/hpux/extconf.rb']
156
- when /linux/i
157
- spec.platform = Gem::Platform.new(['universal', 'linux'])
158
- spec.require_paths = ['lib', 'lib/linux']
159
- spec.files += ['lib/linux/sys/proctable.rb']
160
- spec.test_files << 'test/test_sys_proctable_linux.rb'
161
- when /sunos|solaris/i
162
- spec.platform = Gem::Platform.new(['universal', 'solaris'])
163
- spec.require_paths = ['lib', 'lib/sunos']
164
- spec.files += ['lib/sunos/sys/proctable.rb']
165
- spec.test_files << 'test/test_sys_proctable_sunos.rb'
166
- when /aix/i
167
- spec.platform = Gem::Platform.new(['universal', 'aix5'])
168
- spec.require_paths = ['lib', 'lib/aix']
169
- spec.files += ['lib/aix/sys/proctable.rb']
170
- spec.test_files << 'test/test_sys_proctable_aix.rb'
171
- when /mswin|win32|dos|cygwin|mingw|windows/i
172
- spec.platform = Gem::Platform.new(['universal', 'mingw32'])
173
- spec.require_paths = ['lib', 'lib/windows']
174
- spec.files += ['lib/windows/sys/proctable.rb']
175
- spec.test_files << 'test/test_sys_proctable_windows.rb'
176
- end
177
-
178
- spec.test_files << 'test/test_sys_top.rb'
179
-
180
- # https://github.com/rubygems/rubygems/issues/147
181
- spec.original_platform = spec.platform
182
-
183
- if Gem::VERSION < "2.0"
184
- Gem::Builder.new(spec).build
185
- else
186
- require 'rubygems/package'
187
- Gem::Package.build(spec)
188
- end
189
- end
190
-
191
- desc 'Install the sys-proctable library as a gem'
192
- task :install => [:create] do
193
- gem_name = Dir['*.gem'].first
194
- sh "gem install -l #{gem_name}"
195
- end
196
- end
197
-
198
- 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 /darwin/i
31
+ dir = 'ext/darwin'
32
+ ext = '.bundle'
33
+ when /hpux/i
34
+ dir = 'ext/hpux'
35
+ ext = '.sl'
36
+ end
37
+
38
+ if CONFIG['host_os'] =~ /darwin|hpux/i
39
+ Dir.chdir(dir) do
40
+ ruby 'extconf.rb'
41
+ sh 'make'
42
+ cp 'proctable' + ext, 'sys'
43
+ end
44
+ end
45
+ end
46
+
47
+ desc 'Install the sys-proctable library'
48
+ task :install => [:build] do
49
+ file = nil
50
+ dir = File.join(CONFIG['sitelibdir'], 'sys')
51
+
52
+ Dir.mkdir(dir) unless File.exists?(dir)
53
+
54
+ case CONFIG['host_os']
55
+ when /mswin|win32|msdos|cygwin|mingw|windows/i
56
+ file = 'lib/windows/sys/proctable.rb'
57
+ when /linux/i
58
+ file = 'lib/linux/sys/proctable.rb'
59
+ when /sunos|solaris/i
60
+ file = 'lib/sunos/sys/proctable.rb'
61
+ when /aix/i
62
+ file = 'lib/aix/sys/proctable.rb'
63
+ when /freebsd/i
64
+ file = 'lib/freebsd/sys/proctable.rb'
65
+ when /darwin/i
66
+ Dir.chdir('ext/darwin'){ sh 'make install' }
67
+ when /hpux/i
68
+ Dir.chdir('ext/hpux'){ sh 'make install' }
69
+ end
70
+
71
+ cp(file, dir, :verbose => true) if file
72
+ end
73
+
74
+ desc 'Uninstall the sys-proctable library'
75
+ task :uninstall do
76
+ case CONFIG['host_os']
77
+ when /darwin|hpux/i
78
+ dir = File.join(CONFIG['sitearchdir'], 'sys')
79
+ file = File.join(dir, 'proctable.' + CONFIG['DLEXT'])
80
+ else
81
+ dir = File.join(CONFIG['sitelibdir'], 'sys')
82
+ file = File.join(dir, 'proctable.rb')
83
+ end
84
+
85
+ rm(file)
86
+ end
87
+
88
+ desc 'Run the benchmark suite'
89
+ task :bench => [:build] do
90
+ sh "ruby -Ilib benchmarks/bench_ps.rb"
91
+ end
92
+
93
+ desc 'Run the example program'
94
+ task :example => [:build] do
95
+ sh 'ruby -Ilib -Iext examples/example_ps.rb'
96
+ end
97
+
98
+ desc 'Run the test suite'
99
+ Rake::TestTask.new do |t|
100
+ task :test => :build
101
+ t.libs << 'test' << '.'
102
+
103
+ case CONFIG['host_os']
104
+ when /mswin|msdos|cygwin|mingw|windows/i
105
+ t.test_files = FileList['test/test_sys_proctable_windows.rb']
106
+ t.libs << 'lib/windows'
107
+ when /linux/i
108
+ t.test_files = FileList['test/test_sys_proctable_linux.rb']
109
+ t.libs << 'lib/linux'
110
+ when /sunos|solaris/i
111
+ t.test_files = FileList['test/test_sys_proctable_sunos.rb']
112
+ t.libs << 'lib/sunos'
113
+ when /aix/i
114
+ t.test_files = FileList['test/test_sys_proctable_aix.rb']
115
+ t.libs << 'lib/aix'
116
+ when /freebsd/i
117
+ t.test_files = FileList['test/test_sys_proctable_freebsd.rb']
118
+ t.libs << 'lib/freebsd'
119
+ when /darwin/i
120
+ t.libs << 'ext/darwin'
121
+ t.test_files = FileList['test/test_sys_proctable_darwin.rb']
122
+ when /hpux/i
123
+ t.libs << 'ext/hpux'
124
+ t.test_files = FileList['test/test_sys_proctable_hpux.rb']
125
+ end
126
+ end
127
+
128
+ namespace :gem do
129
+ desc 'Create a gem for the specified OS, or your current OS by default'
130
+ task :create, [:os] => [:clean] do |_task, args|
131
+ require 'rubygems/package'
132
+
133
+ if args.is_a?(String)
134
+ os = args
135
+ else
136
+ args.with_defaults(:os => CONFIG['host_os'])
137
+ os = args[:os]
138
+ end
139
+
140
+ spec = eval(IO.read('sys-proctable.gemspec'))
141
+ spec.files += ['lib/sys-proctable.rb']
142
+
143
+ # I've had to manually futz with the spec here in some cases
144
+ # in order to get the universal platform settings I want because
145
+ # of some bugginess in Rubygems' platform.rb.
146
+ #
147
+ case os
148
+ when /freebsd/i
149
+ spec.platform = Gem::Platform.new(['universal', 'freebsd'])
150
+ spec.require_paths = ['lib', 'lib/freebsd']
151
+ spec.files += ['lib/freebsd/sys/proctable.rb']
152
+ spec.test_files << 'test/test_sys_proctable_freebsd.rb'
153
+ spec.add_dependency('ffi')
154
+ when /darwin/i
155
+ spec.platform = Gem::Platform.new(['universal', 'darwin'])
156
+ spec.files << 'ext/darwin/sys/proctable.c'
157
+ spec.extra_rdoc_files << 'ext/darwin/sys/proctable.c'
158
+ spec.test_files << 'test/test_sys_proctable_darwin.rb'
159
+ spec.extensions = ['ext/darwin/extconf.rb']
160
+ when /hpux/i
161
+ spec.platform = Gem::Platform.new(['universal', 'hpux'])
162
+ spec.files << 'ext/hpux/sys/proctable.c'
163
+ spec.extra_rdoc_files << 'ext/hpux/sys/proctable.c'
164
+ spec.test_files << 'test/test_sys_proctable_hpux.rb'
165
+ spec.extensions = ['ext/hpux/extconf.rb']
166
+ when /linux/i
167
+ spec.platform = Gem::Platform.new(['universal', 'linux'])
168
+ spec.require_paths = ['lib', 'lib/linux']
169
+ spec.files += ['lib/linux/sys/proctable.rb', 'lib/linux/sys/proctable/cgroup_entry.rb']
170
+ spec.test_files << 'test/test_sys_proctable_linux.rb'
171
+ when /sunos|solaris/i
172
+ spec.platform = Gem::Platform.new(['universal', 'solaris'])
173
+ spec.require_paths = ['lib', 'lib/sunos']
174
+ spec.files += ['lib/sunos/sys/proctable.rb']
175
+ spec.test_files << 'test/test_sys_proctable_sunos.rb'
176
+ when /aix/i
177
+ spec.platform = Gem::Platform.new(['universal', 'aix5'])
178
+ spec.require_paths = ['lib', 'lib/aix']
179
+ spec.files += ['lib/aix/sys/proctable.rb']
180
+ spec.test_files << 'test/test_sys_proctable_aix.rb'
181
+ when /mswin|win32|dos|cygwin|mingw|windows/i
182
+ spec.platform = Gem::Platform.new(['universal', 'mingw32'])
183
+ spec.require_paths = ['lib', 'lib/windows']
184
+ spec.files += ['lib/windows/sys/proctable.rb']
185
+ spec.test_files << 'test/test_sys_proctable_windows.rb'
186
+ else
187
+ raise "Unsupported platform: #{os}"
188
+ end
189
+
190
+ spec.test_files << 'test/test_sys_top.rb'
191
+
192
+ # https://github.com/rubygems/rubygems/issues/147
193
+ spec.original_platform = spec.platform
194
+
195
+ spec.signing_key = File.join(Dir.home, '.ssh', 'gem-private_key.pem')
196
+
197
+ Gem::Package.build(spec, true)
198
+ end
199
+
200
+ desc 'Create a gem for each supported OS'
201
+ task :create_all => [:clean] do
202
+ platforms = %w[aix darwin freebsd hpux linux solaris windows]
203
+ Rake::Task["clean"].execute
204
+ platforms.each{ |os|
205
+ FileUtils.mkdir_p("pkg/#{os}")
206
+ Rake::Task["gem:create"].execute(os)
207
+ Dir.glob("*.gem").each{ |gem| FileUtils.mv(gem, "pkg/#{os}") }
208
+ }
209
+ end
210
+
211
+ desc 'Install the sys-proctable library as a gem'
212
+ task :install => [:create] do
213
+ gem_name = Dir['*.gem'].first
214
+ sh "gem install -l #{gem_name}"
215
+ end
216
+ end
217
+
218
+ task :default => :test
@@ -1,21 +1,21 @@
1
- ########################################################################
2
- # bench_ps.rb
3
- #
4
- # Benchmark program to show overall speed and compare the block form
5
- # versus the non-block form. You should run this benchmark via the
6
- # 'rake bench' Rake task.
7
- ########################################################################
8
- require 'benchmark'
9
- require 'sys/proctable'
10
-
11
- MAX = 10
12
-
13
- Benchmark.bm do |bench|
14
- bench.report("Block form"){
15
- MAX.times{ Sys::ProcTable.ps{} }
16
- }
17
-
18
- bench.report("Non-block form"){
19
- MAX.times{ Sys::ProcTable.ps }
20
- }
21
- end
1
+ ########################################################################
2
+ # bench_ps.rb
3
+ #
4
+ # Benchmark program to show overall speed and compare the block form
5
+ # versus the non-block form. You should run this benchmark via the
6
+ # 'rake bench' Rake task.
7
+ ########################################################################
8
+ require 'benchmark'
9
+ require 'sys/proctable'
10
+
11
+ MAX = 10
12
+
13
+ Benchmark.bm do |bench|
14
+ bench.report("Block form"){
15
+ MAX.times{ Sys::ProcTable.ps{} }
16
+ }
17
+
18
+ bench.report("Non-block form"){
19
+ MAX.times{ Sys::ProcTable.ps }
20
+ }
21
+ end
data/doc/top.txt CHANGED
@@ -1,47 +1,47 @@
1
- = Description
2
- A simple 'top' interface for Ruby
3
-
4
- = Prerequisites
5
- Requires the "sys/proctable" package (which should be installed along
6
- with this package).
7
-
8
- = Synopsis
9
- require "sys/top"
10
-
11
- Sys::Top.top(5).each{ |ps|
12
- p ps
13
- }
14
-
15
- = Constants
16
- VERSION
17
- Returns the version number of this package as a String.
18
-
19
- = Class Methods
20
- Sys::Top.top(number=10, field="pctcpu")
21
- Returns an array of ProcTableStruct's. The size of the array (i.e. the
22
- number of processes) that it returns is based on +number+, and sorted by
23
- +pctcpu+. By default, the size and field values are 10 and "pctcpu",
24
- respectively.
25
-
26
- = Notes
27
- Not all fields are available on all platforms. Please check your
28
- platform specific documentation for which fields are available.
29
-
30
- = Bugs
31
- None that I'm aware of. Please log bug reports on the project page at
32
- http://www.rubyforge.org/projects/sysutils
33
-
34
- = License
35
- Artistic 2.0
36
-
37
- = Copyright
38
- (C) 2004-2009 Daniel J. Berger
39
- All Rights Reserved.
40
-
41
- = Warranty
42
- This package is provided "as is" and without any express or
43
- implied warranties, including, without limitation, the implied
44
- warranties of merchantability and fitness for a particular purpose.
45
-
46
- = Author
1
+ = Description
2
+ A simple 'top' interface for Ruby
3
+
4
+ = Prerequisites
5
+ Requires the "sys/proctable" package (which should be installed along
6
+ with this package).
7
+
8
+ = Synopsis
9
+ require "sys/top"
10
+
11
+ Sys::Top.top(5).each{ |ps|
12
+ p ps
13
+ }
14
+
15
+ = Constants
16
+ VERSION
17
+ Returns the version number of this package as a String.
18
+
19
+ = Class Methods
20
+ Sys::Top.top(number=10, field="pctcpu")
21
+ Returns an array of ProcTableStruct's. The size of the array (i.e. the
22
+ number of processes) that it returns is based on +number+, and sorted by
23
+ +pctcpu+. By default, the size and field values are 10 and "pctcpu",
24
+ respectively.
25
+
26
+ = Notes
27
+ Not all fields are available on all platforms. Please check your
28
+ platform specific documentation for which fields are available.
29
+
30
+ = Bugs
31
+ None that I'm aware of. Please log bug reports on the project page at
32
+ http://www.rubyforge.org/projects/sysutils
33
+
34
+ = License
35
+ Artistic 2.0
36
+
37
+ = Copyright
38
+ (C) 2004-2009 Daniel J. Berger
39
+ All Rights Reserved.
40
+
41
+ = Warranty
42
+ This package is provided "as is" and without any express or
43
+ implied warranties, including, without limitation, the implied
44
+ warranties of merchantability and fitness for a particular purpose.
45
+
46
+ = Author
47
47
  Daniel J. Berger
@@ -1,20 +1,20 @@
1
- #######################################################################
2
- # example_ps.rb
3
- #
4
- # Generic test program that demonstrates the use of ProcTable.ps. You
5
- # can run this via the 'rake example' task.
6
- #
7
- # Modify as you see fit
8
- #######################################################################
9
- require 'sys/proctable'
10
- include Sys
11
-
12
- puts "VERSION: " + ProcTable::VERSION
13
- sleep 2
14
-
15
- ProcTable.ps{ |s|
16
- ProcTable.fields.each{ |field|
17
- puts "#{field}: " + s.send(field).to_s
18
- }
19
- puts '=' * 30
20
- }
1
+ #######################################################################
2
+ # example_ps.rb
3
+ #
4
+ # Generic test program that demonstrates the use of ProcTable.ps. You
5
+ # can run this via the 'rake example' task.
6
+ #
7
+ # Modify as you see fit
8
+ #######################################################################
9
+ require 'sys/proctable'
10
+ include Sys
11
+
12
+ puts "VERSION: " + ProcTable::VERSION
13
+ sleep 2
14
+
15
+ ProcTable.ps{ |s|
16
+ ProcTable.fields.each{ |field|
17
+ puts "#{field}: " + s.send(field).to_s
18
+ }
19
+ puts '=' * 30
20
+ }
@@ -1,6 +1,6 @@
1
- module Sys
2
- class ProcTable
3
- # The version of the sys-proctable library
4
- VERSION = '0.9.8'
5
- end
6
- end
1
+ module Sys
2
+ class ProcTable
3
+ # The version of the sys-proctable library
4
+ VERSION = '0.9.9'
5
+ end
6
+ end