From f871ff02c7c1519e224125513064b949abe0947a Mon Sep 17 00:00:00 2001 From: Glenn Ellis Date: Mon, 9 Feb 2026 11:43:07 -0700 Subject: [PATCH] cleanup: remove unused and obsolete files Removes: - Empty .topdir file - Obsolete demo/example files: - installers/setup_remote_example.sh - installers/setup_workflow_demo.sh - tests/demo_enhanced_branch_detection.sh - tests/remote_usage_examples.sh These files were either empty, examples, or no longer needed for the current project. --- .topdir | 0 installers/setup_remote_example.sh | 77 ------------------------- installers/setup_workflow_demo.sh | 63 -------------------- tests/demo_enhanced_branch_detection.sh | 64 -------------------- tests/remote_usage_examples.sh | 40 ------------- 5 files changed, 244 deletions(-) delete mode 100644 .topdir delete mode 100755 installers/setup_remote_example.sh delete mode 100755 installers/setup_workflow_demo.sh delete mode 100755 tests/demo_enhanced_branch_detection.sh delete mode 100755 tests/remote_usage_examples.sh diff --git a/.topdir b/.topdir deleted file mode 100644 index e69de29..0000000 diff --git a/installers/setup_remote_example.sh b/installers/setup_remote_example.sh deleted file mode 100755 index 07bdbc5..0000000 --- a/installers/setup_remote_example.sh +++ /dev/null @@ -1,77 +0,0 @@ -#!/usr/bin/env bash -# -# setup_remote_example.sh - Example of remote-capable installer -# Description: Demonstrates how to make installers runnable directly from curl -# Category: Development Tools -# Usage: bash <(curl -fsSL https://raw.githubusercontent.com/user/repo/main/installers/setup_remote_example.sh) -# - -set -euo pipefail - -# Detect if we're running locally or remotely -is_running_remotely() { - local script_path="${BASH_SOURCE[0]}" - # If script is in a temporary directory, it's likely running remotely - if [[ "$script_path" == /tmp/* ]] || [[ "$script_path" == /var/tmp/* ]]; then - return 0 # true - else - return 1 # false - fi -} - -# Function to source library remotely or locally -source_library() { - local library_name="$1" - - if is_running_remotely; then - # Source library from GitHub - local repo_user="yourusername" # Replace with actual username - local repo_name="linux-setup" # Replace with actual repo name - - echo "Sourcing $library_name from remote repository..." -# shellcheck source=/dev/null # Dynamic sourcing - ShellCheck can't verify - if ! source <(curl -fsSL "https://raw.githubusercontent.com/$repo_user/$repo_name/main/lib/$library_name"); then - echo "ERROR: Failed to source $library_name from remote repository" - exit 1 - fi - else - # Source library locally - local script_dir - script_dir=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) - - if [[ -f "$script_dir/../lib/$library_name" ]]; then - # shellcheck source=/dev/null - source "$script_dir/../lib/$library_name" - else - echo "ERROR: Local library $library_name not found" - exit 1 - fi - fi -} - -# Source required libraries -source_library "logging.sh" -source_library "dependencies.sh" - -# Rest of your installer logic here... -# This would be the same as your existing installer scripts - -# Example usage of the libraries -main() { - log_info "Starting remote-capable installer..." - - # Check dependencies - if ! check_dependencies curl; then - log_error "Missing required dependencies" - exit 1 - fi - - log_success "Installer running successfully!" - echo "This installer can be run remotely with:" - echo "bash <(curl -fsSL https://raw.githubusercontent.com/user/repo/main/installers/$(basename "${BASH_SOURCE[0]}"))" -} - -# Run main if script is executed directly -if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then - main "$@" -fi \ No newline at end of file diff --git a/installers/setup_workflow_demo.sh b/installers/setup_workflow_demo.sh deleted file mode 100755 index 38fc2ad..0000000 --- a/installers/setup_workflow_demo.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/usr/bin/env bash -# -# setup_workflow_demo.sh - Example Installer (Workflow Demo) -# Description: Demonstrates complete GitHub workflow from branch to merge -# Category: Development Tools -# Usage: ./setup_workflow_demo.sh [OPTIONS] -# -y, --yes, --non-interactive Skip confirmation prompts -# -h, --help Show help message -# - -set -euo pipefail - -# Parse command line arguments -NON_INTERACTIVE=false -while [[ $# -gt 0 ]]; do - case "$1" in - -y|--yes|--non-interactive) - NON_INTERACTIVE=true - shift - ;; - -h|--help) - echo "Usage: $0 [OPTIONS]" - echo "" - echo "Options:" - echo " -y, --yes, --non-interactive Skip confirmation prompts" - echo " -h, --help Show this help message" - echo "" - echo "Purpose: Demonstrates complete GitHub workflow" - echo "Author: $(basename "$0")" - exit 0 - ;; - *) - shift - ;; - esac -done - -# Source libraries -readonly SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" - -# Source shared libraries -source "$SCRIPT_DIR/../lib/logging.sh" -source "$SCRIPT_DIR/../lib/dependencies.sh" - -echo "Workflow Demo Installer" -echo "=======================" -echo -echo "This installer demonstrates the complete GitHub workflow:" -echo "1. Create feature branch" -echo "2. Validate and test changes" -echo "3. Commit and push changes" -echo "4. Create pull request" -echo "5. Pass automated checks (ShellCheck)" -echo "6. Code review and merge" -echo -echo "Features:" -echo "- ✓ Proper metadata (Description, Category)" -echo "- ✓ Bash strict mode (set -euo pipefail)" -echo "- ✓ ShellCheck compliance (SC2034 excluded)" -echo "- ✓ Library references (logging.sh, dependencies.sh)" -echo "- ✓ Consistent structure with other installers" -echo -echo "Installation complete! Check the AGENTS.md file for workflow details." \ No newline at end of file diff --git a/tests/demo_enhanced_branch_detection.sh b/tests/demo_enhanced_branch_detection.sh deleted file mode 100755 index 606ff2e..0000000 --- a/tests/demo_enhanced_branch_detection.sh +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/env bash -# -# demo_enhanced_branch_detection.sh - Demonstration of enhanced branch detection -# Description: Shows how the enhanced branch detection works in practice -# - -echo "Enhanced Branch Detection Demonstration" -echo "=======================================" -echo - -echo "1. Template Script Branch Detection:" -echo " The template now includes enhanced branch detection code:" -echo -echo " # For remote execution, try to detect branch from script URL if possible" -echo " # This is an enhancement to handle cases where the script is run from a non-default branch" -echo " local script_url" -echo " script_url=\$(curl -fsSL -w \"%{url_effective}\\n\" -o /dev/null \"https://raw.githubusercontent.com/\$repo_user/\$repo_name/\$repo_branch/installers/template.tpl\" 2>/dev/null || echo \"\")" -echo -echo " if [[ -n \"\$script_url\" ]] && [[ \"\$script_url\" == *\"raw.githubusercontent.com\"* ]]; then" -echo " # Extract branch from URL if possible" -echo " local url_branch" -echo " url_branch=\$(echo \"\$script_url\" | sed -E \"s@.*raw.githubusercontent.com/[^/]+/[^/]+/([^/]+)/.*@\\1@\")" -echo " if [[ -n \"\$url_branch\" ]] && [[ \"\$url_branch\" != \"template.tpl\" ]]; then" -echo " repo_branch=\"\$url_branch\"" -echo " fi" -echo " fi" -echo - -echo "2. How It Works:" -echo " When you run a script remotely from a specific branch:" -echo " bash <(curl -fsSL https://raw.githubusercontent.com/user/repo/feature-branch/installers/setup_script.sh)" -echo -echo " The script:" -echo " - Detects it's running remotely (temporary directory)" -echo " - Attempts to access the template script on the same branch" -echo " - If successful, extracts the branch name from the returned URL" -echo " - Uses that branch to source library files" -echo " - This ensures library files are sourced from the correct branch" -echo - -echo "3. Benefits:" -echo " - No need to manually set REPO_BRANCH for feature branches" -echo " - Scripts automatically adapt to the branch they're running from" -echo " - Reduced configuration overhead for users" -echo " - Improved reliability when working with feature branches" -echo - -echo "4. Example Usage:" -echo " # This will automatically detect and use the 'feature-branch' branch" -echo " bash <(curl -fsSL https://raw.githubusercontent.com/user/repo/feature-branch/installers/setup_vscode.sh)" -echo -echo " # Libraries will be sourced from the same branch:" -echo " https://raw.githubusercontent.com/user/repo/feature-branch/lib/logging.sh" -echo " https://raw.githubusercontent.com/user/repo/feature-branch/lib/dependencies.sh" -echo - -echo "5. Fallback Behavior:" -echo " If branch detection fails, scripts fall back to environment variables:" -echo " - REPO_BRANCH environment variable (if set)" -echo " - Default branch (main)" -echo - -echo "This enhancement solves the issue where scripts running from feature branches" -echo "would incorrectly try to source libraries from the main branch, causing errors." \ No newline at end of file diff --git a/tests/remote_usage_examples.sh b/tests/remote_usage_examples.sh deleted file mode 100755 index 980654f..0000000 --- a/tests/remote_usage_examples.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/env bash - -echo "Remote Execution Usage Examples" -echo "===============================" - -echo "1. Run an installer directly from GitHub:" -echo " bash <(curl -fsSL https://raw.githubusercontent.com/gdellis/linux-setup/main/installers/setup_vscode.sh)" -echo "" - -echo "2. Run an installer with custom repository details:" -echo " REPO_USER=myuser REPO_NAME=myrepo bash <(curl -fsSL https://raw.githubusercontent.com/gdellis/linux-setup/main/installers/setup_vscode.sh)" -echo "" - -echo "3. Run an installer from a specific branch:" -echo " REPO_USER=gdellis REPO_NAME=linux-setup REPO_BRANCH=develop bash <(curl -fsSL https://raw.githubusercontent.com/gdellis/linux-setup/main/installers/setup_vscode.sh)" -echo "" - -echo "4. Use the bootstrap script to run any installer:" -echo " bash <(curl -fsSL https://raw.githubusercontent.com/gdellis/linux-setup/main/bootstrap.sh) setup_vscode.sh" -echo "" - -echo "5. Run the bash TUI menu directly:" -echo " bash <(curl -fsSL https://raw.githubusercontent.com/gdellis/linux-setup/main/bootstrap.sh) menu" -echo "" - -echo "6. Run the Python TUI menu directly:" -echo " bash <(curl -fsSL https://raw.githubusercontent.com/gdellis/linux-setup/main/bootstrap.sh) python-menu" -echo "" - -echo "7. Run the Python TUI menu with custom repository:" -echo " REPO_USER=myuser REPO_NAME=myrepo bash <(curl -fsSL https://raw.githubusercontent.com/gdellis/linux-setup/main/bootstrap.sh) python-menu" -echo "" - -echo "Environment Variables:" -echo " REPO_USER - GitHub username (default: gdellis)" -echo " REPO_NAME - Repository name (default: linux-setup)" -echo " REPO_BRANCH - Repository branch (default: main)" -echo "" - -echo "To test with your own repository, replace the values above with your GitHub username and repository name." \ No newline at end of file