From 7cc28eaf4d91c15e69f58968ff5408a065f78679 Mon Sep 17 00:00:00 2001 From: Juuso Takala Date: Thu, 15 Apr 2021 15:13:56 +0300 Subject: [PATCH] bat to sh --- bin/laragon.bat | 94 ------------------------------------------------- bin/laragon.sh | 59 +++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+), 94 deletions(-) delete mode 100644 bin/laragon.bat create mode 100644 bin/laragon.sh diff --git a/bin/laragon.bat b/bin/laragon.bat deleted file mode 100644 index c38bfaf..0000000 --- a/bin/laragon.bat +++ /dev/null @@ -1,94 +0,0 @@ -@echo off -SETLOCAL EnableDelayedExpansion -SET DOCUMENT_ROOT="c:/laragon/www/" - -REM PROJECTNAME -SET PROJECTNAME='' -:projectnameinput -SET /p PROJECTNAME="Project name in lowercase (without spaces or special characters): " -IF %PROJECTNAME% == '' GOTO :projectnameinput - -REM MYSQL_ROOT_PASSWORD -SET MYSQL_ROOT_PASSWORD='' -:mysqlrootinput -SET /p MYSQL_ROOT_PASSWORD="What is your MySQL root password: " -IF %MYSQL_ROOT_PASSWORD% == '' GOTO :mysqlrootinput - -REM ADMIN_USER -SET ADMIN_USER='' -:admin_userinput -SET /p ADMIN_USER="What is the admin user you want to login to wp-admin: " -IF %ADMIN_USER% == '' GOTO :admin_userinput - -REM ADMIN_PASSWORD -SET ADMIN_PASSWORD='' -:admin_passwordinput -SET /p ADMIN_PASSWORD="What is the password you want to use with your wp-admin admin user: " -IF %ADMIN_PASSWORD% == '' GOTO :admin_passwordinput - -REM ADMIN_EMAIL -SET ADMIN_EMAIL='' -:admin_emailinput -SET /p ADMIN_EMAIL="What is the email address you want to use with your wp-admin admin user: " -IF %ADMIN_EMAIL% == '' GOTO :admin_emailinput -CALL composer create-project -n ronilaukkarinen/dudestack %DOCUMENT_ROOT%/%PROJECTNAME% dev-master - -cd %DOCUMENT_ROOT%/%PROJECTNAME% - -CALL composer update - -mysql -u root -p%MYSQL_ROOT_PASSWORD% -e "CREATE DATABASE %PROJECTNAME%" - -sed -i -e "s/database_name/%PROJECTNAME%/g" .env -sed -i -e "s/database_user/root/g" .env -sed -i -e "s/database_password/%MYSQL_ROOT_PASSWORD%/g" .env -sed -i -e "s/database_host/127.0.0.1/g" .env -sed -i -e "s/example.com/%PROJECTNAME%.test/g" .env -sed -i -e "s/example.com/%PROJECTNAME%.test/g" .env -sed -i -e "s/http/https/g" .env - -echo path: wp > wp-cli.yml -echo url: https://%PROJECTNAME%.test >> wp-cli.yml -echo core install: >> wp-cli.yml -echo admin_user: "%ADMIN_USER%" >> wp-cli.yml -echo admin_password: "%ADMIN_PASSWORD%" >> wp-cli.yml -echo admin_email: "%ADMIN_EMAIL%" >> wp-cli.yml -echo title: "%PROJECTNAME%" >> wp-cli.yml - -CALL vendor\wp-cli\wp-cli\bin\wp core install --title=test --admin_email=%ADMIN_EMAIL% - -CALL vendor\wp-cli\wp-cli\bin\wp post delete 1 --force -CALL vendor\wp-cli\wp-cli\bin\wp post delete 2 --force -CALL vendor\wp-cli\wp-cli\bin\wp option update blogdescription '' -CALL vendor\wp-cli\wp-cli\bin\wp option update WPLANG 'fi' -CALL vendor\wp-cli\wp-cli\bin\wp option update current_theme '$PROJECTNAME' -CALL vendor\wp-cli\wp-cli\bin\wp theme delete twentytwelve -CALL vendor\wp-cli\wp-cli\bin\wp theme delete twentythirteen -CALL vendor\wp-cli\wp-cli\bin\wp option update permalink_structure '\%postname%' -CALL vendor\wp-cli\wp-cli\bin\wp option update timezone_string 'Europe\Helsinki' -CALL vendor\wp-cli\wp-cli\bin\wp option update default_pingback_flag '0' -CALL vendor\wp-cli\wp-cli\bin\wp option update default_ping_status 'closed' -CALL vendor\wp-cli\wp-cli\bin\wp option update default_comment_status 'closed' -CALL vendor\wp-cli\wp-cli\bin\wp option update date_format 'j.n.Y' -CALL vendor\wp-cli\wp-cli\bin\wp option update time_format 'H.i' -REM %DOCUMENT_ROOT%\%PROJECTNAME% && vendor\wp-cli\wp-cli\bin\wp option update admin_email 'koodarit@dude.fi' -REM %DOCUMENT_ROOT%\%PROJECTNAME% && vendor\wp-cli\wp-cli\bin\wp option delete new_admin_email - -rm README.md -rm LICENSE -rm -rf .git -rm .travis.yml -rm -rf bin -rm .env.example -rm phpcs.xml -rm wp-cli.yml - -REM CLEAN VARIABLES -SET DOCUMENT_ROOT='' -SET PROJECTNAME='' -SET ADMIN_USER='' -SET ADMIN_PASSWORD='' -SET ADMIN_EMAIL='' -SET MYSQL_ROOT_PASSWORD='' -ECHO DONE -ECHO RESTART NGINX FROM LARAGON GUI \ No newline at end of file diff --git a/bin/laragon.sh b/bin/laragon.sh new file mode 100644 index 0000000..566c54d --- /dev/null +++ b/bin/laragon.sh @@ -0,0 +1,59 @@ +#!/bin/bash +# Project starting bash script for Laragon. + +# Script specific vars +SCRIPT_LABEL='with Laragon support' +SCRIPT_VERSION='1.0.4' + +# Vars needed for this file to function globally +CURRENTFILE=`basename $0` + +if [ "$CURRENTFILE" = "laragon.sh" ]; then + SCRIPTS_LOCATION="$( pwd )" +else + DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" + ORIGINAL_FILE=$( readlink $DIR/$CURRENTFILE ) + SCRIPTS_LOCATION=$( dirname $ORIGINAL_FILE ) +fi + +echo "-----------------------------------------------------" +echo "createproject start script ${SCRIPT_LABEL}, v${SCRIPT_VERSION}" +echo "-----------------------------------------------------" +echo "" + +# Variables +PROJECTS_HOME="c:/laragon/www" +DIR_TO_FILE=$(cd "$(dirname "$1")"; pwd -P)/$(basename "$1") +CURRENTFILE=`basename $0` +TXTBOLD=$(tput bold) +BOLDYELLOW=${TXTBOLD}$(tput setaf 3) +BOLDGREEN=${TXTBOLD}$(tput setaf 2) +BOLDWHITE=${TXTBOLD}$(tput setaf 7) +YELLOW=$(tput setaf 3) +RED=$(tput setaf 1) +GREEN=$(tput setaf 2) +WHITE=$(tput setaf 7) +TXTRESET=$(tput sgr0) +YEAR=$(date +%y) +CURRENTFILE=`basename $0` + +source ${SCRIPTS_LOCATION}/tasks/askvars.sh + +# Create project via roots/bedrock based command create-project from our packagist package +echo "${YELLOW}Creating project via composer create-project command...${TXTRESET}" +composer create-project -n ronilaukkarinen/dudestack ${PROJECTS_HOME}/${PROJECTNAME} dev-master +cd ${PROJECTS_HOME}/${PROJECTNAME} +composer update + +# Initialize database +source ${SCRIPTS_LOCATION}/tasks/initdb.sh + +source ${SCRIPTS_LOCATION}/tasks/dotenv.sh + +source ${SCRIPTS_LOCATION}/tasks/wp-cli.sh + +source ${SCRIPTS_LOCATION}/tasks/cleanups.sh + +source ${SCRIPTS_LOCATION}/tasks/github.sh + +source ${SCRIPTS_LOCATION}/tasks/footer.sh