tplot 0.0.1
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/.gitignore +18 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +31 -0
- data/Rakefile +2 -0
- data/bin/tplot +37 -0
- data/lib/tplot.rb +5 -0
- data/lib/tplot/bar_chart.rb +138 -0
- data/lib/tplot/chart.rb +117 -0
- data/lib/tplot/line_chart.rb +128 -0
- data/lib/tplot/plugin.rb +21 -0
- data/lib/tplot/version.rb +3 -0
- data/log/debug.log +536758 -0
- data/plugins/free.rb +15 -0
- data/plugins/list.rb +14 -0
- data/plugins/uptime.rb +15 -0
- data/tplot.gemspec +17 -0
- metadata +64 -0
data/plugins/free.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
class Tplot::Free < Tplot::Plugin
|
2
|
+
|
3
|
+
description "plot free commands result"
|
4
|
+
|
5
|
+
def execute
|
6
|
+
chart = Tplot::BarChart.new
|
7
|
+
chart.labels = %w(total used free shared buffers cached)
|
8
|
+
|
9
|
+
while true
|
10
|
+
uptime = `free | grep Mem`.gsub(/^Mem:/, "").split(" ").map{|v| v.strip.to_f}
|
11
|
+
chart.add(uptime[0..1])
|
12
|
+
sleep 1
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/plugins/list.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
class Tplot::List < Tplot::Plugin
|
2
|
+
|
3
|
+
description "list installed plugins."
|
4
|
+
|
5
|
+
def execute
|
6
|
+
puts "-- installed plugins --"
|
7
|
+
Dir.glob("#{BASE_DIR}/plugins/*.rb").each do |plugin|
|
8
|
+
require plugin
|
9
|
+
name = plugin.gsub("#{BASE_DIR}/plugins/", '').gsub(".rb", '')
|
10
|
+
plugin_class = Tplot.const_get(name.capitalize)
|
11
|
+
puts "tplot #{name}\t: #{plugin_class.description}"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
data/plugins/uptime.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
class Tplot::Uptime < Tplot::Plugin
|
2
|
+
|
3
|
+
description "plot uptime commands result"
|
4
|
+
|
5
|
+
def execute
|
6
|
+
chart = Tplot::BarChart.new
|
7
|
+
chart.labels = %w(1min 5min 15min)
|
8
|
+
|
9
|
+
while true
|
10
|
+
uptime = `uptime`.gsub(/^.*load average: /, "").split(",").map{|v| v.strip.to_f}
|
11
|
+
chart.add(uptime)
|
12
|
+
sleep 1
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/tplot.gemspec
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/tplot/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["Mitoma Ryo"]
|
6
|
+
gem.email = ["mutetheradio@gmail.com"]
|
7
|
+
gem.description = %q{Tplot is text base graph plot tool.}
|
8
|
+
gem.summary = %q{Tplot is text base graph plot tool.}
|
9
|
+
gem.homepage = "https://github.com/mitoma/tplot"
|
10
|
+
|
11
|
+
gem.files = `git ls-files`.split($\)
|
12
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
13
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
14
|
+
gem.name = "tplot"
|
15
|
+
gem.require_paths = ["lib"]
|
16
|
+
gem.version = Tplot::VERSION
|
17
|
+
end
|
metadata
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: tplot
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Mitoma Ryo
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-10-21 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description: Tplot is text base graph plot tool.
|
15
|
+
email:
|
16
|
+
- mutetheradio@gmail.com
|
17
|
+
executables:
|
18
|
+
- tplot
|
19
|
+
extensions: []
|
20
|
+
extra_rdoc_files: []
|
21
|
+
files:
|
22
|
+
- .gitignore
|
23
|
+
- Gemfile
|
24
|
+
- LICENSE
|
25
|
+
- README.md
|
26
|
+
- Rakefile
|
27
|
+
- bin/tplot
|
28
|
+
- lib/tplot.rb
|
29
|
+
- lib/tplot/bar_chart.rb
|
30
|
+
- lib/tplot/chart.rb
|
31
|
+
- lib/tplot/line_chart.rb
|
32
|
+
- lib/tplot/plugin.rb
|
33
|
+
- lib/tplot/version.rb
|
34
|
+
- log/debug.log
|
35
|
+
- plugins/free.rb
|
36
|
+
- plugins/list.rb
|
37
|
+
- plugins/uptime.rb
|
38
|
+
- tplot.gemspec
|
39
|
+
homepage: https://github.com/mitoma/tplot
|
40
|
+
licenses: []
|
41
|
+
post_install_message:
|
42
|
+
rdoc_options: []
|
43
|
+
require_paths:
|
44
|
+
- lib
|
45
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
46
|
+
none: false
|
47
|
+
requirements:
|
48
|
+
- - ! '>='
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: '0'
|
51
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
53
|
+
requirements:
|
54
|
+
- - ! '>='
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '0'
|
57
|
+
requirements: []
|
58
|
+
rubyforge_project:
|
59
|
+
rubygems_version: 1.8.24
|
60
|
+
signing_key:
|
61
|
+
specification_version: 3
|
62
|
+
summary: Tplot is text base graph plot tool.
|
63
|
+
test_files: []
|
64
|
+
has_rdoc:
|