From 24dc3cd128ae487a2ef20f2f33b464898798f631 Mon Sep 17 00:00:00 2001 From: Julio Castillo Date: Sat, 20 Dec 2025 09:08:42 +0000 Subject: [PATCH] feat: formalize headers and --- scripts/build.sh | 12 ++++++++++-- scripts/coverage.sh | 14 +++++++++++--- scripts/docker/attach.sh | 13 +++++++++---- scripts/docker/build_image.sh | 0 scripts/docker/entrypoint.sh | 14 +++++++++++++- scripts/docker/run.sh | 13 +++++++++---- scripts/docs.sh | 9 +++++++++ scripts/format.sh | 18 ++++++++++-------- scripts/lint.sh | 11 ++++++++--- scripts/package.sh | 14 +++++++++++--- 10 files changed, 90 insertions(+), 28 deletions(-) mode change 100644 => 100755 scripts/docker/attach.sh mode change 100644 => 100755 scripts/docker/build_image.sh mode change 100644 => 100755 scripts/docker/entrypoint.sh diff --git a/scripts/build.sh b/scripts/build.sh index 079dcf8..d5c03a9 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -1,6 +1,14 @@ -#!/bin/bash +#!/usr/bin/env bash +set -e -set -e # Exit on error +############################################################################### +# Build the project using CMake +# +# Builds in Debug mode by default and installs to the install/ directory. +# +# Usage: +# ./scripts/build.sh +############################################################################### # Set build directory BUILD_DIR="build" diff --git a/scripts/coverage.sh b/scripts/coverage.sh index 8a7a989..f6b1a81 100755 --- a/scripts/coverage.sh +++ b/scripts/coverage.sh @@ -1,6 +1,14 @@ -#!/bin/bash - -set -e # Exit on error +#!/usr/bin/env bash +set -e + +############################################################################### +# Build and run code coverage analysis +# +# Builds with coverage enabled, runs tests, and generates HTML coverage report. +# +# Usage: +# ./scripts/coverage.sh +############################################################################### # Set build directory BUILD_DIR="build" diff --git a/scripts/docker/attach.sh b/scripts/docker/attach.sh old mode 100644 new mode 100755 index 8e14755..dd84f5c --- a/scripts/docker/attach.sh +++ b/scripts/docker/attach.sh @@ -1,10 +1,15 @@ #!/usr/bin/env bash set -e -# ------------------------------------------------------------------------------ -# Attach to the running cpp-dev container as 'ubuntu' (remapped UID/GID) -# Fails if the container is not running (expected behavior). -# ------------------------------------------------------------------------------ +############################################################################### +# Attach to the running cpp-dev container +# +# Attaches to the running container as 'ubuntu' user (remapped UID/GID). +# Fails if the container is not running. +# +# Usage: +# ./scripts/docker/attach.sh +############################################################################### CONTAINER_NAME="cpp-dev-${USER}" diff --git a/scripts/docker/build_image.sh b/scripts/docker/build_image.sh old mode 100644 new mode 100755 diff --git a/scripts/docker/entrypoint.sh b/scripts/docker/entrypoint.sh old mode 100644 new mode 100755 index 5df6d28..07db16d --- a/scripts/docker/entrypoint.sh +++ b/scripts/docker/entrypoint.sh @@ -1,10 +1,22 @@ -#!/bin/bash +#!/usr/bin/env bash set -e +############################################################################### +# Docker entrypoint script for UID/GID remapping +# +# Remaps the ubuntu user's UID/GID at runtime to match the host user. +# This ensures proper file permissions for mounted volumes. +# +# Environment variables: +# HOST_UID - Host user ID to remap to (default: 1000) +# HOST_GID - Host group ID to remap to (default: 1000) +############################################################################### + # Get host UID/GID from environment (defaults to 1000 if not set) HOST_UID=${HOST_UID:-1000} HOST_GID=${HOST_GID:-1000} +# Container user (hardcoded to 'ubuntu' to match Ubuntu base image convention) CONTAINER_USER=ubuntu echo "Remapping '$CONTAINER_USER' to UID=$HOST_UID, GID=$HOST_GID" diff --git a/scripts/docker/run.sh b/scripts/docker/run.sh index 7dfeb4f..4bcdb33 100644 --- a/scripts/docker/run.sh +++ b/scripts/docker/run.sh @@ -1,10 +1,15 @@ #!/usr/bin/env bash set -e -# ------------------------------------------------------------------------------ -# Run the prebuilt cpp-dev Docker image interactively -# Passes host UID/GID for runtime remapping (matches DevContainer behavior) -# ------------------------------------------------------------------------------ +############################################################################### +# Run the cpp-dev Docker image interactively +# +# Runs the prebuilt cpp-dev image with host UID/GID remapping. +# Matches DevContainer behavior for consistent file permissions. +# +# Usage: +# ./scripts/docker/run.sh +############################################################################### SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)" PROJECT_NAME="$(basename "$PROJECT_ROOT")" diff --git a/scripts/docs.sh b/scripts/docs.sh index 9f84034..5104282 100755 --- a/scripts/docs.sh +++ b/scripts/docs.sh @@ -1,6 +1,15 @@ #!/usr/bin/env bash set -e +############################################################################### +# Generate Doxygen documentation +# +# Generates HTML documentation from source code comments. +# +# Usage: +# ./scripts/docs.sh +############################################################################### + SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" PROJECT_ROOT="$(dirname "$SCRIPT_DIR")" DOCS_DIR="${PROJECT_ROOT}/docs" diff --git a/scripts/format.sh b/scripts/format.sh index 242f3a5..06f12f0 100755 --- a/scripts/format.sh +++ b/scripts/format.sh @@ -1,13 +1,15 @@ -#!/bin/bash +#!/usr/bin/env bash +set -e -# -------------------------------------------------------------------- -# Format all C++ source/header files in the project using clang-format +############################################################################### +# Format all C++ source/header files using clang-format +# +# Formats all C++ files in the project according to .clang-format config. +# # Usage: -# ./format.sh - Format files in-place -# ./format.sh --check - Check formatting without modifying files -# -------------------------------------------------------------------- - -set -e +# ./scripts/format.sh - Format files in-place +# ./scripts/format.sh --check - Check formatting without modifying files +############################################################################### SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" PROJECT_ROOT="$(dirname "$SCRIPT_DIR")" diff --git a/scripts/lint.sh b/scripts/lint.sh index 028e03a..af6c86f 100755 --- a/scripts/lint.sh +++ b/scripts/lint.sh @@ -1,9 +1,14 @@ #!/usr/bin/env bash set -e -# ------------------------------------------------------------------------------ -# Run clang-tidy over all C++ source files using the build compile_commands.json -# ------------------------------------------------------------------------------ +############################################################################### +# Run clang-tidy static analysis +# +# Runs clang-tidy over all C++ source files using compile_commands.json. +# +# Usage: +# ./scripts/lint.sh +############################################################################### BUILD_DIR="build" TIDY_BIN=$(command -v clang-tidy || true) diff --git a/scripts/package.sh b/scripts/package.sh index a712f6d..b1304c3 100755 --- a/scripts/package.sh +++ b/scripts/package.sh @@ -1,6 +1,14 @@ -#!/bin/bash - -set -e # Exit on error +#!/usr/bin/env bash +set -e + +############################################################################### +# Package the project for distribution +# +# Builds in Release mode and creates distributable packages. +# +# Usage: +# ./scripts/package.sh +############################################################################### # Set build directory BUILD_DIR="build"