<commit_before>#!/bin/bash
# Update Doxygen documentation on github-pages to reflect latest changes in master
# credits:
#  https://github.com/miloyip/rapidjson/blob/master/travis-doxygen.sh
#  http://stackoverflow.com/questions/23277391/pushing-to-github-from-travis-ci
#  https://github.com/robotology/icub-iaitabletop/blob/master/.travis/push-doxygen-to-gh-pages.sh
#  http://rickfoosusa.blogspot.de/2011/10/howto-use-doxygen-with-github.html
# Author: kashefy
set -e # exit with nonzero exit code if anything fails

# skip builds triggered by pull-requests
[ "${TRAVIS_PULL_REQUEST}" = "false" ] || \
skip "Skipping docs generation builds triggered by pull-requests."

# limit to specific branches
#[ "${TRAVIS_BRANCH}" = "master" ] || \
#skip "Limit docs generation to pushes to 'master' branch (current branch is: ${TRAVIS_BRANCH})."

cd $TRAVIS_BUILD_DIR
echo -e "Generate doxygen docs"
doxygen ./docs/doxygenConf.txt > /dev/null

git config --global user.email "<EMAIL>"
git config --global user.name "travis-ci"
git clone --quiet --branch=gh-pages https://${GH_TOKEN}@github.com/kashefy/elm gh-pages > /dev/null

cd gh-pages
if [ -d "docs" ]; then
  git rm -rf docs
fi
mkdir -p docs/
cp -Rf $TRAVIS_BUILD_DIR/docs/html ./docs/html
git add -f .
git commit -m "[gh-pages] [docs] auto-push updated doxygen docs on successful travis build $TRAVIS_BUILD_NUMBER to gh-pages"
git push -fq origin gh-pages
echo -e "Published doxygen docs to gh-pages."<commit_msg>orgnize shell script into functions<commit_after>#!/bin/bash
# Update Doxygen documentation on github-pages to reflect latest changes in master
# credits:
#  https://github.com/miloyip/rapidjson/blob/master/travis-doxygen.sh
#  http://stackoverflow.com/questions/23277391/pushing-to-github-from-travis-ci
#  https://github.com/robotology/icub-iaitabletop/blob/master/.travis/push-doxygen-to-gh-pages.sh
#  http://rickfoosusa.blogspot.de/2011/10/howto-use-doxygen-with-github.html
# Author: kashefy
set -e # exit with nonzero exit code if anything fails

skip() {
    echo "$@" 1>&2
    echo "Exiting..." 1>&2
    exit 0
}

# skip builds triggered by pull-requests
[ "${TRAVIS_PULL_REQUEST}" = "false" ] || \
skip "Skipping docs generation builds triggered by pull-requests."

# limit to specific branches
[ "${TRAVIS_BRANCH}" = "master" ] || \
skip "Limit docs generation to pushes to 'master' branch (current branch is: ${TRAVIS_BRANCH})."

doxygen_run() {
    
    cd $TRAVIS_BUILD_DIR
    echo -e "Generate doxygen docs"
    doxygen ./docs/doxygenConf.txt > /dev/null
}

git_config() {
    
    git config --global user.email "<EMAIL>"
    git config --global user.name "travis-ci"
}

git_clone_gh_pages(){
    
    git clone --quiet --branch=gh-pages https://${GH_TOKEN}@github.com/kashefy/elm $TRAVIS_BUILD_DIR/gh-pages > /dev/null
}

publish() {
    
    cd $TRAVIS_BUILD_DIR/gh-pages
    if [ -d "docs" ]; then
      git rm -rf docs
    fi
    mkdir -p docs/
    cp -Rf $TRAVIS_BUILD_DIR/docs/html ./docs/html
    git add -f .
    git commit -m "[gh-pages] [docs] auto-push updated doxygen docs on successful travis build $TRAVIS_BUILD_NUMBER to gh-pages"
    git push -fq origin gh-pages
    echo -e "Published doxygen docs to gh-pages."
}

doxygen_run
git_config
git_clone_gh_pages
publish
{'fraction_non_alphanumeric': 0.1327406499080319, 'fraction_numerical': 0.010116492949110975, 'mean_word_length': 3.668097281831187, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 6, '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': '2243088', 'n_tokens_mistral': 1208, 'n_tokens_neox': 1137, 'n_words': 297}