From 5e72e230516d521607c2cfb08d3cf57c012be93d Mon Sep 17 00:00:00 2001 From: Nick Yeoman Date: Tue, 11 Apr 2023 11:22:23 -0700 Subject: [PATCH] cleaned ups somethings --- README.md | 6 +++--- bin/nysymfony | 42 ++++++++++++++++++++++++------------------ docs/EasyAdmin.md | 8 -------- routes/routes.yaml | 6 ------ 4 files changed, 27 insertions(+), 35 deletions(-) delete mode 100644 docs/EasyAdmin.md diff --git a/README.md b/README.md index cbe4362..41b9975 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ ## Requirements -* ubuntu php-cli (sudo nala install php-curl php-xml php-mysql) +* ubuntu php-cli (sudo nala install curl unzip php-curl php-xml php-mysql) * [Install Composer](https://www.nickyeoman.com/page/install-composer-on-ubuntu) * [Symfony cli](https://symfony.com/download) @@ -23,9 +23,9 @@ The next steps to take would be: 1. Verify the ```.env``` and ```docker-compose.md``` file 1. start docker ```sudo docker-compose up -d``` -1. [Create your controllers](https://git.gopo.li/nick/symfony/src/branch/main/docs/Controller.md) +1. [Create your controllers](https://git.nickyeoman.com/nick/symfony/src/branch/main/docs/Controller.md) 1. Run sass ```sass sass/project.sass public/css/main.css``` -1. [Create your security](https://git.gopo.li/nick/symfony/src/branch/main/docs/Security.md) +1. [Create your security](https://git.nickyeoman.com/nick/symfony/src/branch/main/docs/Security.md) # Currently supported and tested on diff --git a/bin/nysymfony b/bin/nysymfony index 202ff57..429782b 100755 --- a/bin/nysymfony +++ b/bin/nysymfony @@ -1,12 +1,18 @@ #!/bin/bash ################################################################################ # Nix install symfony bash script -# v1.0.0 +# v2 ################################################################################ -echo "*** Starting New Symfony Project ***" +################################################################################ +# Check parameter (folder name) +################################################################################ -# check that $1 folder does not exit +if [ -z "$1" ] + then + echo "Please provide a folder name" + exit 1 +fi [ -d "$1" ] && echo "Folder $1 already exists" && exit 1 ################################################################################ @@ -64,7 +70,6 @@ echo "Your twig.yaml config file has been replaced, remove the bak if you are ha ################################################################################ echo "Creating SASS directory for css" -composer require nickyeoman/nytwig composer require nickyeoman/sassLibrary touch sass/$1.sass mkdir -p public/css @@ -104,7 +109,8 @@ composer require symfonycasts/verify-email-bundle # Database ################################################################################ -composer req -n orm && sleep 1 +composer req -n orm --with-all-dependencies +sleep 2 # TODO: In the future you may want to replace this with code # ( but not here if you are sharing the script) @@ -118,6 +124,7 @@ composer req -n orm && sleep 1 composer req symfony/apache-pack #TODO: find a way to trigger this without interaction +# You need the following variables in your env for docker-compose # You need the following variables in your env for docker-compose echo '' >> .env echo '# For Docker compose' >> .env @@ -126,20 +133,21 @@ echo 'DOCKERIMAGE=YOUR_NAME/YOUR_IMAGE_NAME' >> .env echo 'DOCKERVER=latest' >> .env echo 'DOCKERNET=DOCKER_NETWORK_NAME_FOR_PROXY' >> .env echo "DOCKERPORT=8000" >> .env -GEN=`echo $RANDOM | md5sum | head -c 12` -echo "MYSQL_ROOT_PASSWORD=${GEN}" >> .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 -echo 'DBHOST=mariadb' >> .env -echo 'DB=symfony_project' >> .env -GEN=`echo $RANDOM | md5sum | head -c 4` -echo "DBUSER=theuser${GEN}" >> .env -GEN=`echo $RANDOM | md5sum | head -c 12` -echo "DBPASSWORD=${GEN}" >> .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://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=mariadb-10.4.11&charset=utf8mb4"' >> .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 @@ -154,10 +162,8 @@ wget https://raw.githubusercontent.com/nickyeoman/phpframework/main/docker/Docke # Routes ################################################################################ -mv config/routes/routes.yaml config/routes/routes.yaml.bak wget https://git.nickyeoman.com/nick/symfony/raw/branch/main/routes/routes.yaml -mv routes.yaml config/routes/routes.yaml - +mv routes.yaml config/routes/symfonycms.yaml ################################################################################ # Clean up diff --git a/docs/EasyAdmin.md b/docs/EasyAdmin.md deleted file mode 100644 index 9c7d3f4..0000000 --- a/docs/EasyAdmin.md +++ /dev/null @@ -1,8 +0,0 @@ -# EasyAdmin Bundle - -I decided not to use this as it comes with a lot of stuff you don't want. - -Symfony 6 -Admin Bundle 4 - -https://www.youtube.com/playlist?list=PLrVW8QdFhIiA1da1zOhnhmAMqYoeyGKxV diff --git a/routes/routes.yaml b/routes/routes.yaml index 7141835..99f6941 100644 --- a/routes/routes.yaml +++ b/routes/routes.yaml @@ -1,8 +1,2 @@ -controllers: - resource: - path: ../src/Controller/ - namespace: App\Controller - type: attribute - NickYeomanSymfonyCMS: resource: '@SymfonyCMSBundle/config/routes.yaml'