Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jebog/dad3b75b85791469e570 to your computer and use it in GitHub Desktop.
Save jebog/dad3b75b85791469e570 to your computer and use it in GitHub Desktop.

Revisions

  1. @meganlkm meganlkm revised this gist Mar 1, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion laravel5_shared_hosting_project.sh
    Original file line number Diff line number Diff line change
    @@ -14,7 +14,7 @@ done

    # this regex needs to be executed every time the vendor code is updated
    oldstr="\$this->basePath.DIRECTORY_SEPARATOR.'public'"
    newstr="dirname(\$this->basePath).DIRECTORY_SEPARATOR.'public_html'"
    newstr="dirname(\$this->basePath).DIRECTORY_SEPARATOR.'${mywww}'"
    sed -i '' "s|${oldstr}|${newstr}|" vendor/laravel/framework/src/Illuminate/Foundation/Application.php

    # fix path to bootstrap
  2. @meganlkm meganlkm revised this gist Mar 1, 2015. 1 changed file with 10 additions and 5 deletions.
    15 changes: 10 additions & 5 deletions laravel5_shared_hosting_project.sh
    Original file line number Diff line number Diff line change
    @@ -8,14 +8,15 @@ composer create-project laravel/laravel $myproject --prefer-dist
    cd $myproject

    # fix paths to public
    # since 'public' is hard coded in laravel Application.php file,
    # this regex needs to be executed on
    # vendor/laravel/framework/src/Illuminate/Foundation/Application.php
    # everytime the vendor code is updated
    for f in server.php storage/framework/compiled.php vendor/laravel/framework/src/Illuminate/Foundation/Application.php; do
    for f in server.php storage/framework/compiled.php; do
    perl -pi -e "s|/public|/../${mywww}|" $f
    done

    # this regex needs to be executed every time the vendor code is updated
    oldstr="\$this->basePath.DIRECTORY_SEPARATOR.'public'"
    newstr="dirname(\$this->basePath).DIRECTORY_SEPARATOR.'public_html'"
    sed -i '' "s|${oldstr}|${newstr}|" vendor/laravel/framework/src/Illuminate/Foundation/Application.php

    # fix path to bootstrap
    perl -pi -e "s|/bootstrap|/${myproject}/bootstrap|" public/index.php

    @@ -27,3 +28,7 @@ mkdir $myproject

    # move stuff to app dir
    mv {app,bootstrap,config,database,resources,storage,tests,vendor,artisan,.env*,*.js*,*.lock,*.php,*.xml,*.yml} $myproject

    # use artisan to remove the compiled app
    cd $myproject
    php artisan clear-compiled
  3. @meganlkm meganlkm created this gist Feb 7, 2015.
    29 changes: 29 additions & 0 deletions laravel5_shared_hosting_project.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,29 @@
    #!/bin/bash

    myproject='myproject'
    mywww='public_html'

    # initialize project
    composer create-project laravel/laravel $myproject --prefer-dist
    cd $myproject

    # fix paths to public
    # since 'public' is hard coded in laravel Application.php file,
    # this regex needs to be executed on
    # vendor/laravel/framework/src/Illuminate/Foundation/Application.php
    # everytime the vendor code is updated
    for f in server.php storage/framework/compiled.php vendor/laravel/framework/src/Illuminate/Foundation/Application.php; do
    perl -pi -e "s|/public|/../${mywww}|" $f
    done

    # fix path to bootstrap
    perl -pi -e "s|/bootstrap|/${myproject}/bootstrap|" public/index.php

    # rename the public folder to match hosting providers web root
    mv public $mywww

    # create a directory for everything except the public directory
    mkdir $myproject

    # move stuff to app dir
    mv {app,bootstrap,config,database,resources,storage,tests,vendor,artisan,.env*,*.js*,*.lock,*.php,*.xml,*.yml} $myproject