Last active
December 14, 2015 02:59
-
-
Save jamesdabbs/5017797 to your computer and use it in GitHub Desktop.
Never again forget to bundle and migrate after merging in changes
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 | |
# Notifies you when certain files are changed which necessitate further action on your part. | |
# | |
# To enable: | |
# - copy this file to .git/hooks/post-merge | |
# - chmod +x .git/hooks/post-merge | |
commits = `git reflog -n 2`.lines.map { |l| l.split.first } | |
changed = `git diff --name-only #{commits.first} #{commits.last}`.lines.map &:strip | |
actions = { | |
'Gemfile' => 'bundle', | |
'db/schema.rb' => 'rake db:migrate' | |
}.select { |file, action| changed.include?(file) } | |
unless actions.empty? | |
puts "\n\e[33mThis merge altered your environment. You should probably" | |
actions.each do |file, action| | |
puts "\e[0m* \e[1;33m#{action}" | |
end | |
puts "\e[0;33mBe sure to restart resque if needed\e[0m " | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment