Skip to content

Instantly share code, notes, and snippets.

@mnshankar
Last active July 24, 2016 22:20

Revisions

  1. mnshankar revised this gist Mar 18, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion post-receive.sh
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    #!/bin/sh
    WEBROOT=/var/www/domain.com/public_html/project
    WEBROOT=/var/www/domain.com/project
    GIT_WORK_TREE=$WEBROOT git checkout -f
    #change directory to the project dir
    cd $WEBROOT
  2. mnshankar revised this gist Mar 18, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion post-receive.sh
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    #!/bin/sh
    WEBROOT=/var/www/domain.com/public_html/project
    GIT_WORK_TREE=$WEBROOT git checkout -f
    /usr/bin/git log -1 --pretty=format:'%h' --abbrev-commit>$WEBROOT/version.txt
    #change directory to the project dir
    cd $WEBROOT
    rm -f storage/cache/*
    echo 'cache cleared'
  3. mnshankar created this gist Mar 18, 2014.
    29 changes: 29 additions & 0 deletions post-receive.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,29 @@
    #!/bin/sh
    WEBROOT=/var/www/domain.com/public_html/project
    GIT_WORK_TREE=$WEBROOT git checkout -f
    /usr/bin/git log -1 --pretty=format:'%h' --abbrev-commit>$WEBROOT/version.txt
    cd $WEBROOT
    rm -f storage/cache/*
    echo 'cache cleared'
    rm -f storage/views/*
    echo 'views cleared'
    # Check if a composer.json file is present
    if [ -f composer.json ]; then

    # Detect composer binary
    if which composer >/dev/null; then
    composer='composer'
    elif which composer.phar >/dev/null; then
    composer='composer.phar'
    else
    # Install composer
    curl -s http://getcomposer.org/installer | php >/dev/null
    composer='php composer.phar'
    fi

    # Install or update packages specified in the lock file
    $composer install

    fi
    # migrate database if required
    php artisan migrate