linux-kstat 0.1.2-universal-linux → 0.1.3-universal-linux
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES +3 -0
- data/Rakefile +36 -32
- data/lib/linux/kstat.rb +17 -15
- data/linux-kstat.gemspec +1 -1
- data/test/test_linux_kstat.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 95930e43f1dee6734e273dcb7ab65ddb653fc310
|
4
|
+
data.tar.gz: cfba5ef8611d792e1874e421a017f5183188c516
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 22b61750e3cfd5942f6f9f173194cda9ca602e09b1d41f2203d78d2ce52af245044ff7a46455e666dceb340c0ff495318b94fb5529f2347a4cf3c0c14a91d35d
|
7
|
+
data.tar.gz: 71c368743ae0ef6045b2935b0b2a01a47ab794ba03be5de21c19c2bbc1e051c77c9336ef60999f8b73b1696bd063e051c5f5cb4987661b1bedeab28776fd5094
|
data/CHANGES
CHANGED
data/Rakefile
CHANGED
@@ -1,32 +1,36 @@
|
|
1
|
-
require 'rake'
|
2
|
-
require 'rake/clean'
|
3
|
-
require 'rake/testtask'
|
4
|
-
|
5
|
-
CLEAN.include('**/*.gem', '**/*.rbc')
|
6
|
-
|
7
|
-
namespace :gem do
|
8
|
-
desc 'Build the linux-kstat gem'
|
9
|
-
task :create => [:clean] do
|
10
|
-
spec = eval(IO.read('linux-kstat.gemspec'))
|
11
|
-
if Gem::VERSION < "2.0"
|
12
|
-
Gem::Builder.new(spec).build
|
13
|
-
else
|
14
|
-
require 'rubygems/package'
|
15
|
-
Gem::Package.build(spec)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
desc "Install the linux-kstat gem"
|
20
|
-
task :install => [:create] do
|
21
|
-
file = Dir["*.gem"].first
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
1
|
+
require 'rake'
|
2
|
+
require 'rake/clean'
|
3
|
+
require 'rake/testtask'
|
4
|
+
|
5
|
+
CLEAN.include('**/*.gem', '**/*.rbc')
|
6
|
+
|
7
|
+
namespace :gem do
|
8
|
+
desc 'Build the linux-kstat gem'
|
9
|
+
task :create => [:clean] do
|
10
|
+
spec = eval(IO.read('linux-kstat.gemspec'))
|
11
|
+
if Gem::VERSION < "2.0"
|
12
|
+
Gem::Builder.new(spec).build
|
13
|
+
else
|
14
|
+
require 'rubygems/package'
|
15
|
+
Gem::Package.build(spec)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
desc "Install the linux-kstat gem"
|
20
|
+
task :install => [:create] do
|
21
|
+
file = Dir["*.gem"].first
|
22
|
+
if RUBY_PLATFORM == 'java'
|
23
|
+
sh "jruby -S gem install -l #{file}"
|
24
|
+
else
|
25
|
+
sh "gem install -l #{file}"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
Rake::TestTask.new do |t|
|
31
|
+
task :test => :clean
|
32
|
+
t.warning = true
|
33
|
+
t.verbose = true
|
34
|
+
end
|
35
|
+
|
36
|
+
task :default => :test
|
data/lib/linux/kstat.rb
CHANGED
@@ -7,7 +7,7 @@ module Linux
|
|
7
7
|
extend Forwardable
|
8
8
|
|
9
9
|
# The version of the linux-kstat library
|
10
|
-
VERSION = '0.1.
|
10
|
+
VERSION = '0.1.3'
|
11
11
|
|
12
12
|
# :stopdoc:
|
13
13
|
|
@@ -51,21 +51,23 @@ module Linux
|
|
51
51
|
|
52
52
|
IO.readlines('/proc/stat').each{ |line|
|
53
53
|
info = line.split
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
if info.size > 2
|
66
|
-
hash[info.first.to_sym] = info[1..-1].map{ |e| e.to_i }
|
54
|
+
unless info.empty?
|
55
|
+
if info.first =~ /^cpu/i
|
56
|
+
hash[info.first.to_sym] = {
|
57
|
+
:user => info[1].to_i,
|
58
|
+
:nice => info[2].to_i,
|
59
|
+
:system => info[3].to_i,
|
60
|
+
:idle => info[4].to_i,
|
61
|
+
:iowait => info[5].to_i,
|
62
|
+
:irq => info[6].to_i,
|
63
|
+
:softirq => info[7].to_i
|
64
|
+
}
|
67
65
|
else
|
68
|
-
|
66
|
+
if info.size > 2
|
67
|
+
hash[info.first.to_sym] = info[1..-1].map{ |e| e.to_i }
|
68
|
+
else
|
69
|
+
hash[info.first.to_sym] = info[1].to_i
|
70
|
+
end
|
69
71
|
end
|
70
72
|
end
|
71
73
|
}
|
data/linux-kstat.gemspec
CHANGED
data/test/test_linux_kstat.rb
CHANGED
@@ -12,7 +12,7 @@ class TC_Linux_Kstat < Test::Unit::TestCase
|
|
12
12
|
end
|
13
13
|
|
14
14
|
test "version constant is set to the expected value" do
|
15
|
-
assert_equal('0.1.
|
15
|
+
assert_equal('0.1.3', Linux::Kstat::VERSION)
|
16
16
|
end
|
17
17
|
|
18
18
|
test "kstat object can be accessed like a hash" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: linux-kstat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: universal-linux
|
6
6
|
authors:
|
7
7
|
- Daniel J. Berger
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-12-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: test-unit
|
@@ -62,7 +62,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
62
62
|
version: '0'
|
63
63
|
requirements: []
|
64
64
|
rubyforge_project:
|
65
|
-
rubygems_version: 2.4.
|
65
|
+
rubygems_version: 2.4.5
|
66
66
|
signing_key:
|
67
67
|
specification_version: 4
|
68
68
|
summary: Ruby interface for Linux kernel stats in /proc/stat
|