Skip to content

Instantly share code, notes, and snippets.

@vool
Last active May 5, 2022 22:39

Revisions

  1. vool revised this gist Dec 5, 2018. 1 changed file with 4 additions and 13 deletions.
    17 changes: 4 additions & 13 deletions laravel_post_receive hook
    Original file line number Diff line number Diff line change
    @@ -5,7 +5,6 @@ echo "Post receive hook: Updating website"
    echo "********************"

    #set the git repo dir

    GIT_REPO_DIR=~/git/<repo>.git
    echo "The git repo dir is $GIT_REPO_DIR"

    @@ -21,11 +20,6 @@ echo 'views cleared'

    php artisan migrate --no-interaction

    #Bower
    # only run if bower.json has changed

    echo "** Bower **"

    # switch to webroot
    cd $GIT_REPO_DIR

    @@ -37,15 +31,12 @@ changedfiles=( `git diff-tree --no-commit-id --name-only HEAD^ HEAD` )
    #switch back
    cd $WEBROOT

    # check if bower has been updated, if so install
    if [[ "${changedfiles[*]}" =~ "bower.json" ]]; then
    echo "bower has been updated - installing"
    bower install
    echo "bower pruning"
    bower prune
    # check if node package has been updated, if so install
    if [[ "${changedfiles[*]}" =~ "package.lock" ]]; then
    echo "package.lock changed: Installing npm dependencies..."
    npm install
    fi


    # check if composer has been updated, if so install
    # Check if the composer.lock file is present
    if [[ "${changedfiles[*]}" =~ "composer.lock" ]]; then
  2. vool revised this gist Dec 5, 2018. 1 changed file with 0 additions and 4 deletions.
    4 changes: 0 additions & 4 deletions laravel_post_receive hook
    Original file line number Diff line number Diff line change
    @@ -9,8 +9,6 @@ echo "********************"
    GIT_REPO_DIR=~/git/<repo>.git
    echo "The git repo dir is $GIT_REPO_DIR"



    WEBROOT=/var/www/<website>
    GIT_WORK_TREE=$WEBROOT git checkout -f
    #change directory to the project dir
    @@ -21,8 +19,6 @@ echo 'cache cleared'
    rm -f storage/views/*
    echo 'views cleared'

    composer install

    php artisan migrate --no-interaction

    #Bower
  3. vool revised this gist Dec 5, 2018. 1 changed file with 0 additions and 3 deletions.
    3 changes: 0 additions & 3 deletions laravel_post_receive hook
    Original file line number Diff line number Diff line change
    @@ -25,9 +25,6 @@ composer install

    php artisan migrate --no-interaction

    #Basset
    #php artisan basset:build

    #Bower
    # only run if bower.json has changed

  4. vool revised this gist Jun 11, 2015. 1 changed file with 9 additions and 2 deletions.
    11 changes: 9 additions & 2 deletions laravel_post_receive hook
    Original file line number Diff line number Diff line change
    @@ -44,15 +44,22 @@ changedfiles=( `git diff-tree --no-commit-id --name-only HEAD^ HEAD` )
    #switch back
    cd $WEBROOT

    # check if bower has been updated, if so install
    if [[ "${changedfiles[*]}" =~ "bower.json" ]]; then
    echo "bower installing"
    echo "bower has been updated - installing"
    bower install
    echo "bower pruning"
    bower prune
    fi



    # check if composer has been updated, if so install
    # Check if the composer.lock file is present
    if [[ "${changedfiles[*]}" =~ "composer.lock" ]]; then
    # Install or update packages specified in the lock file
    echo "composer.lock has been updated - do install"
    composer install --no-dev
    fi


    php artisan cache:clear
  5. vool revised this gist May 28, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion laravel_post_receive hook
    Original file line number Diff line number Diff line change
    @@ -23,7 +23,7 @@ echo 'views cleared'

    composer install

    php artisan migrate
    php artisan migrate --no-interaction

    #Basset
    #php artisan basset:build
  6. vool revised this gist Aug 14, 2014. 1 changed file with 25 additions and 1 deletion.
    26 changes: 25 additions & 1 deletion laravel_post_receive hook
    Original file line number Diff line number Diff line change
    @@ -4,10 +4,18 @@ echo "********************"
    echo "Post receive hook: Updating website"
    echo "********************"

    #set the git repo dir

    GIT_REPO_DIR=~/git/<repo>.git
    echo "The git repo dir is $GIT_REPO_DIR"



    WEBROOT=/var/www/<website>
    GIT_WORK_TREE=$WEBROOT git checkout -f
    #change directory to the project dir
    cd $WEBROOT

    rm -f storage/cache/*
    echo 'cache cleared'
    rm -f storage/views/*
    @@ -23,12 +31,28 @@ php artisan migrate
    #Bower
    # only run if bower.json has changed

    changedfiles=( `git diff-tree --no-commit-id --name-only HEAD@{1} HEAD` )
    echo "** Bower **"

    # switch to webroot
    cd $GIT_REPO_DIR

    # geting a 'fatal: ambiguous argument' from this ?
    #changedfiles=( `git diff-tree --no-commit-id --name-only HEAD@{1} HEAD` )

    changedfiles=( `git diff-tree --no-commit-id --name-only HEAD^ HEAD` )

    #switch back
    cd $WEBROOT

    if [[ "${changedfiles[*]}" =~ "bower.json" ]]; then
    echo "bower installing"
    bower install
    echo "bower pruning"
    bower prune
    fi





    php artisan cache:clear
  7. vool revised this gist Aug 6, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion laravel_post_receive hook
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    #!/bin/sh
    #!/bin/bash

    echo "********************"
    echo "Post receive hook: Updating website"
  8. vool revised this gist Aug 6, 2014. 1 changed file with 13 additions and 1 deletion.
    14 changes: 13 additions & 1 deletion laravel_post_receive hook
    Original file line number Diff line number Diff line change
    @@ -17,6 +17,18 @@ composer install

    php artisan migrate

    php artisan basset:build
    #Basset
    #php artisan basset:build

    #Bower
    # only run if bower.json has changed

    changedfiles=( `git diff-tree --no-commit-id --name-only HEAD@{1} HEAD` )

    if [[ "${changedfiles[*]}" =~ "bower.json" ]]; then
    echo "bower installing"
    bower install
    fi


    php artisan cache:clear
  9. vool revised this gist Aug 1, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion laravel_post_receive hook
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,7 @@ echo "********************"
    echo "Post receive hook: Updating website"
    echo "********************"

    WEBROOT=/var/www/website
    WEBROOT=/var/www/<website>
    GIT_WORK_TREE=$WEBROOT git checkout -f
    #change directory to the project dir
    cd $WEBROOT
  10. vool created this gist Jun 6, 2014.
    22 changes: 22 additions & 0 deletions laravel_post_receive hook
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,22 @@
    #!/bin/sh

    echo "********************"
    echo "Post receive hook: Updating website"
    echo "********************"

    WEBROOT=/var/www/website
    GIT_WORK_TREE=$WEBROOT git checkout -f
    #change directory to the project dir
    cd $WEBROOT
    rm -f storage/cache/*
    echo 'cache cleared'
    rm -f storage/views/*
    echo 'views cleared'

    composer install

    php artisan migrate

    php artisan basset:build

    php artisan cache:clear