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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/tdd_heart.rb +15 -16
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a0b5dd02f4b423177cef7ce155ed46230dd74f4e
4
- data.tar.gz: bef0b4d9da9c8ea2153525370efe30877061b139
3
+ metadata.gz: 642280bb80419a36262ec63273930a1dd094acf9
4
+ data.tar.gz: 74ab19d90eb3be1998b98e95dd519c967aa78ccf
5
5
  SHA512:
6
- metadata.gz: b5f1b63274502ed6e26e6d9925debeef08a4780cb81e22ca04810a564970c1c3ccae279c032625f21c449a585e99090d35a1df968868d964cc854b9e097115bc
7
- data.tar.gz: f711f3b564f32ceeb58552f0f324fdd4f42d935ae35153ccfb48486bdb9ff14bb37eef0aa23fd825046c63f232c4d03e5359633f1549aedcf92426a66d78f580
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'] + "/.tmux.conf",
4
- target_setting: "set -g status-right",
5
- result_file: "/.guard_result"
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
- return unless read_test_status
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
- output(result_color) + " " + existing_settings
44
+ return existing_settings if result.nil?
45
+ output(result_color) + ' ' + existing_settings
39
46
  end
40
47
 
41
- def read_test_status(file_path = nil)
42
- file_path ||= Dir.pwd + DEFAULTS[:result_file]
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tdd_heart
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Mason