sys-uptime 0.5.4-x86-mingw32 → 0.6.0-x86-mingw32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGES CHANGED
@@ -1,144 +1,145 @@
1
- == 0.5.4 - 26-Jul-2011
2
- * Refactored and updated Rakefile and gemspec.
3
- * Some internal file reorganization and renaming.
4
- * License changed to Artistic 2.0.
5
-
6
- == 0.5.3 - 7-May-2009
7
- * Altered the Uptime.seconds implementation on Linux so that it works with
8
- both Ruby 1.8.x and 1.9.x. Thanks go to Alexey Chebotar for the spot.
9
-
10
- == 0.5.2 - 13-Dec-2008
11
- * Fixed a date/time issue in the Windows version caused by Ruby itself.
12
- * Fixed the Uptime.seconds, Uptime.minutes and Uptime.hours methods on MS
13
- Windows.
14
- * Renamed the test file to 'test_sys_uptime.rb'.
15
- * Some minor updates to the Rakefile.
16
-
17
- == 0.5.1 - 26-Jul-2007
18
- * Fixed bug in the MS Windows version caused by incorrect parsing of an
19
- MS specific date format (caused by a bug in Ruby 1.8.6). Thanks go to
20
- Robert H. for the spot.
21
- * Inlined the Rake installation tasks, so the install.rb file has been
22
- removed.
23
- * Added an 'install_gem' Rake task, and updated the README installation
24
- instructions.
25
-
26
- == 0.5.0 - 30-Mar-2007
27
- * For platforms that use C code, the code now always uses the sysctl()
28
- function if supported by your system. This replaces the platform specific
29
- checks I was doing for the various BSD flavors.
30
- * Fix for OS X - the Uptime.boot_time method now works.
31
- * UptimeError is now Uptime::Error.
32
- * Improved RDoc in the uptime.c source code.
33
- * Added a Rakefile - users should now use the 'test' and 'install' rake tasks.
34
- * Updates to the MANIFEST, README and uptime.txt files.
35
-
36
- == 0.4.5 - 19-Nov-2006
37
- * Internal layout changes, minor doc updates and gemspec improvements.
38
- * No code changes.
39
-
40
- == 0.4.4 - 30-Jun-2006
41
- * Added inline rdoc documentation to the source files.
42
- * Added a gemspec.
43
-
44
- == 0.4.3 - 18-Dec-2005
45
- * Changed the Linux version to pure Ruby. The current method of determining
46
- uptime in unix.c does not work in Linux kernel 2.6+. So, from now on it
47
- reads out of /proc/uptime.
48
-
49
- == 0.4.2 - 6-May-2005
50
- * Fixed a potential boot_time bug.
51
- * Removed the version.h file. It's no longer needed since the Windows
52
- version is pure Ruby.
53
- * NetBSD 2.x and FreeBSD 5.x now supported.
54
- * Removed the INSTALL file. Installation instructions are now in
55
- the README file.
56
- * Removed the uptime.rd file. You can generate html documentation by
57
- running rdoc over the uptime.txt file.
58
- * Made most documents rdoc friendly.
59
- * Moved project to RubyForge.
60
-
61
- == 0.4.1 - 14-Dec-2004
62
- * Moved freebsd code into unix.c file.
63
- * Should now work past 249 days (2**31) on systems that have utmpx.h.
64
- * Fixed a bug with regards to boot_time, where it was possible that it would
65
- simply be empty.
66
-
67
- == 0.4.0 - 8-Jul-2004
68
- * Removed all reference to the CLK_TCK constant, as per documentation from
69
- Richard Stevens that it is deprecated and that sysconf() should be used
70
- instead (well, I knew about this, but ignored it until now).
71
- * Scrapped the C version for Windows in favor of a pure Ruby version that
72
- uses win32ole + WMI.
73
- * Added a boot_time method for Unix systems (Windows already had this).
74
- * Added an UptimeError class on Unix systems (and replaced UptimeException
75
- on Windows).
76
- * Modified an internal function to raise an UptimeError if the times()
77
- function fails. Also, it now returns an unsigned long instead of a plain
78
- long.
79
- * Replaced the two different test suites with a single, unified test suite.
80
- * Cleaned up the extconf.rb script. I now assume that TestUnit is installed.
81
- * Removed the load_avg method (which was never advertised and which I hope
82
- you weren't using). You can find a load_avg method in the sys-cpu package.
83
- * Changed uptime.rd2 to uptime.rd to be consistent with my other packages.
84
- * Removed the uptime.html file - you may generate that on your own.
85
- * Added warranty and license info.
86
-
87
- == 0.3.2 - 30-Dec-2003
88
- * Cleaned up some warnings that showed up with -Wall on some unix platforms
89
- (int vs long format, explicit include)
90
- * Minor test suite and extconf.rb changes
91
-
92
- == 0.3.1 - 25-Jun-2003
93
- * Modified test files to handle HP-UX extensions
94
- * Minor doc updates
95
- * Added the dhms() method. Actually, this was in the 0.3.0
96
- release, I just forgot to mention it in this file :)
97
-
98
- == 0.3.0 - 22-Jun-2003
99
- * Added OS X support - thanks go to Mike Hall for the patch
100
- * Fixed incorrect values in FreeBSD (again Mike Hall)
101
- * Modified tc_unix.rb test suite to handle OS X, along with a bit
102
- * of minor cleanup
103
- * Removed VERSION class method. Use the constant instead
104
- * Separated FreeBSD/OS X source into its own file (freebsd.c).
105
- The #ifdefs were starting to get too ugly for me
106
-
107
- == 0.2.1 - 13-May-2003
108
- * Fixed bug in extconf.rb file, and made some major changes
109
- * Modified test.rb for those without TestUnit
110
- * Modified TestUnit tests - some bogus tests were removed
111
- * Added a README file with some additional info
112
- * Created a version.h file, so that I can keep the VERSION number
113
- in one place
114
- * Docs automatically included in doc directory (i.e. no more interactive
115
- document creation)
116
-
117
- == 0.2.0 - 13-Mar-2003
118
- * Added MS Windows support
119
- * Added a VERSION constant
120
- * Added a test suite (for those with TestUnit installed)
121
- * Internal directory layout change
122
- * uptime.c is now split into unix.c and windows.c (and linked appropriately)
123
- * Changelog and Manifest are now CHANGES and MANIFEST, respectively
124
- * Many changes to extconf.rb
125
-
126
- == 0.1.3 - 6-Jan-2003
127
- * Added a VERSION class method
128
- * Added a copyright notice
129
- * Fixed up the docs a bit and moved them to the doc directory
130
- * Changed the tarball name to match the RAA package name
131
- * Modified test.rb script to make it better
132
- * Changed install instructions slightly
133
-
134
- == 0.1.2 - 25-Aug-2002
135
- * Slight change to preprocessor commands to avoid redefining CLK_TCK on
136
- those systems that define it in time.h
137
- * Added an INSTALL file
138
-
139
- == 0.1.1 - 21-Jun-2002
140
- * The CLK_TCK constant wasn't necessarily being set correctly, which could
141
- lead to some odd results. This has been fixed.
142
-
143
- == 0.1.0 - 17-Jun-2002
144
- * Initial release
1
+ == 0.6.0 - 11-Dec-2011
2
+ * Switched Unix code to use FFI.
3
+ * Removed all of the C related tasks from the Rakefile and added the gem:build
4
+ and gem:install tasks.
5
+ * Internal directory layout changes, with appropriate changes to the gemspec.
6
+
7
+ == 0.5.3 - 7-May-2009
8
+ * Altered the Uptime.seconds implementation on Linux so that it works with
9
+ both Ruby 1.8.x and 1.9.x. Thanks go to Alexey Chebotar for the spot.
10
+
11
+ == 0.5.2 - 13-Dec-2008
12
+ * Fixed a date/time issue in the Windows version caused by Ruby itself.
13
+ * Fixed the Uptime.seconds, Uptime.minutes and Uptime.hours methods on MS
14
+ Windows.
15
+ * Renamed the test file to 'test_sys_uptime.rb'.
16
+ * Some minor updates to the Rakefile.
17
+
18
+ == 0.5.1 - 26-Jul-2007
19
+ * Fixed bug in the MS Windows version caused by incorrect parsing of an
20
+ MS specific date format (caused by a bug in Ruby 1.8.6). Thanks go to
21
+ Robert H. for the spot.
22
+ * Inlined the Rake installation tasks, so the install.rb file has been
23
+ removed.
24
+ * Added an 'install_gem' Rake task, and updated the README installation
25
+ instructions.
26
+
27
+ == 0.5.0 - 30-Mar-2007
28
+ * For platforms that use C code, the code now always uses the sysctl()
29
+ function if supported by your system. This replaces the platform specific
30
+ checks I was doing for the various BSD flavors.
31
+ * Fix for OS X - the Uptime.boot_time method now works.
32
+ * UptimeError is now Uptime::Error.
33
+ * Improved RDoc in the uptime.c source code.
34
+ * Added a Rakefile - users should now use the 'test' and 'install' rake tasks.
35
+ * Updates to the MANIFEST, README and uptime.txt files.
36
+
37
+ == 0.4.5 - 19-Nov-2006
38
+ * Internal layout changes, minor doc updates and gemspec improvements.
39
+ * No code changes.
40
+
41
+ == 0.4.4 - 30-Jun-2006
42
+ * Added inline rdoc documentation to the source files.
43
+ * Added a gemspec.
44
+
45
+ == 0.4.3 - 18-Dec-2005
46
+ * Changed the Linux version to pure Ruby. The current method of determining
47
+ uptime in unix.c does not work in Linux kernel 2.6+. So, from now on it
48
+ reads out of /proc/uptime.
49
+
50
+ == 0.4.2 - 6-May-2005
51
+ * Fixed a potential boot_time bug.
52
+ * Removed the version.h file. It's no longer needed since the Windows
53
+ version is pure Ruby.
54
+ * NetBSD 2.x and FreeBSD 5.x now supported.
55
+ * Removed the INSTALL file. Installation instructions are now in
56
+ the README file.
57
+ * Removed the uptime.rd file. You can generate html documentation by
58
+ running rdoc over the uptime.txt file.
59
+ * Made most documents rdoc friendly.
60
+ * Moved project to RubyForge.
61
+
62
+ == 0.4.1 - 14-Dec-2004
63
+ * Moved freebsd code into unix.c file.
64
+ * Should now work past 249 days (2**31) on systems that have utmpx.h.
65
+ * Fixed a bug with regards to boot_time, where it was possible that it would
66
+ simply be empty.
67
+
68
+ == 0.4.0 - 8-Jul-2004
69
+ * Removed all reference to the CLK_TCK constant, as per documentation from
70
+ Richard Stevens that it is deprecated and that sysconf() should be used
71
+ instead (well, I knew about this, but ignored it until now).
72
+ * Scrapped the C version for Windows in favor of a pure Ruby version that
73
+ uses win32ole + WMI.
74
+ * Added a boot_time method for Unix systems (Windows already had this).
75
+ * Added an UptimeError class on Unix systems (and replaced UptimeException
76
+ on Windows).
77
+ * Modified an internal function to raise an UptimeError if the times()
78
+ function fails. Also, it now returns an unsigned long instead of a plain
79
+ long.
80
+ * Replaced the two different test suites with a single, unified test suite.
81
+ * Cleaned up the extconf.rb script. I now assume that TestUnit is installed.
82
+ * Removed the load_avg method (which was never advertised and which I hope
83
+ you weren't using). You can find a load_avg method in the sys-cpu package.
84
+ * Changed uptime.rd2 to uptime.rd to be consistent with my other packages.
85
+ * Removed the uptime.html file - you may generate that on your own.
86
+ * Added warranty and license info.
87
+
88
+ == 0.3.2 - 30-Dec-2003
89
+ * Cleaned up some warnings that showed up with -Wall on some unix platforms
90
+ (int vs long format, explicit include)
91
+ * Minor test suite and extconf.rb changes
92
+
93
+ == 0.3.1 - 25-Jun-2003
94
+ * Modified test files to handle HP-UX extensions
95
+ * Minor doc updates
96
+ * Added the dhms() method. Actually, this was in the 0.3.0
97
+ release, I just forgot to mention it in this file :)
98
+
99
+ == 0.3.0 - 22-Jun-2003
100
+ * Added OS X support - thanks go to Mike Hall for the patch
101
+ * Fixed incorrect values in FreeBSD (again Mike Hall)
102
+ * Modified tc_unix.rb test suite to handle OS X, along with a bit
103
+ * of minor cleanup
104
+ * Removed VERSION class method. Use the constant instead
105
+ * Separated FreeBSD/OS X source into its own file (freebsd.c).
106
+ The #ifdefs were starting to get too ugly for me
107
+
108
+ == 0.2.1 - 13-May-2003
109
+ * Fixed bug in extconf.rb file, and made some major changes
110
+ * Modified test.rb for those without TestUnit
111
+ * Modified TestUnit tests - some bogus tests were removed
112
+ * Added a README file with some additional info
113
+ * Created a version.h file, so that I can keep the VERSION number
114
+ in one place
115
+ * Docs automatically included in doc directory (i.e. no more interactive
116
+ document creation)
117
+
118
+ == 0.2.0 - 13-Mar-2003
119
+ * Added MS Windows support
120
+ * Added a VERSION constant
121
+ * Added a test suite (for those with TestUnit installed)
122
+ * Internal directory layout change
123
+ * uptime.c is now split into unix.c and windows.c (and linked appropriately)
124
+ * Changelog and Manifest are now CHANGES and MANIFEST, respectively
125
+ * Many changes to extconf.rb
126
+
127
+ == 0.1.3 - 6-Jan-2003
128
+ * Added a VERSION class method
129
+ * Added a copyright notice
130
+ * Fixed up the docs a bit and moved them to the doc directory
131
+ * Changed the tarball name to match the RAA package name
132
+ * Modified test.rb script to make it better
133
+ * Changed install instructions slightly
134
+
135
+ == 0.1.2 - 25-Aug-2002
136
+ * Slight change to preprocessor commands to avoid redefining CLK_TCK on
137
+ those systems that define it in time.h
138
+ * Added an INSTALL file
139
+
140
+ == 0.1.1 - 21-Jun-2002
141
+ * The CLK_TCK constant wasn't necessarily being set correctly, which could
142
+ lead to some odd results. This has been fixed.
143
+
144
+ == 0.1.0 - 17-Jun-2002
145
+ * Initial release
data/MANIFEST CHANGED
@@ -1,12 +1,13 @@
1
- * CHANGES
2
- * MANIFEST
3
- * Rakefile
4
- * README
5
- * sys-uptime.gemspec
6
- * doc/uptime.txt
7
- * examples/sys_uptime_example.rb
8
- * ext/extconf.rb
9
- * ext/sys/uptime.c
10
- * lib/linux/sys/uptime.rb
11
- * lib/windows/sys/uptime.rb
12
- * test/test_sys_uptime.rb
1
+ * CHANGES
2
+ * MANIFEST
3
+ * Rakefile
4
+ * README
5
+ * install.rb
6
+ * sys-uptime.gemspec
7
+ * doc/uptime.txt
8
+ * examples/test.rb
9
+ * ext/extconf.rb
10
+ * ext/sys/uptime.c
11
+ * lib/sys/linux.rb
12
+ * lib/sys/windows.rb
13
+ * test/test_sys_uptime.rb
data/README CHANGED
@@ -1,14 +1,67 @@
1
- = Description
2
- A Ruby interface for getting system uptime information.
3
-
4
- = Prerequisites
5
- Ruby 1.8.0 or later.
6
- Ruby 1.8.2 or later is recommended on MS Windows.
7
- A C compiler, except for MS Windows.
8
-
9
- = Installation
10
- rake test (optional)
11
- rake install (non-gem) or rake install_gem (gem).
12
-
13
- == Notes
14
- For additional documentation see doc/uptime.txt.
1
+ = Description
2
+ A Ruby interface for getting system uptime information.
3
+
4
+ = Prerequisites
5
+ ffi 0.5.0 or later.
6
+
7
+ = Installation
8
+ gem install sys-uptime # Unix platforms
9
+ gem install sys-uptime --platform mswin32 # MS Windows
10
+
11
+ = Synopsis
12
+ require 'sys/uptime'
13
+ include Sys
14
+
15
+ # Get everything
16
+ p Uptime.uptime
17
+ p Uptime.dhms.join(', ')
18
+
19
+ # Get individual units
20
+ p Uptime.days
21
+ p Uptime.hours
22
+ p Uptime.minutes
23
+ p Uptime.seconds
24
+
25
+ # Get the boot time
26
+ p Uptime.boot_time
27
+
28
+ = Notes
29
+ On MS Windows the Uptime.uptime and Uptime_boot_time methods optionally
30
+ takes a host name as a single argument. The default is localhost.
31
+
32
+ The current time, users and load average are not included in this library
33
+ module, even though you may be used to seeing them with the command
34
+ line version of 'uptime'.
35
+
36
+ == Known Bugs
37
+ None that I am aware of. Please log any bugs you find on the project
38
+ website at http://www.rubyforge.org/projects/sysutils.
39
+
40
+ == Questions
41
+ "Doesn't Struct::Tms do this?" - No.
42
+
43
+ == License
44
+ Artistic 2.0
45
+
46
+ == Copyright
47
+ Copyright 2002-2010, Daniel J. Berger
48
+
49
+ All Rights Reserved. This module is free software. It may be used,
50
+ redistributed and/or modified under the same terms as Ruby itself.
51
+
52
+ == Warranty
53
+ This library is provided "as is" and without any express or
54
+ implied warranties, including, without limitation, the implied
55
+ warranties of merchantability and fitness for a particular purpose.
56
+
57
+ == Acknowledgements
58
+ Andrea Fazzi for help with the FFI version.
59
+
60
+ Mike Hall for help with the BSD side of things for the original C code.
61
+
62
+ Ola Eriksson, whose source code I shamelessly plagiarized to get a better
63
+ implementation for systems that have the utmpx.h header file for the
64
+ original C code.
65
+
66
+ == Author
67
+ Daniel J. Berger
data/Rakefile CHANGED
@@ -1,87 +1,44 @@
1
- require 'rake'
2
- require 'rake/clean'
3
- require 'rake/testtask'
4
- require 'rbconfig'
5
- include Config
6
-
7
- CLEAN.include(
8
- '**/*.gem', # Gem files
9
- '**/*.rbc', # Rubinius
10
- '**/*.o', # C object file
11
- '**/*.log', # Ruby extension build log
12
- '**/Makefile', # C Makefile
13
- '**/conftest.dSYM', # OS X build directory
14
- "**/*.#{CONFIG['DLEXT']}", # C shared object
15
- 'lib/sys/uptime.rb' # Renamed source file
16
- )
17
-
18
- desc "Build the sys-uptime library on UNIX systems"
19
- task :build => [:clean] do
20
- Dir.chdir('ext') do
21
- unless Config::CONFIG['host_os'] =~ /windows|mswin|win32|mingw|cygwin|dos|linux/i
22
- ruby 'extconf.rb'
23
- sh 'make'
24
- cp "uptime." + CONFIG['DLEXT'], "sys"
25
- end
26
- end
27
- end
28
-
29
- namespace :gem do
30
- desc "Create the gem for the sys-uptime library"
31
- task :create => [:clean] do
32
- spec = eval(IO.read('sys-uptime.gemspec'))
33
-
34
- case Config::CONFIG['host_os']
35
- when /windows|win32|cygwin|mingw|dos|mswin/
36
- spec.platform = Gem::Platform::CURRENT
37
- spec.platform.cpu = 'universal'
38
- spec.require_paths = ['lib', 'lib/windows']
39
- when /linux/
40
- spec.platform = Gem::Platform.new('universal-linux')
41
- spec.require_paths = ['lib', 'lib/linux']
42
- else
43
- spec.platform = Gem::Platform::RUBY
44
- spec.extensions = ['ext/extconf.rb']
45
- spec.extra_rdoc_files << 'ext/sys/uptime.c'
46
- end
47
-
48
- Gem::Builder.new(spec).build
49
- end
50
-
51
- desc "Install the sys-uptime library"
52
- task :install => [:create] do
53
- gem_name = Dir['*.gem'].first
54
- sh "gem install #{gem_name}"
55
- end
56
- end
57
-
58
- task :example => [:build] do
59
- case Config::CONFIG['host_os']
60
- when /windows|win32|cygwin|mingw|dos|mswin/
61
- path = 'lib/windows'
62
- when /linux/
63
- path = 'lib/linux'
64
- else
65
- path = 'ext'
66
- end
67
- sh "ruby -I#{path} examples/sys_uptime_example.rb"
68
- end
69
-
70
- desc "Run the test suite"
71
- Rake::TestTask.new("test") do |t|
72
- task :test => :build
73
- t.libs << 'test' << '.'
74
- t.warning = true
75
- t.verbose = true
76
-
77
- case Config::CONFIG['host_os']
78
- when /windows|win32|cygwin|mingw|dos|mswin/
79
- t.libs << 'lib/windows'
80
- when /linux/
81
- t.libs << 'lib/linux'
82
- else
83
- t.libs << 'ext'
84
- end
85
- end
86
-
87
- task :default => :test
1
+ require 'rake'
2
+ require 'rake/clean'
3
+ require 'rake/testtask'
4
+
5
+ CLEAN.include("**/*.gem", "**/*.rbx", "**/*.rbc")
6
+
7
+ namespace 'gem' do
8
+ desc 'Build the sys-uptime gem'
9
+ task :create => [:clean] do
10
+ spec = eval(IO.read('sys-uptime.gemspec'))
11
+
12
+ if File::ALT_SEPARATOR
13
+ spec.require_paths = ['lib', 'lib/windows']
14
+ spec.platform = Gem::Platform::CURRENT
15
+ spec.platform.cpu = 'universal'
16
+ spec.platform.version = nil
17
+ else
18
+ spec.require_paths = ['lib', 'lib/unix']
19
+ spec.add_dependency('ffi', '>= 1.0.0')
20
+ end
21
+
22
+ Gem::Builder.new(spec).build
23
+ end
24
+
25
+ desc 'Install the sys-uptime gem'
26
+ task :install => [:build] do
27
+ file = Dir["*.gem"].first
28
+ sh "gem install #{file}"
29
+ end
30
+ end
31
+
32
+ desc "Run the test suite"
33
+ Rake::TestTask.new do |t|
34
+ if File::ALT_SEPARATOR
35
+ t.libs << 'lib/windows'
36
+ else
37
+ t.libs << 'lib/unix'
38
+ end
39
+
40
+ t.warning = true
41
+ t.verbose = true
42
+ end
43
+
44
+ task :default => :test
@@ -1,21 +1,21 @@
1
- ###########################################################
2
- # sys_uptime_example.rb
3
- #
4
- # A generic test script for general futzing. You can run
5
- # this script via the 'rake example' task.
6
- ###########################################################
7
- require 'sys/uptime'
8
- include Sys
9
-
10
- print "\nGENERIC TEST SCRIPT FOR SYS-UPTIME\n\n"
11
- puts 'VERSION: ' + Uptime::VERSION
12
-
13
- puts "Days: " + Uptime.days.to_s
14
- puts "Hours: " + Uptime.hours.to_s
15
- puts "Minutes: " + Uptime.minutes.to_s
16
- puts "Seconds: " + Uptime.seconds.to_s
17
- puts "Uptime: " + Uptime.uptime
18
- puts "DHMS: " + Uptime.dhms.join(', ')
19
- puts "Boot Time: " + Uptime.boot_time.to_s
20
-
21
- print "\nTest successful\n"
1
+ ###########################################################
2
+ # uptime_test.rb
3
+ #
4
+ # A generic test script for general futzing. You can run
5
+ # this script via the 'rake example' task.
6
+ ###########################################################
7
+ require 'sys/uptime'
8
+ include Sys
9
+
10
+ print "\nGENERIC TEST SCRIPT FOR SYS-UPTIME\n\n"
11
+ puts 'VERSION: ' + Uptime::VERSION
12
+
13
+ puts "Days: " + Uptime.days.to_s
14
+ puts "Hours: " + Uptime.hours.to_s
15
+ puts "Minutes: " + Uptime.minutes.to_s
16
+ puts "Seconds: " + Uptime.seconds.to_s
17
+ puts "Uptime: " + Uptime.uptime
18
+ puts "DHMS: " + Uptime.dhms.join(', ')
19
+ puts "Boot Time: " + Uptime.boot_time.to_s
20
+
21
+ print "\nTest successful\n"