Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve package scripts #19

Open
Razish opened this issue Oct 11, 2023 · 0 comments
Open

improve package scripts #19

Razish opened this issue Oct 11, 2023 · 0 comments

Comments

@Razish
Copy link
Owner

Razish commented Oct 11, 2023

We want to know if we've introduced assets that are not being packaged.
It should ignore gitignored and manually blacklisted files (e.g. the packaging scripts themselves).

We can take inspiration from CJK's gruggy shell script:

#!/usr/bin/env bash
# purpose: list files that are missing from the package script
set -euo pipefail

BLACKLIST=(
        ./package-files.txt
        ./package-find-missing.sh
        ./package.sh
        ./README.md
)

# FIXME: we can probably `return 1` instead of a dirty-flag break
file_is_blacklisted() {
        local needle="$1"
        match=0
        for bad_file in "${BLACKLIST[@]}"; do
                if [[ $bad_file = "$needle" ]]; then
                        match=1
                        break
                fi
        done
        [[ $match != 0 ]]
}

list_files() {
        while IFS='' read -r -d '' file; do
                if git check-ignore "$file" >/dev/null || file_is_blacklisted "$file"; then
                        echo >&2 "Ignoring $file"
                else
                        echo "$file"
                fi
        done < <(find ./* -type f -print0)
}

list_files | sort | git diff --no-index -- package-files.txt - # comm -13 package-files.txt -
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant