<commit_before>#!/bin/bash

PRJNAME=skaffari

if [ ! $1 ]
then
    echo "Missing version";
    exit 1;
fi

if [ ! "$2" ]
then
    echo "Missing output directory";
    exit 2;
fi

DIR="/tmp/${PRJNAME}-${1}"

compasset() {
    FILE=$1
    FUG=$(stat --printf="%U:%G" ${FILE})
    FM=$(stat --printf="%a" ${FILE})
    echo "Compressing: ${FILE}"
    zopfli -i30 $FILE
    chown ${FUG} ${FILE}.gz
    chmod ${FM} ${FILE}.gz
    bro --force --quality 99 --input $FILE --output ${FILE}.br
    chown ${FUG} ${FILE}.br
    chmod ${FM} ${FILE}.br
}
export -f compasset

rm -rf $DIR

mkdir $DIR

mkdir ${DIR}/templates

pushd templates
cp CMakeLists.txt ${DIR}/templates

for TMPL in default
do
    pushd $TMPL
    npm update --dev
    ./gulp --production
    pushd static
    find $PWD -type f -name "*.css" -o -type f -name "*.js" | parallel compasset
    popd
    mkdir ${DIR}/templates/${TMPL}
    cp config.json ${DIR}/templates/${TMPL}
    cp CMakeLists.txt ${DIR}/templates/${TMPL}
    cp -r site ${DIR}/templates/${TMPL}
    cp -r static ${DIR}/templates/${TMPL}
    cp -r l10n ${DIR}/templates/${TMPL}
    popd
done

popd

for SRCDIR in common cmd sql src doc l10n grantlee
do
    cp -r $SRCDIR $DIR
done

for SRCFILE in CMakeLists.txt LICENSE
do
    cp $SRCFILE $DIR
done

pushd /tmp
rm -f "${2}/${PRJNAME}-${1}.tar.xz"
rm -f "${2}/${PRJNAME}-${1}.tar.gz"
tar -cJf "${2}/${PRJNAME}-${1}.tar.xz" ${PRJNAME}-${1}
tar -czf "${2}/${PRJNAME}-${1}.tar.gz" ${PRJNAME}-${1}
rm -rf ${PRJNAME}-${1}
popd

gpg --armor --detach-sign --yes --default-key <KEY> "${2}/${PRJNAME}-${1}.tar.xz"
gpg --armor --detach-sign --yes --default-key <KEY> "${2}/${PRJNAME}-${1}.tar.gz"

exit 0<commit_msg>Add CHANGELOG file to release.sh script<commit_after>#!/bin/bash

PRJNAME=skaffari

if [ ! $1 ]
then
    echo "Missing version";
    exit 1;
fi

if [ ! "$2" ]
then
    echo "Missing output directory";
    exit 2;
fi

DIR="/tmp/${PRJNAME}-${1}"

compasset() {
    FILE=$1
    FUG=$(stat --printf="%U:%G" ${FILE})
    FM=$(stat --printf="%a" ${FILE})
    echo "Compressing: ${FILE}"
    zopfli -i30 $FILE
    chown ${FUG} ${FILE}.gz
    chmod ${FM} ${FILE}.gz
    bro --force --quality 99 --input $FILE --output ${FILE}.br
    chown ${FUG} ${FILE}.br
    chmod ${FM} ${FILE}.br
}
export -f compasset

rm -rf $DIR

mkdir $DIR

mkdir ${DIR}/templates

pushd templates
cp CMakeLists.txt ${DIR}/templates

for TMPL in default
do
    pushd $TMPL
    npm update --dev
    ./gulp --production
    pushd static
    find $PWD -type f -name "*.css" -o -type f -name "*.js" | parallel compasset
    popd
    mkdir ${DIR}/templates/${TMPL}
    cp config.json ${DIR}/templates/${TMPL}
    cp CMakeLists.txt ${DIR}/templates/${TMPL}
    cp -r site ${DIR}/templates/${TMPL}
    cp -r static ${DIR}/templates/${TMPL}
    cp -r l10n ${DIR}/templates/${TMPL}
    popd
done

popd

for SRCDIR in common cmd sql src doc l10n grantlee
do
    cp -r $SRCDIR $DIR
done

for SRCFILE in CMakeLists.txt LICENSE CHANGELOG
do
    cp $SRCFILE $DIR
done

pushd /tmp
rm -f "${2}/${PRJNAME}-${1}.tar.xz"
rm -f "${2}/${PRJNAME}-${1}.tar.gz"
tar -cJf "${2}/${PRJNAME}-${1}.tar.xz" ${PRJNAME}-${1}
tar -czf "${2}/${PRJNAME}-${1}.tar.gz" ${PRJNAME}-${1}
rm -rf ${PRJNAME}-${1}
popd

gpg --armor --detach-sign --yes --default-key <KEY> "${2}/${PRJNAME}-${1}.tar.xz"
gpg --armor --detach-sign --yes --default-key <KEY> "${2}/${PRJNAME}-${1}.tar.gz"

exit 0
{'fraction_non_alphanumeric': 0.2102004716981132, 'fraction_numerical': 0.01768867924528302, 'mean_word_length': 2.8469387755102042, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7092999', 'n_tokens_mistral': 1389, 'n_tokens_neox': 1358, 'n_words': 373}