Created
March 10, 2010 20:08
-
-
Save cmaggard/328293 to your computer and use it in GitHub Desktop.
This file contains 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 | |
require 'set' | |
cmd = "git diff --cached --name-only" | |
matches = { /\.sass/ => /\.css/, /\.haml/ => /\.html/ } | |
files = IO.popen(cmd).readlines.map(&:chomp) | |
fail = false | |
matches.each_key do |key| | |
$; = '.' | |
changed_src = files.grep(key).map(&:split).map(&:shift).to_set | |
changed_dest = files.grep(matches[key]).map(&:split).map(&:shift).to_set | |
diff = changed_src - changed_dest | |
if diff.size > 0 then | |
puts "DEGENERACY!" | |
diff.each { |d| puts d } | |
fail = true | |
end | |
end | |
exit (fail ? 1 : 0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment