sys-uptime 0.6.0-x86-mingw32 → 0.6.1-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES CHANGED
@@ -1,3 +1,8 @@
1
+ == 0.6.1 - 22-Oct-2012
2
+ * Refactored a private method in the MS Windows source.
3
+ * Minor fix for one private method test.
4
+ * Fixed an RbConfig vs Config warning. Thanks Pedro Carrico.
5
+
1
6
  == 0.6.0 - 11-Dec-2011
2
7
  * Switched Unix code to use FFI.
3
8
  * Removed all of the C related tasks from the Rakefile and added the gem:build
data/README CHANGED
@@ -2,11 +2,10 @@
2
2
  A Ruby interface for getting system uptime information.
3
3
 
4
4
  = Prerequisites
5
- ffi 0.5.0 or later.
5
+ ffi 0.1.0 or later on Unixy platforms.
6
6
 
7
7
  = Installation
8
- gem install sys-uptime # Unix platforms
9
- gem install sys-uptime --platform mswin32 # MS Windows
8
+ gem install sys-uptime
10
9
 
11
10
  = Synopsis
12
11
  require 'sys/uptime'
@@ -35,7 +34,7 @@
35
34
 
36
35
  == Known Bugs
37
36
  None that I am aware of. Please log any bugs you find on the project
38
- website at http://www.rubyforge.org/projects/sysutils.
37
+ website at https://github.com/djberg96/sys-uptime.
39
38
 
40
39
  == Questions
41
40
  "Doesn't Struct::Tms do this?" - No.
@@ -44,7 +43,7 @@
44
43
  Artistic 2.0
45
44
 
46
45
  == Copyright
47
- Copyright 2002-2010, Daniel J. Berger
46
+ Copyright 2002-2011, Daniel J. Berger
48
47
 
49
48
  All Rights Reserved. This module is free software. It may be used,
50
49
  redistributed and/or modified under the same terms as Ruby itself.
data/Rakefile CHANGED
@@ -23,7 +23,7 @@ namespace 'gem' do
23
23
  end
24
24
 
25
25
  desc 'Install the sys-uptime gem'
26
- task :install => [:build] do
26
+ task :install => [:create] do
27
27
  file = Dir["*.gem"].first
28
28
  sh "gem install #{file}"
29
29
  end
@@ -13,7 +13,7 @@ module Sys
13
13
  class Error < StandardError; end
14
14
 
15
15
  # The version of the sys-uptime library
16
- VERSION = '0.6.0'
16
+ VERSION = '0.6.1'
17
17
 
18
18
  private
19
19
 
@@ -93,7 +93,7 @@ module Sys
93
93
  # Sys::Uptime.boot_time # => Mon Jul 13 06:08:25 -0600 2009
94
94
  #
95
95
  def self.boot_time
96
- if Config::CONFIG['host_os'] =~ /linux/i
96
+ if RbConfig::CONFIG['host_os'] =~ /linux/i
97
97
  Time.now - self.seconds
98
98
  elsif respond_to?(:sysctl, true)
99
99
  tv = Timeval.new
@@ -128,7 +128,7 @@ module Sys
128
128
  # Sys::Uptime.seconds => 118800
129
129
  #
130
130
  def self.seconds
131
- if Config::CONFIG['host_os'] =~ /linux/i
131
+ if RbConfig::CONFIG['host_os'] =~ /linux/i
132
132
  begin
133
133
  IO.read('/proc/uptime').split.first.to_i
134
134
  rescue Exception => err
@@ -14,7 +14,7 @@ module Sys
14
14
  class Error < StandardError; end
15
15
 
16
16
  # The version of the sys-uptime library.
17
- VERSION = '0.6.0'
17
+ VERSION = '0.6.1'
18
18
 
19
19
  # Returns the boot time as a Time object.
20
20
  #
@@ -139,24 +139,7 @@ module Sys
139
139
  # Returns the number of seconds since boot.
140
140
  #
141
141
  def self.get_seconds(host)
142
- cs = "winmgmts://#{host}/root/cimv2"
143
- begin
144
- wmi = WIN32OLE.connect(cs)
145
- rescue WIN32OLERuntimeError => e
146
- raise Error, e
147
- else
148
- query = "select LastBootupTime from Win32_OperatingSystem"
149
- results = wmi.ExecQuery(query)
150
- now = Time.now
151
-
152
- results.each{ |ole|
153
- time_array = parse_ms_date(ole.LastBootupTime)
154
- boot_time = Time.mktime(*time_array)
155
- break
156
- }
157
- end
158
-
159
- (now - boot_time).to_i
142
+ (Time.now - boot_time).to_i
160
143
  end
161
144
 
162
145
  private_class_method :get_seconds
data/sys-uptime.gemspec CHANGED
@@ -2,12 +2,11 @@ require 'rubygems'
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = 'sys-uptime'
5
- spec.version = '0.6.0'
5
+ spec.version = '0.6.1'
6
6
  spec.author = 'Daniel J. Berger'
7
7
  spec.license = 'Artistic 2.0'
8
8
  spec.email = 'djberg96@gmail.com'
9
9
  spec.homepage = 'https://github.com/djberg96/sys-uptime'
10
- spec.platform = Gem::Platform::RUBY
11
10
  spec.summary = 'A Ruby interface for getting system uptime information.'
12
11
  spec.test_file = 'test/test_sys_uptime.rb'
13
12
  spec.files = Dir["**/*"].reject{ |f| f.include?('git') }
@@ -4,17 +4,14 @@
4
4
  # Test suite for sys-uptime. This should generally be run via the
5
5
  # 'rake test' task, since it handles the pre-setup code for you.
6
6
  #####################################################################
7
- require 'rubygems'
8
- gem 'test-unit'
9
-
10
7
  require 'sys/uptime'
11
- require 'test/unit'
8
+ require 'test-unit'
12
9
  require 'socket'
13
10
  include Sys
14
11
 
15
12
  class TC_Sys_Uptime < Test::Unit::TestCase
16
13
  test "version is set to expected value" do
17
- assert_equal('0.6.0', Uptime::VERSION)
14
+ assert_equal('0.6.1', Uptime::VERSION)
18
15
  end
19
16
 
20
17
  test "seconds method basic functionality" do
@@ -103,7 +100,7 @@ class TC_Sys_Uptime < Test::Unit::TestCase
103
100
 
104
101
  test "Ensure that ffi functions are private" do
105
102
  methods = Uptime.methods(false).map{ |e| e.to_s }
106
- assert_false(Uptime.methods.include?('time'))
107
- assert_false(Uptime.methods.include?('times'))
103
+ assert_false(methods.include?('time'))
104
+ assert_false(methods.include?('times'))
108
105
  end
109
106
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sys-uptime
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  prerelease:
6
6
  platform: x86-mingw32
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-12-11 00:00:00.000000000Z
12
+ date: 2012-10-22 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: ! " The sys-uptime library is a simple interface for gathering uptime\n
15
15
  \ information. You can retrieve data in seconds, minutes, days, hours,\n or
@@ -53,7 +53,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
53
53
  version: '0'
54
54
  requirements: []
55
55
  rubyforge_project: sysutils
56
- rubygems_version: 1.7.2
56
+ rubygems_version: 1.8.24
57
57
  signing_key:
58
58
  specification_version: 3
59
59
  summary: A Ruby interface for getting system uptime information.