cpu 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -0
- data/Gemfile +0 -8
- data/Rakefile +32 -116
- data/VERSION +1 -1
- data/bin/coretemp +2 -2
- data/cpu.gemspec +21 -15
- data/lib/cpu/version.rb +1 -1
- data/tests/usage_test.rb +1 -1
- metadata +68 -54
data/.gitignore
ADDED
data/Gemfile
CHANGED
data/Rakefile
CHANGED
@@ -1,121 +1,37 @@
|
|
1
1
|
# vim: set filetype=ruby et sw=2 ts=2:
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
end
|
35
|
-
|
36
|
-
desc "Create documentation"
|
37
|
-
task :doc do
|
38
|
-
sh "sdoc -m README.rdoc -t 'CPU' README.rdoc #{Dir['lib/**/*.rb'] * ' '}"
|
39
|
-
end
|
40
|
-
|
41
|
-
namespace :gems do
|
42
|
-
desc "Install all gems from the Gemfile"
|
43
|
-
task :install do
|
44
|
-
sh 'bundle install'
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
if defined? Gem
|
49
|
-
spec = Gem::Specification.new do |s|
|
50
|
-
s.name = PKG_NAME
|
51
|
-
s.version = PKG_VERSION
|
52
|
-
s.summary = "CPU information in Ruby/Linux"
|
53
|
-
s.description = "Library to gather CPU information (load averages, usage,"\
|
54
|
-
" temperature) in Ruby on Linux"
|
55
|
-
|
56
|
-
s.executables = 'coretemp'
|
57
|
-
s.files = PKG_FILES
|
58
|
-
|
59
|
-
s.require_path = 'lib'
|
60
|
-
|
61
|
-
s.add_dependency 'spruz', '~>0.2.2'
|
62
|
-
|
63
|
-
s.rdoc_options << '--main' << 'README.rdoc' << '--title' << 'CPU'
|
64
|
-
s.extra_rdoc_files << 'README.rdoc'
|
65
|
-
s.test_files.concat Dir['tests/test_*.rb']
|
66
|
-
|
67
|
-
s.author = "Florian Frank"
|
68
|
-
s.email = "flori@ping.de"
|
69
|
-
s.homepage = "http://flori.github.com/#{PKG_NAME}"
|
70
|
-
s.rubyforge_project = PKG_NAME
|
71
|
-
end
|
72
|
-
|
73
|
-
desc 'Create a gemspec file'
|
74
|
-
task :gemspec => :version do
|
75
|
-
File.open('cpu.gemspec', 'w') do |gemspec|
|
76
|
-
gemspec.write spec.to_ruby
|
3
|
+
require 'gem_hadar'
|
4
|
+
|
5
|
+
GemHadar do
|
6
|
+
name 'cpu'
|
7
|
+
path_module 'CPU'
|
8
|
+
author 'Florian Frank'
|
9
|
+
email 'flori@ping.de'
|
10
|
+
homepage "http://flori.github.com/#{name}"
|
11
|
+
summary 'CPU information in Ruby/Linux'
|
12
|
+
description 'Library to gather CPU information (load averages, usage,'\
|
13
|
+
' temperature) in Ruby on Linux'
|
14
|
+
|
15
|
+
test_dir 'tests'
|
16
|
+
ignore '.*.sw[pon]', 'pkg', 'Gemfile.lock'
|
17
|
+
readme 'README.rdoc'
|
18
|
+
executables 'coretemp'
|
19
|
+
|
20
|
+
dependency 'spruz', '~>0.2.2'
|
21
|
+
dependency 'more_math', '~>0.0'
|
22
|
+
|
23
|
+
install_library do
|
24
|
+
libdir = CONFIG["sitelibdir"]
|
25
|
+
cd 'lib' do
|
26
|
+
dst = File.join(libdir, 'cpu')
|
27
|
+
mkdir_p dst
|
28
|
+
cd 'cpu' do
|
29
|
+
for file in Dir['*.rb']
|
30
|
+
install file, File.join(dst, file)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
install 'cpu.rb', libdir
|
77
34
|
end
|
78
|
-
|
79
|
-
|
80
|
-
Gem::PackageTask.new(spec) do |pkg|
|
81
|
-
pkg.need_tar = true
|
82
|
-
pkg.package_files += PKG_FILES
|
35
|
+
install('bin/coretemp', bindir, :verbose => true, :mode => 0755)
|
83
36
|
end
|
84
37
|
end
|
85
|
-
|
86
|
-
|
87
|
-
Rake::TestTask.new do |t|
|
88
|
-
t.test_files = FileList['tests/**/*_test.rb']
|
89
|
-
t.verbose = true
|
90
|
-
end
|
91
|
-
|
92
|
-
if defined? Rcov
|
93
|
-
Rcov::RcovTask.new do |t|
|
94
|
-
t.test_files = FileList['tests/**/*_test.rb']
|
95
|
-
t.verbose = true
|
96
|
-
t.rcov_opts = %w[-x '\\btests\/' -x '\\bgems\/']
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
desc m = "Writing version information for #{PKG_VERSION}"
|
101
|
-
task :version do
|
102
|
-
puts m
|
103
|
-
File.open(File.join('lib', 'cpu', 'version.rb'), 'w') do |v|
|
104
|
-
v.puts <<EOT
|
105
|
-
module CPU
|
106
|
-
# CPU version
|
107
|
-
VERSION = '#{PKG_VERSION}'
|
108
|
-
VERSION_ARRAY = VERSION.split(/\\./).map { |x| x.to_i } # :nodoc:
|
109
|
-
VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
|
110
|
-
VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
|
111
|
-
VERSION_BUILD = VERSION_ARRAY[2] # :nodoc:
|
112
|
-
end
|
113
|
-
EOT
|
114
|
-
end
|
115
|
-
end
|
116
|
-
|
117
|
-
desc "Run the tests by default"
|
118
|
-
task :default => [ :version, :test ]
|
119
|
-
|
120
|
-
desc "Prepare release of the library"
|
121
|
-
task :release => [ :clean, :gemspec, :package ]
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.3
|
data/bin/coretemp
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
require 'cpu'
|
4
4
|
require 'spruz/go'
|
5
5
|
include Spruz::GO
|
6
|
-
require '
|
6
|
+
require 'more_math'
|
7
7
|
|
8
8
|
class ParseCommands
|
9
9
|
def self.parse(argv)
|
@@ -65,7 +65,7 @@ class ParseCommands
|
|
65
65
|
}
|
66
66
|
measurements_last = history.last[1..-1]
|
67
67
|
times, *measurements = history.transpose
|
68
|
-
analyses = measurements.map { |m|
|
68
|
+
analyses = measurements.map { |m| MoreMath::Sequence.new(m) }
|
69
69
|
puts " min: %s" % (analyses.map { |a| a.min } * ' ')
|
70
70
|
puts "last: %s" % (measurements_last * ' ')
|
71
71
|
puts " max: %s" % (analyses.map { |a| a.max } * ' ')
|
data/cpu.gemspec
CHANGED
@@ -1,33 +1,39 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
|
-
s.name =
|
5
|
-
s.version = "0.0.
|
4
|
+
s.name = "cpu"
|
5
|
+
s.version = "0.0.3"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
|
-
s.authors = [
|
9
|
-
s.date =
|
10
|
-
s.description =
|
11
|
-
s.email =
|
12
|
-
s.executables = [
|
13
|
-
s.extra_rdoc_files = [
|
14
|
-
s.files = [
|
15
|
-
s.homepage =
|
16
|
-
s.rdoc_options = [
|
17
|
-
s.require_paths = [
|
18
|
-
s.
|
19
|
-
s.
|
20
|
-
s.
|
8
|
+
s.authors = ["Florian Frank"]
|
9
|
+
s.date = "2011-09-02"
|
10
|
+
s.description = "Library to gather CPU information (load averages, usage, temperature) in Ruby on Linux"
|
11
|
+
s.email = "flori@ping.de"
|
12
|
+
s.executables = ["coretemp"]
|
13
|
+
s.extra_rdoc_files = ["README.rdoc", "lib/cpu.rb", "lib/cpu/version.rb", "lib/cpu/usage.rb", "lib/cpu/processor.rb", "lib/cpu/load.rb", "lib/cpu/msr.rb", "lib/cpu/usage_sampler.rb", "lib/cpu/shared.rb"]
|
14
|
+
s.files = [".gitignore", "CHANGES", "COPYING", "Gemfile", "README.rdoc", "Rakefile", "VERSION", "bin/coretemp", "cpu.gemspec", "lib/cpu.rb", "lib/cpu/load.rb", "lib/cpu/msr.rb", "lib/cpu/processor.rb", "lib/cpu/shared.rb", "lib/cpu/usage.rb", "lib/cpu/usage_sampler.rb", "lib/cpu/version.rb", "munin/coretemp", "tests/load_test.rb", "tests/msr_test.rb", "tests/usage_test.rb"]
|
15
|
+
s.homepage = "http://flori.github.com/cpu"
|
16
|
+
s.rdoc_options = ["--title", "Cpu - CPU information in Ruby/Linux", "--main", "README.rdoc"]
|
17
|
+
s.require_paths = ["lib"]
|
18
|
+
s.rubygems_version = "1.8.10"
|
19
|
+
s.summary = "CPU information in Ruby/Linux"
|
20
|
+
s.test_files = ["tests/msr_test.rb", "tests/load_test.rb", "tests/usage_test.rb"]
|
21
21
|
|
22
22
|
if s.respond_to? :specification_version then
|
23
23
|
s.specification_version = 3
|
24
24
|
|
25
25
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
26
|
+
s.add_development_dependency(%q<gem_hadar>, ["~> 0.0.12"])
|
26
27
|
s.add_runtime_dependency(%q<spruz>, ["~> 0.2.2"])
|
28
|
+
s.add_runtime_dependency(%q<more_math>, ["~> 0.0"])
|
27
29
|
else
|
30
|
+
s.add_dependency(%q<gem_hadar>, ["~> 0.0.12"])
|
28
31
|
s.add_dependency(%q<spruz>, ["~> 0.2.2"])
|
32
|
+
s.add_dependency(%q<more_math>, ["~> 0.0"])
|
29
33
|
end
|
30
34
|
else
|
35
|
+
s.add_dependency(%q<gem_hadar>, ["~> 0.0.12"])
|
31
36
|
s.add_dependency(%q<spruz>, ["~> 0.2.2"])
|
37
|
+
s.add_dependency(%q<more_math>, ["~> 0.0"])
|
32
38
|
end
|
33
39
|
end
|
data/lib/cpu/version.rb
CHANGED
data/tests/usage_test.rb
CHANGED
metadata
CHANGED
@@ -1,47 +1,67 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: cpu
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
- 2
|
10
|
-
version: 0.0.2
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Florian Frank
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
12
|
+
date: 2011-09-02 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: gem_hadar
|
16
|
+
requirement: &2157565060 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 0.0.12
|
22
|
+
type: :development
|
22
23
|
prerelease: false
|
23
|
-
|
24
|
+
version_requirements: *2157565060
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: spruz
|
27
|
+
requirement: &2157564560 !ruby/object:Gem::Requirement
|
24
28
|
none: false
|
25
|
-
requirements:
|
29
|
+
requirements:
|
26
30
|
- - ~>
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
hash: 19
|
29
|
-
segments:
|
30
|
-
- 0
|
31
|
-
- 2
|
32
|
-
- 2
|
31
|
+
- !ruby/object:Gem::Version
|
33
32
|
version: 0.2.2
|
34
33
|
type: :runtime
|
35
|
-
|
36
|
-
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *2157564560
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: more_math
|
38
|
+
requirement: &2157564100 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ~>
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0.0'
|
44
|
+
type: :runtime
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *2157564100
|
47
|
+
description: Library to gather CPU information (load averages, usage, temperature)
|
48
|
+
in Ruby on Linux
|
37
49
|
email: flori@ping.de
|
38
|
-
executables:
|
50
|
+
executables:
|
39
51
|
- coretemp
|
40
52
|
extensions: []
|
41
|
-
|
42
|
-
extra_rdoc_files:
|
53
|
+
extra_rdoc_files:
|
43
54
|
- README.rdoc
|
44
|
-
|
55
|
+
- lib/cpu.rb
|
56
|
+
- lib/cpu/version.rb
|
57
|
+
- lib/cpu/usage.rb
|
58
|
+
- lib/cpu/processor.rb
|
59
|
+
- lib/cpu/load.rb
|
60
|
+
- lib/cpu/msr.rb
|
61
|
+
- lib/cpu/usage_sampler.rb
|
62
|
+
- lib/cpu/shared.rb
|
63
|
+
files:
|
64
|
+
- .gitignore
|
45
65
|
- CHANGES
|
46
66
|
- COPYING
|
47
67
|
- Gemfile
|
@@ -64,39 +84,33 @@ files:
|
|
64
84
|
- tests/usage_test.rb
|
65
85
|
homepage: http://flori.github.com/cpu
|
66
86
|
licenses: []
|
67
|
-
|
68
87
|
post_install_message:
|
69
|
-
rdoc_options:
|
88
|
+
rdoc_options:
|
89
|
+
- --title
|
90
|
+
- Cpu - CPU information in Ruby/Linux
|
70
91
|
- --main
|
71
92
|
- README.rdoc
|
72
|
-
|
73
|
-
- CPU
|
74
|
-
require_paths:
|
93
|
+
require_paths:
|
75
94
|
- lib
|
76
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
95
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
77
96
|
none: false
|
78
|
-
requirements:
|
79
|
-
- -
|
80
|
-
- !ruby/object:Gem::Version
|
81
|
-
|
82
|
-
|
83
|
-
- 0
|
84
|
-
version: "0"
|
85
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
97
|
+
requirements:
|
98
|
+
- - ! '>='
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: '0'
|
101
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
86
102
|
none: false
|
87
|
-
requirements:
|
88
|
-
- -
|
89
|
-
- !ruby/object:Gem::Version
|
90
|
-
|
91
|
-
segments:
|
92
|
-
- 0
|
93
|
-
version: "0"
|
103
|
+
requirements:
|
104
|
+
- - ! '>='
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: '0'
|
94
107
|
requirements: []
|
95
|
-
|
96
|
-
|
97
|
-
rubygems_version: 1.8.5
|
108
|
+
rubyforge_project:
|
109
|
+
rubygems_version: 1.8.10
|
98
110
|
signing_key:
|
99
111
|
specification_version: 3
|
100
112
|
summary: CPU information in Ruby/Linux
|
101
|
-
test_files:
|
102
|
-
|
113
|
+
test_files:
|
114
|
+
- tests/msr_test.rb
|
115
|
+
- tests/load_test.rb
|
116
|
+
- tests/usage_test.rb
|