#!/bin/bash # Use it : # ./install-cms ./my-folder # Bash script relative lines : ${1?failure: in wich folder should i work ?} folder=$1 echo "Installation running in folder $folder" # First clean the folder where we will install rm -rf ${folder} # Install symfony composer create-project symfony/skeleton ${folder} ^4.4 cd ${folder} # Install Pied Web CMS composer require piedweb/cms-bundle ^0 # Work around because we prepend our config in the bundle #sed -i -e "/access_control:/d" ./config/packages/security.yaml sed -i -e "/PiedWeb\\\CMSBundle\\\PiedWebCMSBundle::class => \['all' => true\],/d" config/bundles.php sed -i -e "s/return \[/return \[\n PiedWeb\\\CMSBundle\\\PiedWebCMSBundle::class => \['all' => true\],/" config/bundles.php # Set in french :) sed -i -e "s/parameters:/parameters:\n locale: 'fr'/" config/services.yaml # We erase all configuration files generated by recipes and copy ours to permit prepend to work # todo try refusing flex #ln -s -f ../../vendor/piedweb/cms-bundle/src/Resources/config/packages/security.yaml config/packages/security.yaml cd config/packages rm doctrine.yaml framework.yaml liip_imagine.yaml sonata_admin.yaml translation.yaml twig.yaml vich_uploader.yaml rm assets.yaml cd ../../ # We copy piedweb_cms config to easily edit it later manually cp vendor/piedweb/cms-bundle/src/Resources/config/packages/piedweb_cms.yaml config/packages/piedweb_cms.yaml php bin/console cache:clear composer require piedweb/cms-bundle ^0 # Create default Entity mkdir src/Entity cp -R vendor/piedweb/cms-bundle/Install/Entity/. src/Entity # Copy assets mkdir -p assets cp vendor/piedweb/cms-bundle/assets/.babelrc .babelrc cp vendor/piedweb/cms-bundle/assets/package.json package.json cp vendor/piedweb/cms-bundle/assets/webpack.config.js webpack.config.js read -p "Install full featured template (else simple) ? [Y/n] " -n 1 -r if [[ $REPLY =~ ^[Yy]$ ]] then #todo !!! cp vendor/piedweb/cms-bundle/assets/main.js assets/main.js cp vendor/piedweb/cms-bundle/assets/main.scss assets/main.scss else cp vendor/piedweb/cms-bundle/assets/main.js assets/main.js cp vendor/piedweb/cms-bundle/assets/main.scss assets/main.scss fi cp -r vendor/piedweb/cms-bundle/assets/icons assets/ # Copy the two files from default theme you will want to personnalize cp vendor/piedweb/cms-bundle/src/Resources/views/page/_menu.html.twig templates/bundles/PiedWebCMSBundle/page/_menu.html.twig cp vendor/piedweb/cms-bundle/src/Resources/views/page/_footer.html.twig templates/bundles/PiedWebCMSBundle/page/_footer.html.twig # Create favicon convert -background none assets/icons/icon.svg -define icon:auto-resize=16,32,48 assets/icons/favicon.ico # Advice # use https://realfavicongenerator.net and erase in `templates/bundles/PiedWebCMSBundle/base.html.twig` `favicon` block # Install assets for the default theme yarn yarn encore dev # Install sqlite by default sed -i -e "s/DATABASE_URL=\".*\"/DATABASE_URL=\"sqlite:\/\/\/%kernel\.project_dir%\/var\/app\.db\"/" .env ## Install default routes echo -e "piedweb:\n resource: '@PiedWebCMSBundle/Resources/config/routes/all.yaml'" >config/routes.yaml # Create Database: php bin/console doctrine:schema:create # Add an admin user : read -p 'Email: ' emailvar read -sp 'Password: ' passvar php bin/console piedweb:user:create $emailvar $passvar ROLE_SUPER_ADMIN # Install Sonata Front-End Assets php bin/console assets:install # Create a robots.txt echo '' >public/robots.txt # Launch Server and Play read -p "Launch Server and play? [Y/n] " -n 1 -r if [[ $REPLY =~ ^[Yy]$ ]] then symfony server:start -d fi