cpu 0.0.2 → 0.0.3

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.
@@ -0,0 +1,3 @@
1
+ .*.sw[pon]
2
+ Gemfile.lock
3
+ pkg
data/Gemfile CHANGED
@@ -3,11 +3,3 @@
3
3
  source :rubygems
4
4
 
5
5
  gemspec
6
-
7
- group :development do
8
- gem 'rake', '~>0.9.2'
9
- gem 'sdoc', '~>0.2.20'
10
- gem 'rcov', '~>0.9.9'
11
- gem 'test-unit', '~>2.3.0'
12
- gem 'mocha', '~>0.9.12'
13
- end
data/Rakefile CHANGED
@@ -1,121 +1,37 @@
1
1
  # vim: set filetype=ruby et sw=2 ts=2:
2
2
 
3
- begin
4
- require 'rubygems/package_task'
5
- rescue LoadError
6
- end
7
- begin
8
- require 'rcov/rcovtask'
9
- rescue LoadError
10
- end
11
- require 'rake/clean'
12
- require 'rake/testtask'
13
- require 'rbconfig'
14
- include Config
15
-
16
- PKG_NAME = 'cpu'
17
- PKG_VERSION = File.read('VERSION').chomp
18
- PKG_FILES = FileList[*`git ls-files`.split(/\n/)].exclude '.gitignore'
19
- CLEAN.include 'coverage', 'doc'
20
- CLOBBER.include 'pkg'
21
-
22
- desc "Install executable/library into site_ruby directories"
23
- task :install do
24
- bindir = CONFIG['bindir']
25
- libdir = CONFIG['sitelibdir']
26
- cd 'lib' do
27
- for file in Dir['**/*.rb']
28
- dest = File.join(libdir, file)
29
- mkdir_p File.dirname(dest)
30
- install file, dest, :verbose => true
31
- end
32
- end
33
- install('bin/coretemp', bindir, :verbose => true, :mode => 0755)
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
- end
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.2
1
+ 0.0.3
@@ -3,7 +3,7 @@
3
3
  require 'cpu'
4
4
  require 'spruz/go'
5
5
  include Spruz::GO
6
- require 'bullshit'
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| Bullshit::Analysis.new(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 } * ' ')
@@ -1,33 +1,39 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
 
3
3
  Gem::Specification.new do |s|
4
- s.name = %q{cpu}
5
- s.version = "0.0.2"
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 = [%q{Florian Frank}]
9
- s.date = %q{2011-07-04}
10
- s.description = %q{Library to gather CPU information (load averages, usage, temperature) in Ruby on Linux}
11
- s.email = %q{flori@ping.de}
12
- s.executables = [%q{coretemp}]
13
- s.extra_rdoc_files = [%q{README.rdoc}]
14
- s.files = [%q{CHANGES}, %q{COPYING}, %q{Gemfile}, %q{README.rdoc}, %q{Rakefile}, %q{VERSION}, %q{bin/coretemp}, %q{cpu.gemspec}, %q{lib/cpu.rb}, %q{lib/cpu/load.rb}, %q{lib/cpu/msr.rb}, %q{lib/cpu/processor.rb}, %q{lib/cpu/shared.rb}, %q{lib/cpu/usage.rb}, %q{lib/cpu/usage_sampler.rb}, %q{lib/cpu/version.rb}, %q{munin/coretemp}, %q{tests/load_test.rb}, %q{tests/msr_test.rb}, %q{tests/usage_test.rb}]
15
- s.homepage = %q{http://flori.github.com/cpu}
16
- s.rdoc_options = [%q{--main}, %q{README.rdoc}, %q{--title}, %q{CPU}]
17
- s.require_paths = [%q{lib}]
18
- s.rubyforge_project = %q{cpu}
19
- s.rubygems_version = %q{1.8.5}
20
- s.summary = %q{CPU information in Ruby/Linux}
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
@@ -1,6 +1,6 @@
1
1
  module CPU
2
2
  # CPU version
3
- VERSION = '0.0.2'
3
+ VERSION = '0.0.3'
4
4
  VERSION_ARRAY = VERSION.split(/\./).map { |x| x.to_i } # :nodoc:
5
5
  VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
6
6
  VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
@@ -5,7 +5,7 @@ require 'cpu'
5
5
  module CPU
6
6
  class UsageTest < Test::Unit::TestCase
7
7
  def test_sum_usage
8
- @processor = CPU.sum_usage 0.1
8
+ @processor = CPU.sum_usage_processor 1
9
9
  assert_kind_of Processor, @processor
10
10
  assert_operator @processor.usage.percentage, :>, 0
11
11
  end
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
- hash: 27
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
- date: 2011-07-04 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
21
- name: spruz
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
- requirement: &id001 !ruby/object:Gem::Requirement
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
- version_requirements: *id001
36
- description: Library to gather CPU information (load averages, usage, temperature) in Ruby on Linux
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
- files:
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
- - --title
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
- hash: 3
82
- segments:
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
- hash: 3
91
- segments:
92
- - 0
93
- version: "0"
103
+ requirements:
104
+ - - ! '>='
105
+ - !ruby/object:Gem::Version
106
+ version: '0'
94
107
  requirements: []
95
-
96
- rubyforge_project: cpu
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