#!/usr/bin/env bash

# Copyright (C) 2023 WYATT GROUP
# Please see the AUTHORS file for details.
#
# 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
# 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/>.

# Script that iterates through each package in the packages directory and
# removes .gitignore, AUTHORS, and LICENSE files if they exist.

# Current directory
DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)

# Path to the packages directory
PACKAGES_DIR="$DIR/../packages"

# Iterate through each package in the packages directory
for package in "$PACKAGES_DIR"/*; do
  # Remove .gitignore file if it exists
  if [ -f "$package/.gitignore" ]; then
    rm "$package/.gitignore"
  fi

  # Remove .pubignore file if it exists
  if [ -f "$package/.pubignore" ]; then
    rm "$package/.pubignore"
  fi

  # Remove AUTHORS file if it exists
  if [ -f "$package/AUTHORS" ]; then
    rm "$package/AUTHORS"
  fi

  # Remove LICENSE file if it exists
  if [ -f "$package/LICENSE" ]; then
    rm "$package/LICENSE"
  fi
done
