Last active
December 30, 2015 18:49
-
-
Save demental/7869683 to your computer and use it in GitHub Desktop.
Pre push hook to avoid focused: true pushed in repo
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/env ruby | |
# vim: set syntax=ruby | |
flag = false | |
Dir.glob("spec/**/*_spec.rb") do |file| | |
results = `cat #{file} | grep -E "(\:focused => true)|(focused\: true)"`.split("\n").map { |r| r.sub(/^\+[\s\t]*/, '') } | |
if $? == 0 | |
puts file | |
puts results.map { |r| | |
`grep -n "#{r}" #{file}` | |
}.join("") | |
puts "Please remove :focused => true from your tests before pushing" | |
flag = true | |
end | |
end | |
exit 1 if flag |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment