8f45b40528
12 funciones Bash del dominio shell: utilidades de scripting (bash_log, bash_colors, bash_check_deps, bash_confirm, bash_handle_error, bash_safe_run), manipulacion de texto (convert_text_case), estructura de proyectos (create_project_structure), y operaciones git (git_clean_branches, git_log_visual, git_push_all_remotes, git_repo_status). Cada una con su .sh y .md de frontmatter.
115 lines
3.2 KiB
Bash
115 lines
3.2 KiB
Bash
#!/usr/bin/env bash
|
|
# create_project_structure
|
|
# ------------------------
|
|
# Crea la estructura de directorios estándar de un proyecto funcional
|
|
# (database, dist, docker, docs, frontend, logs, notebooks, robots,
|
|
# scripts, src con application/core/middleware) en el directorio indicado.
|
|
#
|
|
# USO:
|
|
# source create_project_structure.sh
|
|
# create_project_structure project_name
|
|
#
|
|
# ARGUMENTOS:
|
|
# project_name Nombre del proyecto / ruta destino (requerido)
|
|
|
|
create_project_structure() {
|
|
local project_name="${1:-}"
|
|
|
|
if [[ -z "$project_name" ]]; then
|
|
echo "create_project_structure: se requiere el nombre del proyecto" >&2
|
|
echo " Uso: create_project_structure <project_name>" >&2
|
|
return 1
|
|
fi
|
|
|
|
local destino="$project_name"
|
|
|
|
local directories=(
|
|
"database"
|
|
"database/attachments"
|
|
"database/attachments/audio"
|
|
"database/attachments/docs"
|
|
"database/attachments/images"
|
|
"database/attachments/video"
|
|
"database/data"
|
|
"database/data/01_raw"
|
|
"database/data/02_clean"
|
|
"database/data/03_objects"
|
|
"database/data/04_answers"
|
|
"database/models"
|
|
"dist"
|
|
"dist/desktop"
|
|
"dist/desktop/linux"
|
|
"dist/desktop/mac"
|
|
"dist/desktop/win"
|
|
"dist/docker"
|
|
"dist/mobile"
|
|
"dist/mobile/android"
|
|
"dist/mobile/ios"
|
|
"docker"
|
|
"docs"
|
|
"docs/documentation"
|
|
"docs/pdf"
|
|
"frontend"
|
|
"logs"
|
|
"notebooks"
|
|
"robots"
|
|
"scripts"
|
|
"src"
|
|
"src/application"
|
|
"src/application/event"
|
|
"src/application/jobs"
|
|
"src/application/pipes"
|
|
"src/application/sandbox"
|
|
"src/application/simulation"
|
|
"src/application/tasks"
|
|
"src/application/tests"
|
|
"src/application/tests/benchmark"
|
|
"src/application/tests/fuzzers"
|
|
"src/application/tests/mocks"
|
|
"src/application/tests/mutation"
|
|
"src/core"
|
|
"src/core/base"
|
|
"src/core/functions"
|
|
"src/core/rules"
|
|
"src/core/tests"
|
|
"src/core/tests/benchmark"
|
|
"src/core/tests/fuzzers"
|
|
"src/core/tests/mocks"
|
|
"src/core/tests/mutation"
|
|
"src/core/types"
|
|
"src/core/utils"
|
|
"src/middleware"
|
|
"src/middleware/api"
|
|
"src/middleware/backend"
|
|
"src/middleware/browser"
|
|
"src/middleware/config"
|
|
"src/middleware/connection"
|
|
"src/middleware/controller"
|
|
"src/middleware/i18n"
|
|
"src/middleware/interfaces"
|
|
"src/middleware/queue"
|
|
"src/middleware/servers"
|
|
"src/middleware/tests"
|
|
"src/middleware/tests/benchmark"
|
|
"src/middleware/tests/fuzzers"
|
|
"src/middleware/tests/mocks"
|
|
"src/middleware/tests/mutation"
|
|
"src/middleware/types"
|
|
"src/modules"
|
|
)
|
|
|
|
echo "Creando estructura del proyecto: ${destino}"
|
|
|
|
for dir in "${directories[@]}"; do
|
|
mkdir -p "${destino%/}/${dir}"
|
|
done
|
|
|
|
echo "Estructura creada en: ${destino%/}"
|
|
echo " ${#directories[@]} directorios creados."
|
|
}
|
|
|
|
# Ejecutar si se invoca directamente
|
|
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
|
|
create_project_structure "$@"
|
|
fi
|