Last active
September 28, 2015 02:10
-
-
Save puyo/98ddc7ea93e7a4b5657e to your computer and use it in GitHub Desktop.
rspec-blame-filter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
# Annotates RSpec output with contact details of the person who wrote the tests that are failing. | |
# | |
# Setup: | |
# | |
# gem install colorize | |
# | |
# Usage: | |
# | |
# rspec | scripts/rspec-blame-filter | |
# | |
# or: | |
# | |
# scripts/rspec-blame-filter | |
# | |
# and paste rspec output, ^D to quit. | |
# | |
gem 'colorize' | |
require 'colorize' | |
ARGF.each_line do |line| | |
if m = line.match(/rspec (.*?\.rb):(\d+)/) | |
path, num = m.captures | |
cmd = "git blame --date short -e -M -w -L #{num},#{num} -- #{path}" | |
out = `#{cmd}` | |
print line.strip | |
print ' ' | |
print out.strip.white.on_red | |
puts | |
else | |
print line | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This code is really nice.