Skip to content

Instantly share code, notes, and snippets.

@tnylea
Created April 11, 2017 20:14
Show Gist options
  • Save tnylea/285810ba6eaf6a178f1c7414125fee39 to your computer and use it in GitHub Desktop.
Save tnylea/285810ba6eaf6a178f1c7414125fee39 to your computer and use it in GitHub Desktop.
Moving files into a separate folder for Laravel App
root_path="./"
mkdir ${root_path}/application
cp -a ${root_path}/app ${root_path}/application/app
cp -a ${root_path}/bootstrap ${root_path}/application/bootstrap
cp -a ${root_path}/config ${root_path}/application/config
cp -a ${root_path}/database ${root_path}/application/database
cp -a ${root_path}/resources ${root_path}/application/resources
cp -a ${root_path}/storage ${root_path}/application/storage
cp -a ${root_path}/vendor ${root_path}/application/vendor
cp -a ${root_path}/public/application/assets ${root_path}/application/assets
chmod -R 755 ${root_path}/public/content
cp -a ${root_path}/public/content ${root_path}/content
rm -rf ${root_path}/content/themes/*
cp -a ${root_path}/public/content/themes/default ${root_path}/content/themes/default
cp -a ${root_path}/public/.htaccess ${root_path}/dist/app/.htaccess
cp -a ${root_path}/.env.example ${root_path}/dist/app/.env
cp -a ${root_path}/public/index.php ${root_path}/dist/app/index.php
cp -a ${root_path}/tools/files/php/install.php ${root_path}/dist/app/install.php
# Change the locations of the bootstrap folder in index.php file
sed "s/require __DIR__.'\/..\/bootstrap\/autoload.php';/require __DIR__.'\/application\/bootstrap\/autoload.php';/" ${root_path}/dist/app/index.php > ${root_path}/dist/app/index-new.php
rm ${root_path}/dist/app/index.php
sed "s/'\/..\/bootstrap\/app.php';/'\/application\/bootstrap\/app.php';/" ${root_path}/dist/app/index-new.php > ${root_path}/dist/app/index.php
rm ${root_path}/dist/app/index-new.php
# Change the location of the theme location
sed "s/'\/..\/..\/public\/'/'\/..\/..\/..\/'/" ${root_path}/application/app/Providers/RouteServiceProvider.php > ${root_path}/application/app/Providers/RouteServiceProvider-new.php
rm ${root_path}/application/app/Providers/RouteServiceProvider.php
mv ${root_path}/application/app/Providers/RouteServiceProvider-new.php ${root_path}/application/app/Providers/RouteServiceProvider.php
# Change the location of the theme location
sed "s/return \$app;/Dotenv::load(__DIR__.'\/..\/..\/');$(printf '\r')$(printf '\r')return \$app;/g" ${root_path}/application/bootstrap/app.php > ${root_path}/application/bootstrap/app-new.php
rm ${root_path}/application/bootstrap/app.php
mv ${root_path}/application/bootstrap/app-new.php ${root_path}/application/bootstrap/app.php
mv ${root_path}/application ${root_path}/dist/app/application
mv ${root_path}/content ${root_path}/dist/app/content
# Zip the regular application and content folders
#zip -r ${root_path}/application.zip ${root_path}/application
#mv ${root_path}/application.zip ${root_path}/dist/app/application.zip
#zip -r ${root_path}/content.zip ${root_path}/content
#mv ${root_path}/content.zip ${root_path}/dist/app/content.zip
rm -rf ${root_path}/application
rm -rf ${root_path}/content
chmod -R 755 ${root_path}/dist/app
chmod -R 777 ${root_path}/dist/app/application/storage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment