<commit_before>#!/bin/bash
##############################################
##   ASSETS BUILD AND REPLICATION SCRIPT
##   FOR LOCAL USE
##
##        ++ USE WITH CAUTION !! ++
##
##############################################

#bundle exec jekyll build

DIR="$( pwd )"
echo "Working from ${DIR}"
ORIGIN="${DIR}/_site/assets"
echo "Generated files at ${ORIGIN}"

STYLES="${DIR}/../styles"
STYLESFOLDER="/assets"
# REPOS=("website" "datacarpentry.github.io" "lesson-template" "workshop-template")
REPOS=("../website")
REPOSFOLDER="assets-fallback"

function copyTo {
    echo -e "\n[copyTo]"
    echo "delete existing files in ${1}"
    rm -rf $1/*
    echo "copy from $ORIGIN to ${1}"
    test -d "$1" || mkdir -p "$1"
    cp -R ${ORIGIN}/* $1
    doNotEditFilePath="${1}/_DO_NOT_EDIT_THIS_FOLDER"
    echo -e "Creating doNotEdit File at ${doNotEditFilePath}\n"
    echo '' > ${doNotEditFilePath}
    echo -e "\n${1} now contains"
    tree -R $1
    echo -e "-------------"
}

stylesAssetsPath="${STYLES}${STYLESFOLDER}"
copyTo $stylesAssetsPath

echo -e "Starting to copy in repositories"
for repo in ${REPOS[@]}; do
    repoPath="${DIR}/${repo}/${REPOSFOLDER}"
    copyTo $repoPath
done

#git add -f --ignore-removal .
#git commit -m "Automatic commit after local update"
#git push -fq origin gh-pages

cd ../assets

git add -f --ignore-removal .
git commit -m "Automatic commit after local update"
git push -fq origin gh-pages
<commit_msg>script<commit_after>#!/bin/bash
##############################################
##   ASSETS BUILD AND REPLICATION SCRIPT
##   FOR LOCAL USE
##   RUN FROM "ASSETS" FOLDER
##
##        ++ USE WITH CAUTION !! ++
##
##############################################

#echo -n "With push? ('y' will push other no) [ENTER]: "
#read doPush

bundle exec jekyll build

DIR="$( pwd )"
echo "Working from ${DIR}"
ORIGIN="${DIR}/_site/assets"
echo "Generated files at ${ORIGIN}"

STYLES="/../styles"
STYLESFOLDER="assets"

#REPOS=("/../website" "/../datacarpentry.github.io" "/../lesson-template" "/../workshop-template")
REPOS=("/../workshop-template")

ASSETSFOLDER="assets-fallback"

function copyTo {
    echo "[copyTo]"
    echo "Parameter #1 is $1 - Parameter #2 is $2 - Parameter #3 is $3"
    cd $DIR
    echo "currently in $(pwd)"
    targetRepo="${DIR}${1}"
    assetsDestination="${targetRepo}/${2}"
    echo "deleting existing files from ${assetsDestination}"
    rm -rf $assetsDestination/*
    echo "copy from $ORIGIN to ${assetsDestination}"
    test -d "$assetsDestination" || mkdir -p "$assetsDestination"
    cp -R ${ORIGIN}/* $assetsDestination
    doNotEditFilePath="${assetsDestination}/_DO_NOT_EDIT_THIS_FOLDER"
    echo "Creating doNotEdit File at ${doNotEditFilePath}"
    echo '' > ${doNotEditFilePath}
    echo "${assetsDestination} now contains"
#    tree -R $assetsDestination
    echo -e " -- Committing results from ${targetRepo}"
    cd $targetRepo
    echo "currently in $(pwd)"

    if [ -z $(git status --porcelain) ]
        then
            echo "Nothing to commit"
        else
            echo "Commiting"
            git add -fA "./$2"
            git commit -m "Automatic commit after local update"

            echo "Pushing"
            git pull origin gh-pages
            git push -fq origin gh-pages
    fi
    echo -e "-------------\n"
}

copyTo $STYLES $STYLESFOLDER "true"

echo -e "Starting to copy in repositories"
for repo in ${REPOS[@]}; do
    copyTo $repo $ASSETSFOLDER "false"
done

{'fraction_non_alphanumeric': 0.20641803989592367, 'fraction_numerical': 0.005203816131830009, 'mean_word_length': 3.2663378545006165, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '3372124', 'n_tokens_mistral': 1164, 'n_tokens_neox': 1124, 'n_words': 332}