geektool_kit 0.2.0 → 0.2.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.
- checksums.yaml +4 -4
- data/bin/gk_cpu_meter +1 -1
- data/lib/geektool_kit/cpu_record.rb +6 -2
- data/lib/geektool_kit/version.rb +1 -1
- data/spec/cpu_record_spec.rb +14 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0ea89cc1dd3b493e9ebff0f7ec36789ae9048f5f
|
4
|
+
data.tar.gz: 118f0c9db4439b7ee1939d6beafed8482d837f16
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f42eed1d575870fadbe516c79e2b508e84e60bd61a72c057d733c31c3d86b72c7d71c205e7d04ed872410bf8f3bd12e6e1db9460ff72ea62ffbdab5e5d7e7c8b
|
7
|
+
data.tar.gz: d5fd78e32161e65566f66e662cc9a1865446f01f9b5bea7c14a12581ddbb36ccdf022e92f9625a54f9f50ebdbc9a832171633c4d3a8c528ff9af4a1cb2f0c834
|
data/bin/gk_cpu_meter
CHANGED
@@ -37,7 +37,7 @@ module GeektoolKit
|
|
37
37
|
end
|
38
38
|
|
39
39
|
def print
|
40
|
-
puts
|
40
|
+
puts colorize_line(create_display_text)
|
41
41
|
end
|
42
42
|
|
43
43
|
def <=> other
|
@@ -49,7 +49,11 @@ module GeektoolKit
|
|
49
49
|
end
|
50
50
|
|
51
51
|
def create_display_text max_width = 30
|
52
|
-
create_line
|
52
|
+
create_line(name, create_percent_display_text, max_width)
|
53
|
+
end
|
54
|
+
|
55
|
+
def colorize_line line
|
56
|
+
"#{color}#{line}#{Colors.RESET}"
|
53
57
|
end
|
54
58
|
|
55
59
|
def self.get_data
|
data/lib/geektool_kit/version.rb
CHANGED
data/spec/cpu_record_spec.rb
CHANGED
@@ -64,4 +64,18 @@ describe GeektoolKit::CpuRecord do
|
|
64
64
|
expect(@big_record.create_display_text).to eq "big process 78.2%"
|
65
65
|
end
|
66
66
|
end
|
67
|
+
|
68
|
+
describe "colorize_line" do
|
69
|
+
it "should reset the color at the end of the line" do
|
70
|
+
expect(@big_record.colorize_line("asdf")).to end_with Colors.RESET
|
71
|
+
end
|
72
|
+
|
73
|
+
it "should set the color to RED if the record is critical" do
|
74
|
+
expect(@big_record.colorize_line("asdf")).to start_with Colors.RED
|
75
|
+
end
|
76
|
+
|
77
|
+
it "should set the color to DEFAULT if the record is in the normal range" do
|
78
|
+
expect(@small_record.colorize_line("asdf")).to start_with Colors.DEFAULT
|
79
|
+
end
|
80
|
+
end
|
67
81
|
end
|