From d8035ce4ca7be2d84401b46ba657ac7c6e28f4f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juanjo=20L=C3=B3pez?= Date: Tue, 10 Dec 2024 16:31:15 +0100 Subject: [PATCH] Removed create-project and logo commands, now they are scripts --- commands/host/aljibe-assistant | 8 +- commands/host/aljibe-create-project | 185 ----------------------- commands/host/aljibe-logo | 28 ---- commands/host/includes/create_project.sh | 29 ++-- commands/host/includes/logo.sh | 1 + 5 files changed, 19 insertions(+), 232 deletions(-) delete mode 100755 commands/host/aljibe-create-project delete mode 100644 commands/host/aljibe-logo diff --git a/commands/host/aljibe-assistant b/commands/host/aljibe-assistant index be1a3cd..e05c187 100755 --- a/commands/host/aljibe-assistant +++ b/commands/host/aljibe-assistant @@ -19,9 +19,7 @@ fi show_logo create_project $AUTO -echo -e "\e[30;48;5;2m Aljibe is now installed, you can access your site here:\e[0m" -ddev drush uli +ddev status -## echo "Removing aljibe assistant addon" -## Autoremove assistant -## ddev get --remove ddev-aljibe-assistant +echo -e "\e[30;48;5;2m Aljibe is now installed, you can access your site here:\e[0m" +ddev drush uli \ No newline at end of file diff --git a/commands/host/aljibe-create-project b/commands/host/aljibe-create-project deleted file mode 100755 index ad5bbfe..0000000 --- a/commands/host/aljibe-create-project +++ /dev/null @@ -1,185 +0,0 @@ -#!/bin/bash -#ddev-generated - -## Description: Create and configure a project. -## Usage: aljibe-create-project -## Example: "ddev aljibe-create-project" -## ExecRaw: true - -# Constants -DRUSH_ALIASES_FOLDER="./drush/sites" - -CYAN='\033[0;36m' -GREEN='\033[0;32m' -NC='\033[0m' # No Color -PROJECT_NAME=${DDEV_PROJECT} - -if [ "$1" == "1" ]; then - AUTO=1 -else - AUTO=0 -fi - -# Process example files -processExampleFile() { - PATH=$1 - SUFFIX=$2 - declare -A REPLACEMENTS=$3 - cp "$PATH$SUFFIX" "$PATH" - for KEY in "${!REPLACEMENTS[@]}"; do - replaceInFile "$PATH" "$KEY" "${REPLACEMENTS[$KEY]}" - done -} - -# Setup several configuration files -setConfFiles() { - cd ${DDEV_APPROOT} || exit - - if [ "$AUTO" == "0" ]; then - echo -e "${CYAN}Please enter the project name (default to ${DDEV_PROJECT}):${NC}" - read PROJECT_NAME_INPUT - fi - - ddev config --php-version 8.3 - - echo "Configuring ddev environment" - - if [ -z "$PROJECT_NAME_INPUT" ]; then - PROJECT_NAME_INPUT=${DDEV_PROJECT} - fi - - PROJECT_NAME=$PROJECT_NAME_INPUT - - echo "Configuring ddev project $PROJECT_NAME" - ddev config --project-type=drupal --project-name $PROJECT_NAME --docroot 'web' --auto - - echo "Preparing Aljibe config file" - cp ${DDEV_APPROOT}/.ddev/aljibe.yaml.example ${DDEV_APPROOT}/.ddev/aljibe.yaml - sed -i "s/default_site\: self/default_site\: $PROJECT_NAME/g" ${DDEV_APPROOT}/.ddev/aljibe.yaml - - echo "Copying Aljibe Kickstart project files" - ddev aljibe-kickstart --yes - - echo "Setting up Drush aliases file" - cp "$DRUSH_ALIASES_FOLDER/sitename.site.yml.example" "$DRUSH_ALIASES_FOLDER/$PROJECT_NAME.site.yml" - sed -i "s/example/$PROJECT_NAME/g" $DRUSH_ALIASES_FOLDER/$PROJECT_NAME.site.yml - - echo "Setting up behat.yml file" - sed -i "s/example/$PROJECT_NAME/g" ./behat.yml - - echo "Setting up BackstopJS' cookies.json file" - sed -i "s/example/$PROJECT_NAME/g" ./tests/functional/backstopjs/backstop_data/engine_scripts/cookies.json - - echo "Setting up phpunit.xml" - cp "./phpunit.xml.dist" "./phpunit.xml" - -# echo "Setting up phpcs.xml" -# cp "./phpcs.xml.dist" "./phpcs.xml.dist" - - echo "Setting up phpmd.xml" - cp "./phpmd.xml.dist" "./phpmd.xml" -} - -# Setup git repo -setUpGit() { - if [ "$AUTO" == "0" ]; then - echo -e "${CYAN}Do you want to initialize a git repository for your new project?${NC} [Y/n]" - read INITIALIZE_GIT - else - INITIALIZE_GIT="n" - fi - - if [ "$INITIALIZE_GIT" != "n" ]; then - ## Init with main branch - git init -b main - ## Create develop branch - git checkout -b develop - fi -} - -initDdev() { - ddev start - ddev composer install -} - -initGrumpPhp() { - ddev exec grumphp git:init -} - -installDrupal() { - if [ "$AUTO" == "0" ]; then - echo -e "${CYAN}Do you want to install Drupal?${NC} [Y/n]" - read INSTALL_DRUPAL - if [ "$INSTALL_DRUPAL" != "n" ]; then - AVAILABLE_PROFILES=("minimal" "standard" "demo_umami") - echo -e "${CYAN}What install profile you want to install?${NC}" - select PROFILE in "${AVAILABLE_PROFILES[@]}"; do - echo "Installing profile $PROFILE" - ddev drush -y si $PROFILE - ddev drush cr - break - done - fi - else - PROFILE="standard" - echo "Installing profile $PROFILE" - ddev drush -y si $PROFILE - ddev drush cr - fi -} - -createDirectories() { - BEHAT_DIR="./web/sites/default/files/behat" - BEHAT_DIR_ERRORS="$BEHAT_DIR/errors" - - if [ ! -d "$BEHAT_DIR" ]; then - mkdir -p "$BEHAT_DIR" - chmod 755 "$BEHAT_DIR" - fi - - if [ ! -d "$BEHAT_DIR_ERRORS" ]; then - mkdir -p "$BEHAT_DIR_ERRORS" - chmod 755 "$BEHAT_DIR_ERRORS" - fi -} - -createSubTheme() { - if [ "$AUTO" == "0" ]; then - echo -e "${CYAN}Do you want to create a Radix sub-theme?${NC} [Y/n] " - read CREATE_SUB_THEME - else - CREATE_SUB_THEME="n" - fi - - if [ "$CREATE_SUB_THEME" != "n" ]; then - DEFAULT_THEME_NAME=$(echo "${PROJECT_NAME}_radix" | tr '-' '_') - echo -e "${CYAN}Please enter the new theme name (default to ${DEFAULT_THEME_NAME})?${NC}" - read THEME_NAME - if [ -z "$THEME_NAME" ]; then - THEME_NAME="${DEFAULT_THEME_NAME}" - fi - THEME_NAME=$(echo "$THEME_NAME" | tr -dc '[:alnum:]_') - ddev drush en components - ddev drush theme:enable radix -y - ddev drush --include="web/themes/contrib/radix" radix:create $THEME_NAME - ddev drush theme:enable $THEME_NAME -y - ddev drush config-set system.theme default $THEME_NAME -y - # Add theme to aljibe.yml - sed -i "s/custom_theme/$THEME_NAME/g" ${DDEV_APPROOT}/.ddev/aljibe.yaml - ddev restart - ddev frontend dev - fi -} - - - -echo -e "${GREEN}Launching assistant to configure the environment${NC}" -echo "" - -setConfFiles -setUpGit -initDdev -installDrupal -createDirectories -createSubTheme -initGrumpPhp diff --git a/commands/host/aljibe-logo b/commands/host/aljibe-logo deleted file mode 100644 index e085fc3..0000000 --- a/commands/host/aljibe-logo +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash -#ddev-generated - -## Description: Show Aljibe logo. -## Usage: aljibe-logo -## Example: "ddev aljibe-logo" - -# ANSI color codes -brown='\033[0;33m' -NC='\033[0m' # No Color - -# ASCII art with brown color -echo "" -echo "" -echo -e "${brown}" -cat << EOF - ___ _ _ _ _ - / _ \| (_|_) | -/ /_\ \ |_ _| |__ ___ -| _ | | | | '_ \ / _ \\ -| | | | | | | |_) | __/ -\_| |_/_| |_|_.__/ \___| - _/ | - |__/ - by Metadrop -EOF -echo -e "${NC}" # Reset color -echo "" diff --git a/commands/host/includes/create_project.sh b/commands/host/includes/create_project.sh index 9fe2639..7f9bd3f 100644 --- a/commands/host/includes/create_project.sh +++ b/commands/host/includes/create_project.sh @@ -1,4 +1,5 @@ #!/bin/bash +# ddev-generated # Constants DRUSH_ALIASES_FOLDER="./drush/sites" @@ -14,13 +15,13 @@ create_project() { echo -e "${GREEN}Launching assistant to configure the environment${NC}" echo "" - setConfFiles - setUpGit - initDdev - installDrupal - createDirectories - createSubTheme - initGrumpPhp + configure_project + setup_git + init_ddev + install_drupal + create_behat_directories + create_sub_theme + init_grumphp } # Process example files @@ -35,7 +36,7 @@ processExampleFile() { } # Setup several configuration files -setConfFiles() { +configure_project() { cd ${DDEV_APPROOT} || exit if [ "$AUTO" == "0" ]; then @@ -81,7 +82,7 @@ setConfFiles() { } # Setup git repo -setUpGit() { +setup_git() { if [ "$AUTO" == "0" ]; then echo -e "${CYAN}Do you want to initialize a git repository for your new project?${NC} [Y/n]" read INITIALIZE_GIT @@ -97,16 +98,16 @@ setUpGit() { fi } -initDdev() { +init_ddev() { ddev start ddev composer install } -initGrumpPhp() { +init_grumphp() { ddev exec grumphp git:init } -installDrupal() { +install_drupal() { if [ "$AUTO" == "0" ]; then echo -e "${CYAN}Do you want to install Drupal?${NC} [Y/n]" read INSTALL_DRUPAL @@ -128,7 +129,7 @@ installDrupal() { fi } -createDirectories() { +create_behat_directories() { BEHAT_DIR="./web/sites/default/files/behat" BEHAT_DIR_ERRORS="$BEHAT_DIR/errors" @@ -143,7 +144,7 @@ createDirectories() { fi } -createSubTheme() { +create_sub_theme() { if [ "$AUTO" == "0" ]; then echo -e "${CYAN}Do you want to create a Radix sub-theme?${NC} [Y/n] " read CREATE_SUB_THEME diff --git a/commands/host/includes/logo.sh b/commands/host/includes/logo.sh index da11ba1..ded4a2e 100644 --- a/commands/host/includes/logo.sh +++ b/commands/host/includes/logo.sh @@ -1,4 +1,5 @@ #!/bin/bash +# ddev-generated # ANSI color codes brown='\033[0;33m'