Last active
December 16, 2015 16:09
-
-
Save troyxmccall/5460867 to your computer and use it in GitHub Desktop.
git hook for auto compiling compass after pull
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/perl | |
use strict; | |
use warnings; | |
my ($previous_head, $current_head, $is_branch_checkout) = @ARGV; | |
my ($is_on_facelift, $run_compass) = 0; | |
if ($is_branch_checkout) { | |
$is_on_facelift = `git branch | grep -e "^\*.*facelift"`; | |
chomp $is_on_facelift; | |
$run_compass = 1 if $is_on_facelift ne ''; | |
} else { | |
my $is_on_facelift = `git branch --contains $current_head | grep facelift | wc -l`; | |
chomp $is_on_facelift; | |
$run_compass = 1 if $is_on_facelift > 0; | |
} | |
#print "[$previous_head] [$current_head] [$is_branch_checkout] [$is_on_facelift]\n"; | |
exit if !$run_compass; | |
print "running compass...\n"; | |
system(qw(compass compile -c config.rb)) == 0 or die "compass compile failed: $?"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
in repo dir
wget -O .git/hooks/post-checkout "https://gist.github.com/troyxmccall/5460867/raw/22393d048f0a4a49cbb6cecec80913715ffdaa43/pull-hook" && chmod 755 .git/hooks/post-checkout