Skip to content

Instantly share code, notes, and snippets.

@bru
Created October 22, 2010 16:11
Show Gist options
  • Save bru/640835 to your computer and use it in GitHub Desktop.
Save bru/640835 to your computer and use it in GitHub Desktop.
switches rails environment in passenger based on the git branch
#!/bin/sh
ref=$(git symbolic-ref HEAD 2> /dev/null)
if [[ -n $ref ]]; then
if [[ $ref =~ "master" ]]; then
rm public/.htaccess
else
echo "RailsEnv ${ref#refs/heads/}" > public/.htaccess
fi
touch tmp/restart.txt
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment