Class: Autotest::Tmux
- Inherits:
-
Object
- Object
- Autotest::Tmux
- Defined in:
- lib/autotest/tmux.rb
Overview
Autotest::Tmux shows autotest/autospec progress on tmux status-right.
Features
-
Screenshots aren’t available yet. (but, almost same as autotest_screen.)
Synopsis
$HOME/.autotest
require 'autotest/tmux'
# Autotest::Tmux.statusright = '"#22T" %H:%M %d-%b-%y (your statusright)'
-
To prevent server information (like “set option: status-right -> …”), you should start tmux server with -q option first.
Constant Summary collapse
- DEFAULT_STATUSRIGHT =
'"#22T" %H:%M %d-%b-%y'
- DEFAULT_TMUX_CMD =
'tmux'
- SCREEN_COLOR =
{ :black => ['white', 'black'], :green => ['white', 'green'], :yellow => ['black', 'yellow'], :red => ['white', 'red'] }
Class Method Summary collapse
- .clear ⇒ Object
- .execute? ⇒ Boolean
- .message(msg = statusright, color = :black) ⇒ Object
- .run_tmux_session? ⇒ Boolean
- .send_cmd(msg) ⇒ Object
- .statusright ⇒ Object
- .statusright=(s) ⇒ Object
- .tmux_cmd ⇒ Object
- .tmux_cmd=(tc) ⇒ Object
Class Method Details
.clear ⇒ Object
35 36 37 |
# File 'lib/autotest/tmux.rb', line 35 def self.clear send_cmd('') end |
.execute? ⇒ Boolean
44 45 46 |
# File 'lib/autotest/tmux.rb', line 44 def self.execute? !($TESTING || !run_tmux_session?) end |
.message(msg = statusright, color = :black) ⇒ Object
29 30 31 32 33 |
# File 'lib/autotest/tmux.rb', line 29 def self.(msg=statusright, color=:black) col = SCREEN_COLOR[color] msg = "#[fg=#{col[0]},bg=#{col[1]}] #{msg} #[default]" unless msg == statusright send_cmd(msg) end |
.run_tmux_session? ⇒ Boolean
39 40 41 42 |
# File 'lib/autotest/tmux.rb', line 39 def self.run_tmux_session? cmd = "#{tmux_cmd} has-session" system cmd end |
.send_cmd(msg) ⇒ Object
54 55 56 57 58 |
# File 'lib/autotest/tmux.rb', line 54 def self.send_cmd(msg) cmd = "#{tmux_cmd} set status-right '#{msg.gsub("'", "\'")}'" system cmd nil end |
.statusright ⇒ Object
49 |
# File 'lib/autotest/tmux.rb', line 49 def self.statusright; @statusright || DEFAULT_STATUSRIGHT.dup; end |
.statusright=(s) ⇒ Object
50 |
# File 'lib/autotest/tmux.rb', line 50 def self.statusright=(s); @statusright = s; end |
.tmux_cmd ⇒ Object
51 |
# File 'lib/autotest/tmux.rb', line 51 def self.tmux_cmd; @tmux_cmd || DEFAULT_TMUX_CMD.dup; end |
.tmux_cmd=(tc) ⇒ Object
52 |
# File 'lib/autotest/tmux.rb', line 52 def self.tmux_cmd=(tc); @tmux_cmd = tc; end |