Skip to content

Instantly share code, notes, and snippets.

@tannermares
Forked from jonasschmidt/pre-commit
Last active August 6, 2018 18:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tannermares/6224008 to your computer and use it in GitHub Desktop.
Save tannermares/6224008 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
if `git diff --cached spec` =~ /,\s?(:focus|focus:\s?true|:focus\s?=>\s?true)/
puts "\e[31mPlease focus and remove your :focus tags before committing!\e[0m"
exit 1
end
if `git diff --cached app/assets/javascripts` =~ /\+\s*console.log/
puts "\e[31mPlease remove your console.logs before committing!\e[0m"
exit 1
end
if `git diff --cached config/initializers` =~ /\+\s*if true/
puts "\e[31mPlease don't inline resque in production, I know you did.\e[0m"
exit 1
end
if !(`git diff --cached | grep Gemfile`).empty? && (`git diff --cached | grep Gemfile.next`).empty?
puts "*" * 80
puts "\e[31mLooks like you updated your Gemfile, update Gemfile.next if needed!\e[0m"
puts "\e[31mBUNDLE_GEMFILE=Gemfile.next bundle install\e[0m"
puts "*" * 80
exit 0
end
@dobrite
Copy link

dobrite commented May 7, 2015

woot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment