Delete all shell script files, keeping only Python versions

Co-authored-by: jmiller-moko <230051081+jmiller-moko@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-01-04 08:21:25 +00:00
parent c471225a93
commit 09989a386c
29 changed files with 0 additions and 4440 deletions

View File

@@ -1,213 +0,0 @@
#!/usr/bin/env bash
# ============================================================================
# Copyright (C) 2025 Moko Consulting <hello@mokoconsulting.tech>
#
# This file is part of a Moko Consulting project.
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program (./LICENSE.md).
# ============================================================================
# ============================================================================
# FILE INFORMATION
# ============================================================================
# DEFGROUP: Script.Release
# INGROUP: Extension.Packaging
# REPO: https://github.com/mokoconsulting-tech/moko-cassiopeia
# PATH: /scripts/release/package_extension.sh
# VERSION: 01.00.00
# BRIEF: Package Joomla extension as distributable ZIP
# USAGE: ./scripts/release/package_extension.sh [output_dir] [version]
# ============================================================================
set -euo pipefail
# Load shared library functions (optional)
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
LIB_DIR="${SCRIPT_DIR}/../lib"
# Configuration
SRC_DIR="${SRC_DIR:-src}"
OUTPUT_DIR="${1:-dist}"
VERSION="${2:-}"
REPO_NAME="${REPO_NAME:-$(basename "$(git rev-parse --show-toplevel)")}"
json_escape() {
python3 -c 'import json,sys; print(json.dumps(sys.argv[1]))' "$1"
}
log_info() {
echo "[INFO] $*" >&2
}
log_error() {
echo "[ERROR] $*" >&2
}
# Validate prerequisites
validate_prerequisites() {
if [ ! -d "${SRC_DIR}" ]; then
log_error "Source directory '${SRC_DIR}' not found"
printf '{"status":"fail","error":%s}\n' "$(json_escape "src directory missing")"
exit 1
fi
if ! command -v zip >/dev/null 2>&1; then
log_error "zip command not found. Please install zip utility."
printf '{"status":"fail","error":%s}\n' "$(json_escape "zip command not found")"
exit 1
fi
}
# Find and validate manifest
find_manifest_file() {
local manifest=""
# Priority order for finding manifest
if [ -f "${SRC_DIR}/templateDetails.xml" ]; then
manifest="${SRC_DIR}/templateDetails.xml"
elif [ -f "${SRC_DIR}/templates/templateDetails.xml" ]; then
manifest="${SRC_DIR}/templates/templateDetails.xml"
else
# Try finding any Joomla manifest
manifest=$(find "${SRC_DIR}" -maxdepth 3 -type f \( \
-name 'templateDetails.xml' -o \
-name 'pkg_*.xml' -o \
-name 'mod_*.xml' -o \
-name 'com_*.xml' -o \
-name 'plg_*.xml' \
\) | head -n 1)
fi
if [ -z "${manifest}" ]; then
log_error "No Joomla manifest XML found in ${SRC_DIR}"
printf '{"status":"fail","error":%s}\n' "$(json_escape "manifest not found")"
exit 1
fi
echo "${manifest}"
}
# Extract extension metadata from manifest
get_extension_metadata() {
local manifest="$1"
local ext_type=""
local ext_name=""
local ext_version=""
# Extract extension type
ext_type=$(grep -Eo 'type="[^"]+"' "${manifest}" | head -n 1 | cut -d '"' -f2 || echo "unknown")
# Extract extension name
ext_name=$(grep -oP '<name>\K[^<]+' "${manifest}" | head -n 1 || echo "unknown")
# Extract version
ext_version=$(grep -oP '<version>\K[^<]+' "${manifest}" | head -n 1 || echo "unknown")
echo "${ext_type}|${ext_name}|${ext_version}"
}
# Create package
create_package() {
local manifest="$1"
local output_dir="$2"
local version="$3"
# Get extension metadata
local metadata
metadata=$(get_extension_metadata "${manifest}")
local ext_type=$(echo "${metadata}" | cut -d '|' -f1)
local ext_name=$(echo "${metadata}" | cut -d '|' -f2)
local manifest_version=$(echo "${metadata}" | cut -d '|' -f3)
# Use provided version or fall back to manifest version
if [ -z "${version}" ]; then
version="${manifest_version}"
fi
# Create output directory
mkdir -p "${output_dir}"
# Generate package filename
local timestamp=$(date +%Y%m%d-%H%M%S)
local zip_name="${REPO_NAME}-${version}-${ext_type}.zip"
# Get absolute path for zip file
local abs_output_dir
if [[ "${output_dir}" = /* ]]; then
abs_output_dir="${output_dir}"
else
abs_output_dir="$(pwd)/${output_dir}"
fi
local zip_path="${abs_output_dir}/${zip_name}"
log_info "Creating package: ${zip_name}"
log_info "Extension: ${ext_name} (${ext_type})"
log_info "Version: ${version}"
# Create ZIP archive excluding unnecessary files
(cd "${SRC_DIR}" && zip -r -q -X "${zip_path}" . \
-x '*.git*' \
-x '*/.github/*' \
-x '*.DS_Store' \
-x '*/__MACOSX/*' \
-x '*/node_modules/*' \
-x '*/vendor/*' \
-x '*/tests/*' \
-x '*/.phpunit.result.cache' \
-x '*/codeception.yml' \
-x '*/composer.json' \
-x '*/composer.lock' \
-x '*/package.json' \
-x '*/package-lock.json')
# Get file size
local zip_size
if command -v stat >/dev/null 2>&1; then
zip_size=$(stat -f%z "${zip_path}" 2>/dev/null || stat -c%s "${zip_path}" 2>/dev/null || echo "unknown")
else
zip_size="unknown"
fi
log_info "Package created successfully: ${zip_path}"
log_info "Package size: ${zip_size} bytes"
# Output JSON result
printf '{"status":"ok","package":%s,"type":%s,"version":%s,"size":%s,"manifest":%s}\n' \
"$(json_escape "${zip_path}")" \
"$(json_escape "${ext_type}")" \
"$(json_escape "${version}")" \
"${zip_size}" \
"$(json_escape "${manifest}")"
}
# Main execution
main() {
log_info "Starting Joomla extension packaging"
validate_prerequisites
local manifest
manifest=$(find_manifest_file)
log_info "Using manifest: ${manifest}"
create_package "${manifest}" "${OUTPUT_DIR}" "${VERSION}"
log_info "Packaging completed successfully"
}
# Run main function
main "$@"

View File

@@ -1,122 +0,0 @@
#!/usr/bin/env bash
# -----------------------------------------------------------------------------
# Copyright (C) 2025 Moko Consulting <hello@mokoconsulting.tech>
#
# This file is part of a Moko Consulting project.
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; either version 3 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License (./LICENSE).
# -----------------------------------------------------------------------------
# FILE INFORMATION
# DEFGROUP: MokoStandards
# INGROUP: Generic.Script
# REPO: https://github.com/mokoconsulting-tech/MokoStandards
# PATH: /scripts/update_changelog.sh
# VERSION: 01.00.00
# BRIEF: Insert a versioned CHANGELOG.md entry immediately after the main Changelog heading
# Purpose:
# - Apply the MokoWaaS-Brand CHANGELOG template entry for a given version.
# - Insert a new header at the top of CHANGELOG.md, immediately after "# Changelog".
# - Avoid duplicates if an entry for the version already exists.
# - Preserve the rest of the file verbatim.
#
# Usage:
# ./scripts/update_changelog.sh <VERSION>
#
# Example:
# ./scripts/update_changelog.sh 01.05.00
# =============================================================================
set -euo pipefail
CHANGELOG_FILE="CHANGELOG.md"
die() {
echo "ERROR: $*" 1>&2
exit 1
}
info() {
echo "INFO: $*"
}
require_cmd() {
command -v "$1" >/dev/null 2>&1 || die "Missing required command: $1"
}
validate/version() {
local v="$1"
[[ "$v" =~ ^[0-9]{2}\.[0-9]{2}\.[0-9]{2}$ ]] || die "Invalid version '$v'. Expected NN.NN.NN (example 03.01.00)."
}
main() {
require_cmd awk
require_cmd grep
require_cmd mktemp
require_cmd date
[[ $# -eq 1 ]] || die "Usage: $0 <VERSION>"
local version="$1"
validate/version "$version"
[[ -f "$CHANGELOG_FILE" ]] || die "Missing $CHANGELOG_FILE in repo root."
if ! grep -qE '^# Changelog[[:space:]]*$' "$CHANGELOG_FILE"; then
die "$CHANGELOG_FILE must contain a top level heading exactly: # Changelog"
fi
if grep -qE "^## \[$version\][[:space:]]" "$CHANGELOG_FILE"; then
info "CHANGELOG.md already contains an entry for version $version. No action taken."
exit 0
fi
local stamp
stamp="$(date '+%Y-%m-%d')"
local tmp
tmp="$(mktemp)"
trap 'rm -f "$tmp"' EXIT
awk -v v="$version" -v d="$stamp" '
BEGIN { inserted=0 }
{
print $0
if (inserted==0 && $0 ~ /^# Changelog[[:space:]]*$/) {
print ""
print "## [" v "] " d
print "- Version bump."
print ""
inserted=1
}
}
END {
if (inserted==0) {
exit 3
}
}
' "$CHANGELOG_FILE" > "$tmp" || {
rc=$?
if [[ $rc -eq 3 ]]; then
die "Insertion point not found. Expected: # Changelog"
fi
die "Failed to update $CHANGELOG_FILE (awk exit code $rc)."
}
mv "$tmp" "$CHANGELOG_FILE"
trap - EXIT
info "Inserted CHANGELOG.md entry for version $version on $stamp."
}
main "$@"

View File

@@ -1,131 +0,0 @@
#!/usr/bin/env bash
#
# Copyright (C) 2025 Moko Consulting <hello@mokoconsulting.tech>
#
# This file is part of a Moko Consulting project.
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
# FILE INFORMATION
# DEFGROUP: Release.Automation
# INGROUP: Date.Normalization
# REPO: https://github.com/mokoconsulting-tech/MokoStandards
# PATH: /scripts/release/update_dates.sh
# VERSION: 01.00.00
# BRIEF: Normalize release dates across manifests and CHANGELOG using a single authoritative UTC date.
# NOTE: Repo-controlled script only. CI-fatal on malformed inputs. Outputs a JSON report to stdout.
set -euo pipefail
TODAY_UTC="${1:-}"
VERSION="${2:-}"
usage() {
echo "ERROR: Usage: update_dates.sh <YYYY-MM-DD> <VERSION>" >&2
}
if [ -z "${TODAY_UTC}" ] || [ -z "${VERSION}" ]; then
usage
exit 1
fi
# Validate date format strictly
if ! echo "${TODAY_UTC}" | grep -Eq '^[0-9]{4}-[0-9]{2}-[0-9]{2}$'; then
echo "ERROR: Invalid date format. Expected YYYY-MM-DD, got '${TODAY_UTC}'" >&2
exit 1
fi
# Validate version format strictly
if ! echo "${VERSION}" | grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+$'; then
echo "ERROR: Invalid version format. Expected X.Y.Z, got '${VERSION}'" >&2
exit 1
fi
# Cross-platform sed in-place helper (GNU and BSD)
# - Ubuntu runners use GNU sed, but this keeps local execution deterministic.
sed_inplace() {
local expr="$1"
local file="$2"
if sed --version >/dev/null 2>&1; then
sed -i -E "${expr}" "${file}"
else
sed -i '' -E "${expr}" "${file}"
fi
}
echo "Normalizing dates to ${TODAY_UTC} for version ${VERSION}"
# Update CHANGELOG.md heading date
if [ ! -f CHANGELOG.md ]; then
echo "ERROR: CHANGELOG.md not found" >&2
exit 1
fi
if ! grep -Eq "^## \[${VERSION}\]" CHANGELOG.md; then
echo "ERROR: CHANGELOG.md does not contain heading for version [${VERSION}]" >&2
exit 1
fi
# Use a delimiter that will not collide with the pattern (the heading starts with "##")
sed_inplace "s|^(## \[${VERSION}\]) .*|\1 ${TODAY_UTC}|" CHANGELOG.md
# Update XML manifest dates
XML_SCANNED=0
XML_TOUCHED=0
while IFS= read -r -d '' FILE; do
XML_SCANNED=$((XML_SCANNED + 1))
BEFORE_HASH=""
AFTER_HASH=""
# Best-effort content hash for change detection without external deps.
if command -v sha256sum >/dev/null 2>&1; then
BEFORE_HASH="$(sha256sum "${FILE}" | awk '{print $1}')"
fi
# Use # delimiter because XML does not include # in these tags.
sed -i "s#<creationDate>[^<]*</creationDate>#<creationDate>${TODAY_UTC}</creationDate>#g" "${FILE}" || true
sed -i "s#<date>[^<]*</date>#<date>${TODAY_UTC}</date>#g" "${FILE}" || true
sed -i "s#<buildDate>[^<]*</buildDate>#<buildDate>${TODAY_UTC}</buildDate>#g" "${FILE}" || true
if [ -n "${BEFORE_HASH}" ]; then
AFTER_HASH="$(sha256sum "${FILE}" | awk '{print $1}')"
if [ "${BEFORE_HASH}" != "${AFTER_HASH}" ]; then
XML_TOUCHED=$((XML_TOUCHED + 1))
fi
fi
done < <(
find . -type f -name "*.xml" \
-not -path "./.git/*" \
-not -path "./.github/*" \
-not -path "./dist/*" \
-not -path "./node_modules/*" \
-print0
)
# JSON report to stdout (workflow can capture or include in summary)
printf '{"today_utc":"%s","version":"%s","changelog":"%s","xml_scanned":%s,"xml_touched":%s}
' \
"${TODAY_UTC}" \
"${VERSION}" \
"CHANGELOG.md" \
"${XML_SCANNED}" \
"${XML_TOUCHED}"
echo "Date normalization complete."