Skip to content

Commit

Permalink
Merge pull request #38 from mmaximo33/develop
Browse files Browse the repository at this point in the history
Release 2.2.x Add WordPress and Laravel environment, Add translation system
  • Loading branch information
mmaximo33 authored May 12, 2024
2 parents f545ab4 + 01d99be commit 08fdc93
Show file tree
Hide file tree
Showing 74 changed files with 1,406 additions and 228 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.idea
bin/.tmp
bin/config.env
bin/efde.sh
20 changes: 16 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,22 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.1/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [2.2.0] 2024-xx-xx

### Added
- EFDE: #32 Translation system (en_US es_ES pt_PT)
- Laravel: #5 Add new implemention
- Wordpress: #31 Add new implemention
- Symfony: #35 Add new version of Symfony 7.x

### Fixed

- EFDE
- #37 ASAP! EFDE does not run after installation from v2.1.0
- #36 Function info menu not aligned (Debug Mode)
- Symfony: #33 fix application directory permissions application
- MySQL: #3 General fixes for database import and export

## [2.1.0] 2024-03-04

### Added
Expand All @@ -20,10 +36,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Add configuration for default editor
- Improve mode management (debug and develop)

### Fixed

### Removed

## [2.0.0] 2024-01-15

### Changed
Expand Down
51 changes: 43 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@
![efde version](https://img.shields.io/badge/status-Active-green.svg)
![efde_lastcommin](https://img.shields.io/github/last-commit/mmaximo33/efde.svg)
![efde_release](https://img.shields.io/github/release/mmaximo33/efde.svg)
![efde_since release](https://img.shields.io/github/commits-since/mmaximo33/efde/2.0.0.svg)
![efde_since release](https://img.shields.io/github/commits-since/mmaximo33/efde/2.1.0.svg)
![efde_since release](https://img.shields.io/github/commits-since/mmaximo33/efde/1.2.0.svg)

![issue-open](https://img.shields.io/github/issues/mmaximo33/efde.svg)
![issue-close](https://img.shields.io/github/issues-closed/mmaximo33/efde.svg)
![pull-open](https://img.shields.io/github/issues-pr/mmaximo33/efde.svg)
![pull-close](https://img.shields.io/github/issues-pr-closed/mmaximo33/efde.svg)

![efde version](https://img.shields.io/badge/language-grey.svg) ![en_US](https://img.shields.io/badge/en.US-blue.svg) ![es_ES](https://img.shields.io/badge/es.ES-blue.svg) ![pt_PT](https://img.shields.io/badge/pt.PT-blue.svg)

## Index

- [Intro](#intro)
Expand All @@ -34,17 +36,16 @@ The objective of the project is to be able to manage implementations with docker
[![Docker](https://img.shields.io/badge/Docker-2CA5E0?style=for-the-badge&logo=docker&logoColor=white)](#)

[![Install PHP](https://img.shields.io/badge/PHP-777BB4?style=for-the-badge&logo=php&logoColor=white)](https://www.php.net/)
[![Install Symfony](https://img.shields.io/badge/Symfony-000?logo=symfony&logoColor=fff&style=for-the-badge)](docs/symfony.md)
[![Install Laravel](https://img.shields.io/badge/Laravel-FF2D20?style=for-the-badge&logo=laravel&logoColor=white)](console/implemention/laravel/docs/README.md)
[![Install Symfony](https://img.shields.io/badge/Symfony-000?logo=symfony&logoColor=fff&style=for-the-badge)](console/implemention/symfony/docs/README.md)
[![Install Wordpress](https://img.shields.io/badge/Wordpress-21759B?style=for-the-badge&logo=wordpress&logoColor=white)](console/implemention/wordpress/docs/README.md)

### Coming soon

[![Install Portainer.io](https://img.shields.io/badge/Portainer.io-105f8f?style=for-the-badge&logo=portainer&logoColor=white)](docs/developer.md)

[![Install PHP](https://img.shields.io/badge/PHP-777BB4?style=for-the-badge&logo=php&logoColor=white)](https://www.php.net/)
[![Install Magento](https://img.shields.io/badge/Magento-f06835?style=for-the-badge&logo=magento&logoColor=white)](docs/developer.md)
[![Install Laravel](https://img.shields.io/badge/Laravel-FF2D20?style=for-the-badge&logo=laravel&logoColor=white)](docs/developer.md)
[![Wordpress](https://img.shields.io/badge/Wordpress-21759B?style=for-the-badge&logo=wordpress&logoColor=white)](docs/developer.md)
[![Woocommerce](https://img.shields.io/badge/Woocommerce-8359b5?style=for-the-badge&logo=wordpress&logoColor=white)](docs/developer.md)
[![Prestashop](https://img.shields.io/badge/prestashop-%23DF0067.svg?&style=for-the-badge&logo=prestashop&logoColor=white)](docs/developer.md)

[![JavaScript](https://img.shields.io/badge/JavaScript-F7DF1E?style=for-the-badge&logo=javascript&logoColor=black)](docs/developer.md)
Expand Down Expand Up @@ -79,6 +80,40 @@ Anyway, if you want to know more, you can see the following list with the offici
[![Docker Compose](https://img.shields.io/badge/Docker_Compose-2CA5E0?style=for-the-badge&logo=docker&logoColor=white)](https://docs.docker.com/compose/install/other/)

### Install
#### Manual
For manual installation you must
<details>
<summary>Distro debian/ubuntu</summary>

```sh
mkdir -p ~/.efde
cd $_
git clone https://github.com/mmaximo33/EFDE.git .

ln -sfT $PWD/bin/efde.sh ~/bin/efde

# In case you want to test a branch
# git switch <branch>
```
</details>

<details>
<summary>In Windows</summary>

```sh
Coming soon
```
</details>

<details>
<summary>In MacOS</summary>

```sh
Coming soon
```
</details>

#### For script

Run the following command (**CURL** or **WGET**) to install **EFDE** on your computer

Expand All @@ -103,14 +138,14 @@ wget -qO- https://raw.githubusercontent.com/mmaximo33/efde/main/bin/install.sh |
- Go to the directory where you create your projects (example: `~/Domains`)
- Run `efde` in your command console

### Created with **EFDE
### Created with EFDE

- In case you are in a project created with **EFDE**. Example: `~/Domains/newproject`
- The menu for that implementation will be displayed (Symfony, Laravel, Magento, Wordpress, WooComerce, Prestashop, React, Angular, Vue, Others)

![efde symfony install](./docs/media/efde_symfony_install.gif)
![efde symfony install](./console/implemention/symfony/docs/media/install.gif)

![efde symfony use](./docs/media/efde_symfony_use.gif)
![efde symfony use](./console/implemention/symfony/docs/media/use.gif)

### Shortcuts

Expand Down
19 changes: 15 additions & 4 deletions bin/efde.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
set -euo pipefail

declare -gA GLOBAL_EFDE_CONFIG=(
[EFDE_MODE_DEBUG]=false # Debug Messages
[EFDE_MODE_DEVELOP]=false # MMTodo: Prepared for create tmps
[LANGUAGE_DEFAULT]="en_US"
[EFDE_MODE_DEBUG]=false # Debug Messages
[EFDE_MODE_DEVELOP]=false # MMTodo: Prepared for create tmps
)

resolve_absolute_dir() {
Expand Down Expand Up @@ -38,8 +39,18 @@ menu_implementation(){
fi
}

menu(){
generate_extra_elements(){
efde.tasks.config.check_config
common.core.generate_shortcuts_file

if [ "${GLOBAL_EFDE_CONFIG['EFDE_MODE_DEBUG']}" = "true" ]; then
if [ ${GLOBAL_EFDE_CONFIG['LANGUAGE_DEFAULT']} != "$(efde.tasks.config.get_var "EFDE_LANGUAGE")" ]; then
common.core.generate_transactions
fi
fi
}

menu(){
if ! efde.tasks.implemention.has_folder_implementation ; then
efde.tasks.menu.main
fi
Expand All @@ -48,12 +59,12 @@ menu(){
}

shortcuts(){
efde.tasks.config.check_config
common.tasks.shortcuts.target "$@"
}

main() {
init_dirs # IMPORTANT
generate_extra_elements
if [ $# -gt 0 ]; then
shortcuts "$@"
else
Expand Down
47 changes: 43 additions & 4 deletions console/common/core
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set -euo pipefail

_mod_.step(){
_mod_.msg_debug "#######################################################################"
_mod_.msg_debug "# LOAD MODULES "
_mod_.msg_debug "# LOAD $1 "
_mod_.msg_debug "-----------------------------------------------------------------------"
}

Expand Down Expand Up @@ -57,7 +57,7 @@ _mod_.load_module(){
local MODULE_NAME=$(basename "$PATH_MODULE")

local elements=("props" "tasks")
_mod_.step
_mod_.step "MODULES"
_mod_.msg_debug "Module: $MODULE_NAME" 1

for element in "${elements[@]}"; do
Expand Down Expand Up @@ -116,6 +116,10 @@ _mod_.replacemod () {
sed -E "s/_mod_([a-zA-Z_][a-zA-Z0-9_]*)/${NEW_NAME_VAR}_\1/g" "$SOURCE_PATH" > "$PATH_TARGET"
fi

# translation
#sed -i "s/Select an option/hola/g" "$PATH_TARGET"


if [ ! $? -eq 0 ]; then
_mod_.msg_danger "[ERROR] The conversion could not be carried out, report this!" 4
_mod_.msg_danger "Source: $SOURCE_PATH" 5
Expand All @@ -133,7 +137,6 @@ _mod_.replacemod () {
fi
}

# Función para extraer valores
_mod_.generate_shortcuts_file() {
local TARGET_SHORTCUTS="$DIRECTORY_TMP/common.props.shortcuts"

Expand All @@ -157,8 +160,44 @@ _mod_.generate_shortcuts_file() {
echo ")" >> "$TARGET_SHORTCUTS"

source $TARGET_SHORTCUTS
_mod_.step "SHORTCUTS"
_mod_.msg_debug "Shortcuts file created in $TARGET_SHORTCUTS"
}


# MMTodo:
# Improve this feature so that
# - Take all characters enclosed in double quotes (\n or \")
# - Do not consider spaces between origin and destination ("origin", "destination")
_mod_.generate_transactions(){
local PATH_TO_INSPECT="${1:-$PATH_CONSOLE}"
local LANGUAGE_DEFAULT=${GLOBAL_EFDE_CONFIG['LANGUAGE_DEFAULT']}
local LANGUAGE_CONFIG=$(efde.tasks.config.get_var "EFDE_LANGUAGE")
if [ "$LANGUAGE_DEFAULT" != "$LANGUAGE_CONFIG" ]; then
DIRECTORIES=$(find "$PATH_TO_INSPECT" -maxdepth 1 -type d ! -path "$PATH_TO_INSPECT" ! -name "$(basename "$PATH_TO_INSPECT")" -printf "%f\n")
for DIRECTORY in $DIRECTORIES; do

local PATH_TARGET="$PATH_TO_INSPECT/$DIRECTORY"
local PATH_TASKS_EXISTS="$PATH_TARGET/tasks"

if [ ! -d "$PATH_TASKS_EXISTS" ]; then
_mod_.generate_transactions "$PATH_TARGET"
else
local FILE_i18n="$PATH_TARGET/i18n/$LANGUAGE_CONFIG"
if common.tasks.file.exists "$FILE_i18n"; then
while IFS= read -r line || [ -n "$line" ]; do
[ -z "$line" ] && continue

line=$(echo "$line" | sed 's/^"//; s/"$//')
text_old=$(echo "$line" | awk -F '","' '{print $1}')
text_new=$(echo "$line" | awk -F '","' '{print $2}')

if [ -n "$text_old" ] && [ -n "$text_new" ]; then
find "$DIRECTORY_TMP" -type f -name "$DIRECTORY.*" -exec sh -c "sed -i 's#$text_old#$text_new#g' {};" \;
fi
done < "$FILE_i18n"
fi
fi
done
fi
}

14 changes: 14 additions & 0 deletions console/common/i18n/es_ES
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
"Select an option","Seleccione una opción"
"Error: Path '$PATH' does not exist.","Error: El path '$PATH' no existe."
"Delete FOLDER","Eliminar DIRECTORIO"
"Confirm this action by writing '$CONFIRM_COLOR':","Confirme esta accion escribiendo '$CONFIRM_COLOR':"
"We are about to delete the directory","Estamos a punto de eliminar el directorio"
"We are about to delete the file","Estamos a punto de eliminar el archivo"
"Removed: $PATH","Eliminado: $PATH"
"Removal aborted.","Eliminación cancelada."
"Enter the url of your repository\nEnter URL (https):","Ingrese la url de su repositorio\nIngresar URL (https):"
"Press R to return | Q to quit | I for info","Presionar R para volver | Q para salir | I mas informacion"
"Enter the option number:","Ingresar numero de opción:"
"The '$choice' option is not in the list.","La opción '$choice' no esta en la lista."
"But we found some that may match the desired action:","Pero encontramos algunos que podrian coincidir con la action:"
"The shortcut is not registered:","El shortcut no esta registrado:"
14 changes: 14 additions & 0 deletions console/common/i18n/pt_PT
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
"Select an option","Selecione uma opção"
"Error: Path '$PATH' does not exist.","Erro: O caminho '$PATH' não existe."
"Delete FOLDER","Excluir PASTA"
"Confirm this action by writing '$CONFIRM_COLOR':","Confirme esta ação escrevendo '$CONFIRM_COLOR':"
"We are about to delete the directory","Estamos prestes a excluir o diretório"
"We are about to delete the file","Estamos prestes a excluir o arquivo"
"Removed: $PATH","Removido: $PATH"
"Removal aborted.","Remoção cancelada."
"Enter the url of your repository\nEnter URL (https):","Digite o URL do seu repositório\nDigite o URL (https):"
"Press R to return | Q to quit | I for info","Pressione R para retornar | Q para sair | I para informações"
"Enter the option number:","Digite o número da opção:"
"The '$choice' option is not in the list.","A opção '$choice' não está na lista."
"But we found some that may match the desired action:","Mas encontramos algumas que podem corresponder à ação desejada:"
"The shortcut is not registered:","O atalho não está registrado:"
2 changes: 1 addition & 1 deletion console/common/tasks/command_line
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ _mod_.run() {
if [ "${FORCE_SHOW_OUTPUT}" = "true" ]; then
eval "${COMMAND_LINE}"
else
eval "${COMMAND_LINE}" > /dev/null 2>&1
eval "${COMMAND_LINE}" > /dev/null 2>&1
fi
}

Expand Down
8 changes: 8 additions & 0 deletions console/common/tasks/git
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
set -euo pipefail

_mod_.request_url_and_clone_repository(){
local REPOSITORY_REQUEST_URL=$(common.tasks.message.msg_color warning "Enter the url of your repository\nEnter URL (https):")
local REPOSITORY_URL=$(common.tasks.prompt.request_input "$REPOSITORY_REQUEST_URL")
common.tasks.command_line.run true false "git clone $REPOSITORY_URL $(pwd)/app"
}
23 changes: 12 additions & 11 deletions console/common/tasks/menu
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ declare -gA GLOBAL_MENU_RESPONSE_ARRAY_ASOCITIVE #VARIABLE GLOBAL - HIGH SOLUTIO

_mod_.msg_debug() {
if [[ "${GLOBAL_EFDE_CONFIG['EFDE_MODE_DEBUG']}" = "true" ]]; then
common.msg_debug "#######################################################################"
common.msg_debug "# MENU "
common.msg_debug "GLOBAL_MENU_RESPONSE_ARRAY_ASOCITIVE:" 1
common.msg_debug "title: ${GLOBAL_MENU_RESPONSE_ARRAY_ASOCITIVE['title']}" 2
common.msg_debug "description: ${GLOBAL_MENU_RESPONSE_ARRAY_ASOCITIVE['description']}" 2
common.msg_debug "functions:" 2
common.msg_debug "new: ${GLOBAL_MENU_RESPONSE_ARRAY_ASOCITIVE['function']}" 3
common.msg_debug "old: ${GLOBAL_MENU_RESPONSE_ARRAY_ASOCITIVE['function_old']}" 3 1
common.msg_debug "-----------------------------------------------------------------------"
common.core.msg_debug "#######################################################################"
common.core.msg_debug "# MENU "
common.core.msg_debug "GLOBAL_MENU_RESPONSE_ARRAY_ASOCITIVE:" 1
common.core.msg_debug "title: ${GLOBAL_MENU_RESPONSE_ARRAY_ASOCITIVE['title']}" 2
common.core.msg_debug "description: ${GLOBAL_MENU_RESPONSE_ARRAY_ASOCITIVE['description']}" 2
common.core.msg_debug "functions:" 2
common.core.msg_debug "new: ${GLOBAL_MENU_RESPONSE_ARRAY_ASOCITIVE['function']}" 3
common.core.msg_debug "old: ${GLOBAL_MENU_RESPONSE_ARRAY_ASOCITIVE['function_old']}" 3 1
common.core.msg_debug "-----------------------------------------------------------------------"
fi
}

Expand All @@ -36,12 +36,13 @@ _mod_.print_options(){
local TITULO=$(echo ${VALUES[2]})
local DESCRIPTION=$(echo ${VALUES[3]:-${VALUES[2]}})
if [ "${GLOBAL_EFDE_CONFIG['EFDE_MODE_DEVELOP']}" = "true" ] ; then
VALUES[1]=$(echo "${VALUES[1]}" | sed 's/ //g')
local DESCRIPTION=$(common.tasks.message.echo debug "${VALUES[1]}")
fi

printf "%-0s. %-25s %s\n" "$i" "$TITULO" "$DESCRIPTION"
else
common.tasks.message.warning "\nInvalid menu option: Requieres minimum: \"shortcut, function, name\" \n- For: $OPTION"
common.tasks.message.warning "\nInvalid menu option: Requieres minimum: \'shortcut, function, name\' \n- For: $OPTION"
fi
done
}
Expand Down Expand Up @@ -99,7 +100,7 @@ _mod_.chosen_option(){
GLOBAL_MENU_RESPONSE_ARRAY_ASOCITIVE['description']="${VALUES[3]:-${VALUES[2]}}"

else
common.tasks.message.danger "Error: Formato de entrada incorrecto"
common.tasks.message.danger "Error: Incorrect input format"
exit 1
fi
}
Expand Down
1 change: 1 addition & 0 deletions console/common/tasks/shortcuts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ _mod_.find(){

_mod_.show(){
local PREV_TITLE=""
local MODE="info"

[[ "${GLOBAL_EFDE_CONFIG['EFDE_MODE_DEBUG']}" = "true" || "${GLOBAL_EFDE_CONFIG['EFDE_MODE_DEVELOP']}" = "true" ]] && MODE="debug"
common.tasks.message.echo $MODE "$(printf '%.s═' {1..45})"
Expand Down
Loading

0 comments on commit 08fdc93

Please sign in to comment.