2022-11-14 05:47:29 +00:00
|
|
|
#!/bin/bash
|
2022-11-14 17:07:56 +00:00
|
|
|
################################################################################
|
2024-02-16 05:04:53 +00:00
|
|
|
# 4lt's install symfony bash script
|
2022-11-14 17:07:56 +00:00
|
|
|
################################################################################
|
2022-11-14 05:47:29 +00:00
|
|
|
|
2023-04-11 18:22:23 +00:00
|
|
|
################################################################################
|
|
|
|
# Check parameter (folder name)
|
|
|
|
################################################################################
|
2022-11-14 05:47:29 +00:00
|
|
|
|
2023-04-11 18:22:23 +00:00
|
|
|
if [ -z "$1" ]
|
|
|
|
then
|
|
|
|
echo "Please provide a folder name"
|
|
|
|
exit 1
|
|
|
|
fi
|
2022-11-14 05:47:29 +00:00
|
|
|
[ -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
|
|
|
|
|
|
|
|
################################################################################
|
2024-04-17 23:44:37 +00:00
|
|
|
# Symfony bin installed
|
2022-11-14 05:47:29 +00:00
|
|
|
################################################################################
|
|
|
|
|
2024-04-17 23:44:37 +00:00
|
|
|
git clone git@git.4lt.ca:nick/symfony.git nick
|
2022-11-14 05:47:29 +00:00
|
|
|
|
|
|
|
################################################################################
|
2024-04-17 23:44:37 +00:00
|
|
|
# Create directories
|
2022-11-14 05:47:29 +00:00
|
|
|
################################################################################
|
|
|
|
|
2024-04-17 23:44:37 +00:00
|
|
|
echo "Creating directories: sass"
|
|
|
|
mkdir -p sass
|
2022-11-14 05:47:29 +00:00
|
|
|
|
|
|
|
################################################################################
|
|
|
|
# SASS
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
echo "Creating SASS directory for css"
|
2022-12-18 05:11:55 +00:00
|
|
|
composer require nickyeoman/sassLibrary
|
2023-05-16 23:42:29 +00:00
|
|
|
touch sass/project.sass
|
2022-12-18 05:11:55 +00:00
|
|
|
mkdir -p public/css
|
|
|
|
touch public/css/main.css
|
|
|
|
echo '.sass-cache' >> .gitignore
|
2023-05-16 23:42:29 +00:00
|
|
|
echo '@import ../vendor/nickyeoman/sasslibrary/master.sass' > sass/project.sass
|
2022-11-14 05:47:29 +00:00
|
|
|
echo "SASS installed you still need to run sass sass/$1.sass public/css/main.css"
|
|
|
|
|
|
|
|
################################################################################
|
2024-04-17 23:44:37 +00:00
|
|
|
# Twig
|
2022-11-14 05:47:29 +00:00
|
|
|
################################################################################
|
|
|
|
|
2024-04-17 23:44:37 +00:00
|
|
|
echo "Creating scaffolding Twig templates in views directory"
|
2022-11-17 04:02:30 +00:00
|
|
|
|
2024-04-17 23:44:37 +00:00
|
|
|
composer require twig
|
|
|
|
composer require nickyeoman/nytwig
|
2022-11-16 02:33:37 +00:00
|
|
|
|
2024-04-17 23:44:37 +00:00
|
|
|
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."
|
2022-11-14 05:47:29 +00:00
|
|
|
|
2022-11-17 22:07:14 +00:00
|
|
|
################################################################################
|
2024-04-17 23:44:37 +00:00
|
|
|
# Symfony bundles
|
2022-11-17 22:07:14 +00:00
|
|
|
################################################################################
|
|
|
|
|
2024-04-17 23:44:37 +00:00
|
|
|
# https://symfony.com/doc/current/components/process.html (for running commands)
|
|
|
|
echo "Installing process"
|
|
|
|
composer req symfony/process
|
2022-11-17 22:07:14 +00:00
|
|
|
|
2024-04-17 23:44:37 +00:00
|
|
|
# https://symfony.com/doc/current/components/asset.html
|
|
|
|
echo "Installing asset"
|
|
|
|
composer req asset
|
2022-11-18 01:10:00 +00:00
|
|
|
|
2024-04-17 23:44:37 +00:00
|
|
|
# https://symfony.com/doc/current/mailer.html
|
|
|
|
echo "Installing Mailer"
|
|
|
|
composer req -n symfony/mailer # gives prompt
|
2022-11-18 01:10:00 +00:00
|
|
|
|
2022-11-14 05:47:29 +00:00
|
|
|
################################################################################
|
2024-04-17 23:44:37 +00:00
|
|
|
# Symfony development bundles
|
2022-11-14 05:47:29 +00:00
|
|
|
################################################################################
|
|
|
|
|
2024-04-17 23:44:37 +00:00
|
|
|
# https://symfony.com/doc/current/profiler.html
|
|
|
|
echo "Installing profiler for dev"
|
|
|
|
composer req --dev symfony/profiler-pack
|
2022-11-14 05:47:29 +00:00
|
|
|
|
2024-04-17 23:44:37 +00:00
|
|
|
composer require cs-fixer-shim --dev
|
2022-11-14 05:47:29 +00:00
|
|
|
|
2024-04-17 23:44:37 +00:00
|
|
|
# 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/.
|
2022-11-14 05:47:29 +00:00
|
|
|
|
2023-04-11 04:17:03 +00:00
|
|
|
################################################################################
|
2024-04-17 23:44:37 +00:00
|
|
|
# Symfony form
|
2023-04-11 04:17:03 +00:00
|
|
|
################################################################################
|
|
|
|
|
2024-04-17 23:44:37 +00:00
|
|
|
composer require form validator
|
2023-04-11 04:17:03 +00:00
|
|
|
|
2022-11-18 04:25:09 +00:00
|
|
|
################################################################################
|
2024-04-17 23:44:37 +00:00
|
|
|
# Database
|
2022-11-18 04:25:09 +00:00
|
|
|
################################################################################
|
|
|
|
|
2024-04-17 23:44:37 +00:00
|
|
|
composer req -n orm --with-all-dependencies
|
|
|
|
sleep 2
|
2022-11-18 04:25:09 +00:00
|
|
|
|
2022-11-17 04:02:30 +00:00
|
|
|
################################################################################
|
|
|
|
# Git
|
|
|
|
################################################################################
|
|
|
|
|
2024-04-17 23:44:37 +00:00
|
|
|
rm -rf nick/
|
2022-11-17 04:02:30 +00:00
|
|
|
git add .
|
|
|
|
git commit -m"New Project Script Run Completed"
|
|
|
|
|
2022-11-14 05:47:29 +00:00
|
|
|
################################################################################
|
|
|
|
# Instructions
|
|
|
|
################################################################################
|
|
|
|
|
2024-04-17 23:44:37 +00:00
|
|
|
symfony console --version
|
2022-11-16 02:33:37 +00:00
|
|
|
|
2022-11-18 04:25:09 +00:00
|
|
|
composer recipes
|
2022-11-14 05:47:29 +00:00
|
|
|
|
2022-11-18 04:25:09 +00:00
|
|
|
echo "Symfony Installed"
|