#!/bin/bash ################################################################################ # 4lt's install symfony bash script ################################################################################ ################################################################################ # Check parameter (folder name) ################################################################################ if [ -z "$1" ] then echo "Please provide a folder name" exit 1 fi [ -d "$1" ] && echo "Folder $1 already exists" && exit 1 ################################################################################ # Check composer installed ################################################################################ composer -v > /dev/null 2>&1 COMPOSER=$? if [[ $COMPOSER -ne 0 ]]; then echo 'Composer is not installed' echo 'Checkout how to Install Composer here: https://www.nickyeoman.com/blog/php/install-composer-on-ubuntu/' echo 'Once installed, try running this script again' exit 1 fi ################################################################################ # Symfony bin installed ################################################################################ symfony help > /dev/null 2>&1 SYMFONY=$? if [[ $SYMFONY -ne 0 ]]; then echo 'Symfony is not installed' echo 'Do this: https://symfony.com/download' exit 1 else symfony new $1 cd $1 echo "New symfony project called $1 created." fi ################################################################################ # Symfony bin installed ################################################################################ git clone git@git.4lt.ca:nick/symfony.git nick ################################################################################ # Create directories ################################################################################ echo "Creating directories: sass" mkdir -p sass ################################################################################ # SASS ################################################################################ echo "Creating SASS directory for css" composer require nickyeoman/sassLibrary touch sass/project.sass mkdir -p public/css touch public/css/main.css echo '.sass-cache' >> .gitignore echo '@import ../vendor/nickyeoman/sasslibrary/master.sass' > sass/project.sass echo "SASS installed you still need to run sass sass/$1.sass public/css/main.css" ################################################################################ # Twig ################################################################################ echo "Creating scaffolding Twig templates in views directory" composer require twig composer require nickyeoman/nytwig mv config/packages/twig.yaml config/packages/twig.yaml.bak cp vendor/nickyeoman/nytwig/symfony/twig.yaml config/packages/twig.yaml echo "Your twig.yaml config file has been replaced, remove the bak if you are happy." ################################################################################ # Symfony bundles ################################################################################ # https://symfony.com/doc/current/components/process.html (for running commands) echo "Installing process" composer req symfony/process # https://symfony.com/doc/current/components/asset.html echo "Installing asset" composer req asset # https://symfony.com/doc/current/mailer.html echo "Installing Mailer" composer req -n symfony/mailer # gives prompt ################################################################################ # Symfony development bundles ################################################################################ # https://symfony.com/doc/current/profiler.html echo "Installing profiler for dev" composer req --dev symfony/profiler-pack composer require cs-fixer-shim --dev # https://symfony.com/bundles/SymfonyMakerBundle/current/index.html echo "Installing maker bundle for dev" composer req --dev maker sleep 2 rm -rf vendor/symfony/maker-bundle/src/Resources/skeleton/controller/* cp -R nick/maker/*.php vendor/symfony/maker-bundle/src/Resources/skeleton/controller/. ################################################################################ # Symfony form ################################################################################ composer require form validator ################################################################################ # Database ################################################################################ composer req -n orm --with-all-dependencies sleep 2 ################################################################################ # Git ################################################################################ rm -rf nick/ git add . git commit -m"New Project Script Run Completed" ################################################################################ # Instructions ################################################################################ symfony console --version composer recipes echo "Symfony Installed"