tdd_heart 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/tdd_heart.rb +15 -16
- 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: 642280bb80419a36262ec63273930a1dd094acf9
|
4
|
+
data.tar.gz: 74ab19d90eb3be1998b98e95dd519c967aa78ccf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1afbbcdb5208f24d371c8ed05056f926c92749f44185878f2355c8f055b6bd215dca8a36a30ebe9aa57e72ac14c8c1f2a5838fcfc8db89382e0c33790e51e043
|
7
|
+
data.tar.gz: e94c2ae72e7928cbfcbdedbb650669e023c33352065422fc7468c67319599d64b15caf59e90a4b1ec271c5c42ba11c31d2e890ceb734f5240680ff1b68ebefdd
|
data/lib/tdd_heart.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
class HeartInspector
|
2
2
|
DEFAULTS = {
|
3
|
-
tmux_location: ENV['HOME'] +
|
4
|
-
target_setting:
|
5
|
-
result_file:
|
3
|
+
tmux_location: ENV['HOME'] + '/.tmux.conf',
|
4
|
+
target_setting: 'set -g status-right',
|
5
|
+
result_file: '/.guard_result'
|
6
6
|
}
|
7
7
|
|
8
8
|
attr_reader :result, :existing_settings
|
@@ -25,25 +25,28 @@ class HeartInspector
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def refresh_status
|
28
|
-
|
28
|
+
read_test_status
|
29
29
|
system(update_status_command)
|
30
30
|
end
|
31
31
|
|
32
|
+
def read_test_status(file_path = nil)
|
33
|
+
file_path ||= Dir.pwd + DEFAULTS[:result_file]
|
34
|
+
return unless File.exist? file_path
|
35
|
+
|
36
|
+
@result = File.read(file_path).chomp
|
37
|
+
end
|
38
|
+
|
32
39
|
def update_status_command
|
33
40
|
"tmux set -g status-right '#{new_status}'"
|
34
41
|
end
|
35
42
|
|
36
|
-
|
37
43
|
def new_status
|
38
|
-
|
44
|
+
return existing_settings if result.nil?
|
45
|
+
output(result_color) + ' ' + existing_settings
|
39
46
|
end
|
40
47
|
|
41
|
-
def
|
42
|
-
|
43
|
-
return unless File.exists? file_path
|
44
|
-
|
45
|
-
|
46
|
-
@result = File.read(file_path).chomp
|
48
|
+
def result_color
|
49
|
+
success? ? 'green' : 'red'
|
47
50
|
end
|
48
51
|
|
49
52
|
def success?
|
@@ -52,10 +55,6 @@ class HeartInspector
|
|
52
55
|
!!(/success/ =~ result)
|
53
56
|
end
|
54
57
|
|
55
|
-
def result_color
|
56
|
-
success? ? "green" : "red"
|
57
|
-
end
|
58
|
-
|
59
58
|
def output(color)
|
60
59
|
"#[fg=#{color}]♥"
|
61
60
|
end
|