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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 251852bdbd5bb3008b5ff05760e77f5db14bd1f9
4
- data.tar.gz: 0b49cf671e0c61e3ed018f78c758dcb8b60873b6
3
+ metadata.gz: 0ea89cc1dd3b493e9ebff0f7ec36789ae9048f5f
4
+ data.tar.gz: 118f0c9db4439b7ee1939d6beafed8482d837f16
5
5
  SHA512:
6
- metadata.gz: 4d47bedaeb1445a66f9a52ba2a3b0e83ee63da24ed10d55b1de53256ea3ed13102b7bc9bc0b22e11db5511179b8de76dcae9a87287e76798e4b06a126f5aadc9
7
- data.tar.gz: 08b45cf0d855f46b90246d79d0a87365494c471766124c15503b8bb67238ac20bf5ce3ef8d61ad3312c9230e95a6dc49799cabac4b3cb581dea534d3c89add92
6
+ metadata.gz: f42eed1d575870fadbe516c79e2b508e84e60bd61a72c057d733c31c3d86b72c7d71c205e7d04ed872410bf8f3bd12e6e1db9460ff72ea62ffbdab5e5d7e7c8b
7
+ data.tar.gz: d5fd78e32161e65566f66e662cc9a1865446f01f9b5bea7c14a12581ddbb36ccdf022e92f9625a54f9f50ebdbc9a832171633c4d3a8c528ff9af4a1cb2f0c834
data/bin/gk_cpu_meter CHANGED
@@ -30,6 +30,6 @@ GeektoolKit::CpuRecord.get_records.sort.each do |record|
30
30
 
31
31
  break if counter == 5 || total == max_lines
32
32
 
33
- puts record.create_display_text
33
+ record.print
34
34
  total += 1
35
35
  end
@@ -37,7 +37,7 @@ module GeektoolKit
37
37
  end
38
38
 
39
39
  def print
40
- puts "#{color}#{create_display_text}#{Colors.RESET}"
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 name, create_percent_display_text, max_width
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
@@ -1,3 +1,3 @@
1
1
  module GeektoolKit
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: geektool_kit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rob Kitson