|
|
|
@@ -25,8 +25,6 @@ if [[ $COMPOSER -ne 0 ]]; then
|
|
|
|
|
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
|
|
|
|
|
else
|
|
|
|
|
echo "Composer is installed and ready to go."
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
@@ -45,24 +43,18 @@ else
|
|
|
|
|
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, scripts"
|
|
|
|
|
mkdir -p sass scripts
|
|
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
|
# 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
|
|
|
|
|
wget https://git.4lt.ca/nick/symfony/raw/branch/master/twig/twig.yaml
|
|
|
|
|
mv twig.yaml config/packages/twig.yaml
|
|
|
|
|
echo "Your twig.yaml config file has been replaced, remove the bak if you are happy."
|
|
|
|
|
echo "Creating directories: sass"
|
|
|
|
|
mkdir -p sass
|
|
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
|
# SASS
|
|
|
|
@@ -77,32 +69,58 @@ 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
|
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
|
|
composer req nickyeoman/symfonycms
|
|
|
|
|
# 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
|
|
|
|
|
composer req symfony/mailer # gives prompt
|
|
|
|
|
|
|
|
|
|
# https://symfony.com/doc/current/mailer.html
|
|
|
|
|
echo "Installing Mailer"
|
|
|
|
|
composer req -n symfony/mailer # gives prompt
|
|
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
|
# Symfony development bundles
|
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
|
|
# Dev components
|
|
|
|
|
composer req --dev maker
|
|
|
|
|
# https://symfony.com/doc/current/profiler.html
|
|
|
|
|
echo "Installing profiler for dev"
|
|
|
|
|
composer req --dev symfony/profiler-pack
|
|
|
|
|
composer req debug logger
|
|
|
|
|
|
|
|
|
|
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 security
|
|
|
|
|
# Symfony form
|
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
|
|
composer require symfony/security-bundle
|
|
|
|
|
composer require form validator
|
|
|
|
|
composer require symfonycasts/verify-email-bundle
|
|
|
|
|
composer require symfonycasts/reset-password-bundle
|
|
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
|
# Database
|
|
|
|
@@ -111,63 +129,11 @@ composer require symfonycasts/reset-password-bundle
|
|
|
|
|
composer req -n orm --with-all-dependencies
|
|
|
|
|
sleep 2
|
|
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
|
# Docker
|
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
|
|
# For the Apache container
|
|
|
|
|
composer req symfony/apache-pack #TODO: find a way to trigger this without interaction as it gives a prompt
|
|
|
|
|
|
|
|
|
|
# You need the following variables in your env for docker-compose
|
|
|
|
|
echo '' >> .env
|
|
|
|
|
echo '# For Docker compose' >> .env
|
|
|
|
|
echo 'DOCKERNAME=symfony' >> .env
|
|
|
|
|
echo 'DOCKERIMAGE=YOUR_NAME/YOUR_IMAGE_NAME' >> .env
|
|
|
|
|
echo 'DOCKERVER=latest' >> .env
|
|
|
|
|
echo 'DOCKERNET=DOCKER_NETWORK_NAME_FOR_PROXY' >> .env
|
|
|
|
|
echo "DOCKERPORT=8000" >> .env
|
|
|
|
|
ROOTPASS=`echo $RANDOM | md5sum | head -c 12`
|
|
|
|
|
echo "MYSQL_ROOT_PASSWORD=${ROOTPASS}" >> .env
|
|
|
|
|
echo 'DOCKERPHPMYADMIN=8001' >> .env
|
|
|
|
|
echo '' >> .env
|
|
|
|
|
echo '# Database info, should match your db url' >> .env
|
|
|
|
|
DBHOST='mariadb'
|
|
|
|
|
echo "DBHOST=${DBHOST}" >> .env
|
|
|
|
|
DB='symfony_project'
|
|
|
|
|
echo "DB=${DB}" >> .env
|
|
|
|
|
DBUSER=`echo $RANDOM | md5sum | head -c 4`
|
|
|
|
|
echo "DBUSER=theuser${DBUSER}" >> .env
|
|
|
|
|
DBPASS=`echo $RANDOM | md5sum | head -c 12`
|
|
|
|
|
echo "DBPASSWORD=${DBPASS}" >> .env
|
|
|
|
|
echo '' >> .env
|
|
|
|
|
echo "DATABASE_URL=\"mysql://theuser${DBUSER}:${DBPASS}@${DBHOST}:3306/${DB}?serverVersion=mariadb-10.4.11&charset=utf8mb4\"" >> .env
|
|
|
|
|
|
|
|
|
|
# TODO: move these here after you have symfony production ready
|
|
|
|
|
rm docker-compose.yml
|
|
|
|
|
rm docker-compose.override.yml
|
|
|
|
|
echo "Creating a docker-compose"
|
|
|
|
|
wget https://raw.githubusercontent.com/nickyeoman/phpframework/main/docker/docker-compose.yml
|
|
|
|
|
|
|
|
|
|
echo "Creating a Dockerfile"
|
|
|
|
|
wget https://raw.githubusercontent.com/nickyeoman/phpframework/main/docker/Dockerfile
|
|
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
|
# Routes
|
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
|
|
wget https://git.nickyeoman.com/nick/symfony/raw/branch/main/routes/routes.yaml
|
|
|
|
|
mv routes.yaml config/routes/symfonycms.yaml
|
|
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
|
# Clean up
|
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
|
|
composer update
|
|
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
|
# Git
|
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
|
|
rm -rf nick/
|
|
|
|
|
git add .
|
|
|
|
|
git commit -m"New Project Script Run Completed"
|
|
|
|
|
|
|
|
|
@@ -175,7 +141,7 @@ git commit -m"New Project Script Run Completed"
|
|
|
|
|
# Instructions
|
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
|
|
php bin/console --version
|
|
|
|
|
symfony console --version
|
|
|
|
|
|
|
|
|
|
composer recipes
|
|
|
|
|
|
|
|
|
|