<commit_before>#!/usr/bin/env bash
#
# Copyright (C) 2017 TAQTIQA LLC. <http://www.taqtiqa.com>
#
#This program is free software: you can redistribute it and/or modify
#it under the terms of the GNU Affero General Public License as published by
#the Free Software Foundation, either version 3 of the License, or
#(at your option) 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 Affero General Public License v3
#along with this program.
#If not, see <https://www.gnu.org/licenses/agpl-3.0.en.html>.
#

# NOTE:
# This script relies on an environment variable for the version number.
# Travis is the CI environment setup supporting encrypted environment variables.
#
# Sign a file with a private GPG keyring and password.
#
# Usage: deploy.sh
#

set -exuo pipefail

if [[ $# -gt 0 ]] ; then
  echo "Usage: deploy.sh"
  exit 1
fi

WORKING_DIR=$(cd -P -- "$(dirname -- "$0")" && pwd -P)

GIT_URL=`git config --get remote.origin.url`
GIT_NAME=$(basename $GIT_URL .git)
#GIT_OWNER=$(basename $(dirname $GIT_URL))

PUBLIC_KEYRING="./${GIT_NAME}-publickeys.gpg"

function deployend() {
    export EXIT=$?
    if [[ $EXIT != 0 ]]; then
      echo "Abnormal end."
    fi
    rm -f ./travis-ca.cert
    exit $EXIT
}

trap deployend EXIT

if [[ ! $CI == "true" ]]; then
  echo "Not in a CI environment. Do not Deploy."
  exit 1
fi

if [[ $TRAVIS == "true" ]]; then
  pushd ${WORKING_DIR}
    pushd ../
      # Copy PUBLIC_KEYRING to gh=pages folder ready to be deployed
      if [ -f ${PUBLIC_KEYRING} ]; then
        # Make a versioned backup of public keyrings - in case of emergency
        cp --force "${PUBLIC_KEYRING}" "./gh-pages/keyrings/$(basename ${PUBLIC_KEYRING} .gpg)-${TRAVIS_TAG}.gpg"
        # Only replace the existing public keyring if it is changed.
        rsync --checksum "${PUBLIC_KEYRING}" "./gh-pages/keyrings/$(basename ${PUBLIC_KEYRING})"
        echo "A GPG public keyring is ready to deploy to GitHub Pages."
      else
        echo "A GPG public keyring ${PUBLIC_KEYRING} NOT found!."
        exit 1
      fi
    popd
  popd
fi<commit_msg>Debug deploy script looking too high up in the folder tree<commit_after>#!/usr/bin/env bash
#
# Copyright (C) 2017 TAQTIQA LLC. <http://www.taqtiqa.com>
#
#This program is free software: you can redistribute it and/or modify
#it under the terms of the GNU Affero General Public License as published by
#the Free Software Foundation, either version 3 of the License, or
#(at your option) 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 Affero General Public License v3
#along with this program.
#If not, see <https://www.gnu.org/licenses/agpl-3.0.en.html>.
#

# NOTE:
# This script relies on an environment variable for the version number.
# Travis is the CI environment setup supporting encrypted environment variables.
#
# Sign a file with a private GPG keyring and password.
#
# Usage: deploy.sh
#

set -exuo pipefail

if [[ $# -gt 0 ]] ; then
  echo "Usage: deploy.sh"
  exit 1
fi

WORKING_DIR=$(cd -P -- "$(dirname -- "$0")" && pwd -P)

GIT_URL=`git config --get remote.origin.url`
GIT_NAME=$(basename $GIT_URL .git)
#GIT_OWNER=$(basename $(dirname $GIT_URL))

PUBLIC_KEYRING="./${GIT_NAME}-publickeys.gpg"

function deployend() {
    export EXIT=$?
    if [[ $EXIT != 0 ]]; then
      echo "Abnormal end."
    fi
    rm -f ./travis-ca.cert
    exit $EXIT
}

trap deployend EXIT

if [[ ! $CI == "true" ]]; then
  echo "Not in a CI environment. Do not Deploy."
  exit 1
fi

if [[ $TRAVIS == "true" ]]; then
  pushd ${WORKING_DIR}
    # Copy PUBLIC_KEYRING to gh=pages folder ready to be deployed
    if [ -f ${PUBLIC_KEYRING} ]; then
      # Make a versioned backup of public keyrings - in case of emergency
      cp --force "${PUBLIC_KEYRING}" "./gh-pages/keyrings/$(basename ${PUBLIC_KEYRING} .gpg)-${TRAVIS_TAG}.gpg"
      # Only replace the existing public keyring if it is changed.
      rsync --checksum "${PUBLIC_KEYRING}" "./gh-pages/keyrings/$(basename ${PUBLIC_KEYRING})"
      echo "A GPG public keyring is ready to deploy to GitHub Pages."
    else
      echo "A GPG public keyring ${PUBLIC_KEYRING} NOT found!."
      exit 1
    fi
  popd
fi
{'fraction_non_alphanumeric': 0.11387208297320657, 'fraction_numerical': 0.006050129645635264, 'mean_word_length': 3.354656632173095, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 2, 'lorem ipsum': 0, 'www.': 4, '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': '7104053', 'n_tokens_mistral': 1565, 'n_tokens_neox': 1495, 'n_words': 585}