refactor: Split configuration into globals.env and registry.sh

This commit is contained in:
Matteo Cherubini 2026-05-09 17:25:36 +02:00
parent b55084acc4
commit 7f10a4f770
5 changed files with 16 additions and 10 deletions

View file

@ -6,7 +6,8 @@
set -euo pipefail
source "lib/output.sh"
source "config.env"
source "globals.env"
source "registry.sh"
GENOME_NAME="${1:-}"
GENOME_DESC="${2:-}"
@ -19,10 +20,8 @@ fi
step "Adding New Genome: ${GENOME_NAME}"
# Sovrascrivo l'array per la sessione corrente
GENOMES=("${GENOME_NAME}|${GENOME_DESC}")
# FIX BUG 2: Uso source invece di bash per mantenere il context dell'array
source "scripts/setup-genomes.sh"
success "Genome '${GENOME_NAME}' added and linked successfully!"

View file

@ -2,13 +2,14 @@
# =============================================================================
# scripts/lint-genomes.sh
# Executes quality control across all registered genomes.
# Iterates from the GENOMES registry in config.env — not from filesystem patterns —
# Iterates from the GENOMES registry in registry.sh — not from filesystem patterns —
# so all genomes are covered regardless of their naming convention.
# =============================================================================
set -euo pipefail
source "lib/output.sh"
source "config.env"
source "globals.env"
source "registry.sh"
source "lib/lint.sh"
step "Starting Knowledge Genome Linting"

View file

@ -6,7 +6,12 @@
set -euo pipefail
source "lib/output.sh"
source "config.env"
source "globals.env"
if [[ -z "${WORK_DIR:-}" ]]; then
source "registry.sh"
fi
source "lib/scaffold.sh"
source "lib/git-crypt.sh"
source "providers/${PROVIDER}.sh"
@ -29,7 +34,6 @@ for entry in "${GENOMES[@]}"; do
cd "${WORK_DIR}/${MASTER_REPO}"
info "Linking ${GENOME_NAME} as a submodule..."
# FIX BUG 1: Adding the submodule clones the empty remote repository
git submodule add "${SSH_URL}" "${GENOME_NAME}"
cd "${GENOME_NAME}"

View file

@ -6,7 +6,8 @@
set -euo pipefail
source "lib/output.sh"
source "config.env"
source "globals.env"
source "registry.sh"
source "lib/scaffold.sh"
source "providers/${PROVIDER}.sh" # Required for remote creation

View file

@ -10,7 +10,8 @@ set -euo pipefail
# Resolve script directory and source core components
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
source "${SCRIPT_DIR}/lib/output.sh"
source "${SCRIPT_DIR}/config.env"
source "${SCRIPT_DIR}/globals.env"
source "${SCRIPT_DIR}/registry.sh"
source "${SCRIPT_DIR}/lib/deps.sh"
step "Starting Knowledge Genome Setup"
@ -24,7 +25,7 @@ check_git_identity
info "Initializing Master Repository..."
bash "${SCRIPT_DIR}/scripts/setup-master.sh"
# 3. Genomes Provisioning (as defined in config.env)
# 3. Genomes Provisioning (as defined in registry.sh)
info "Provisioning registered Genomes..."
bash "${SCRIPT_DIR}/scripts/setup-genomes.sh"