Skip to content

Instantly share code, notes, and snippets.

@yoshuki
Created July 12, 2011 18:39
Show Gist options
  • Save yoshuki/1078641 to your computer and use it in GitHub Desktop.
Save yoshuki/1078641 to your computer and use it in GitHub Desktop.
Works with SW Notifier(http://saikyoline.jp/air/swn/).
require 'socket'
require 'autotest/tmux'
Autotest.add_hook :ran_command do |at, *args|
next false unless Autotest::Tmux.execute?
output = at.results.join
result = Autotest::Tmux.parse_output(output, at.class.name)
TCPSocket.open('localhost', 12345) do |s|
prefix = case result[:color]
when :red; 'R:'
when :yellow; 'Y:'
when :green; 'G:'
else ''
end
s.write "#{prefix}#{output}"
end
next false
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment