Skip to content

Instantly share code, notes, and snippets.

@lawrencejones
Created December 4, 2013 20:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lawrencejones/7794597 to your computer and use it in GitHub Desktop.
Save lawrencejones/7794597 to your computer and use it in GitHub Desktop.
Pre-commit Hook to prevent bad commits
#!/usr/bin/env ruby
crrtBranch = (/(?<=\*\s).*/.match `git branch`)
user = `echo $USER`.gsub "\n", ""
if not ['lawrencejones', 'alanvey'].include? user
if crrtBranch.to_s != 'F_CodeGen'
puts 'Wrong branch!'
exit 1
end
end
if not system 'make'
puts 'Compilation failed.'
exit 1
end
if not system 'coffee ./src/wacc.coffee'
puts 'Wacc module failed.'
exit 1
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment