tdd_heart 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/bin/tdd_heart +7 -0
- data/lib/tdd_heart.rb +62 -0
- metadata +47 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 185e88e2e9dfea27ad1ffc5c81d3a4d71d0e288e
|
4
|
+
data.tar.gz: 41f3cb427d4e6580bbb3b27ee77a8bd69e15d037
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d52438d9c7024f213d7e0a06e7450add91c8b7a7f067ed9ff7596d3e9c6a3b7f2ffc1326413ef31b58762aa1c51ba43aa9a0d9762328fe454b1bc2f436176fd2
|
7
|
+
data.tar.gz: 8c32b674cb6f67316786ad7f64365264dd5fdae5cfd515db0a7545ac0a7e8375e3411fca6aea1ac78d281a62c2322fbbe480ca2e91bae63a8dda5d245f6b976c
|
data/bin/tdd_heart
ADDED
data/lib/tdd_heart.rb
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
class HeartInspector
|
2
|
+
DEFAULTS = {
|
3
|
+
tmux_location: ENV['HOME'] + "/.tmux.conf",
|
4
|
+
target_setting: "set -g status-right",
|
5
|
+
result_file: "/.guard_result"
|
6
|
+
}
|
7
|
+
|
8
|
+
attr_reader :result, :existing_settings
|
9
|
+
|
10
|
+
def initialize
|
11
|
+
@existing_settings = load_existing_settings
|
12
|
+
end
|
13
|
+
|
14
|
+
def load_existing_settings(setting: nil, file_path: nil)
|
15
|
+
setting ||= DEFAULTS[:target_setting]
|
16
|
+
file_path ||= DEFAULTS[:tmux_location]
|
17
|
+
|
18
|
+
file = File.open file_path
|
19
|
+
|
20
|
+
config = nil
|
21
|
+
file.each { |line| config = line if /#{setting}/ =~ line }
|
22
|
+
file.close
|
23
|
+
|
24
|
+
config.chomp.split('"').last
|
25
|
+
end
|
26
|
+
|
27
|
+
def refresh_status
|
28
|
+
return unless read_test_status
|
29
|
+
system(update_status_command)
|
30
|
+
end
|
31
|
+
|
32
|
+
def update_status_command
|
33
|
+
"tmux set -g status-right '#{new_status}'"
|
34
|
+
end
|
35
|
+
|
36
|
+
|
37
|
+
def new_status
|
38
|
+
output(result_color) + " " + existing_settings
|
39
|
+
end
|
40
|
+
|
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
|
47
|
+
end
|
48
|
+
|
49
|
+
def success?
|
50
|
+
return unless result
|
51
|
+
|
52
|
+
!!(/success/ =~ result)
|
53
|
+
end
|
54
|
+
|
55
|
+
def result_color
|
56
|
+
success? ? "green" : "red"
|
57
|
+
end
|
58
|
+
|
59
|
+
def output(color)
|
60
|
+
"#[fg=#{color}]♥"
|
61
|
+
end
|
62
|
+
end
|
metadata
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: tdd_heart
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- John Mason
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-11-06 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: A simple executable that adds a green or red heart to tmux status bar
|
14
|
+
depending on passing/failing tests.
|
15
|
+
email:
|
16
|
+
executables:
|
17
|
+
- tdd_heart
|
18
|
+
extensions: []
|
19
|
+
extra_rdoc_files: []
|
20
|
+
files:
|
21
|
+
- bin/tdd_heart
|
22
|
+
- lib/tdd_heart.rb
|
23
|
+
homepage: https://github.com/binarymason/tdd_heart
|
24
|
+
licenses:
|
25
|
+
- MIT
|
26
|
+
metadata: {}
|
27
|
+
post_install_message:
|
28
|
+
rdoc_options: []
|
29
|
+
require_paths:
|
30
|
+
- lib
|
31
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
32
|
+
requirements:
|
33
|
+
- - ">="
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: '0'
|
36
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
requirements: []
|
42
|
+
rubyforge_project:
|
43
|
+
rubygems_version: 2.5.1
|
44
|
+
signing_key:
|
45
|
+
specification_version: 4
|
46
|
+
summary: "♥ passing tests"
|
47
|
+
test_files: []
|