Created
April 3, 2012 09:45
-
-
Save hughsk/2290728 to your computer and use it in GitHub Desktop.
Node + Git push-to-deploy hook
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
# GITBAREDIR e.g. "/home/web/present-company.git" | |
GITBAREDIR=`pwd`; | |
# GITPROJECTDIR e.g. "present-company" | |
GITPROJECTDIR=`basename $PWD | sed 's/.git//g'`; | |
# Stop the application, move up on directory | |
npm stop; | |
cd ..; | |
# Clears the working app directory | |
# Careful with this one! | |
sudo rm $GITPROJECTDIR --recursive; | |
# Clone new contents of project directory, e.g. | |
# Bare directory: ./present-company.git | |
# Working App: ./present-company | |
git clone $GITBAREDIR $GITPROJECTDIR; | |
# Go to the new project directory and install dependencies | |
cd $GITPROJECTDIR && sudo npm install .; | |
# Start the application again. | |
npm start; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment