<commit_before>#!/bin/bash

# credit to: https://moquet.net/blog/distributing-php-cli/ 

set -e

if [ $# -ne 1 ]; then
  echo "Usage: `basename $0` <tag>"
  exit 65
fi

TAG=$1

#
# Tag & build master branch
#
git checkout master
git tag ${TAG}
box build

#
# Copy executable file into GH pages
#
git checkout gh-pages

cp cdev.phar downloads/cdev-${TAG}.phar
git add downloads/cdev-${TAG}.phar

# SHA1=$(openssl sha1 cdev.phar)
SHA1=$(shasum cdev.phar | awk '{print $1;}')

JSON='name:"cdev.phar"'
JSON="${JSON},sha1:\"${SHA1}\""
JSON="${JSON},url:\"https://garethmidwood.github.io/cdev/downloads/cdev-${TAG}.phar\""
JSON="${JSON},version:\"${TAG}\""

if [ -f cdev.phar.pubkey ]; then
    cp cdev.phar.pubkey pubkeys/cdev-${TAG}.phar.pubkeys
    git add pubkeys/cdev-${TAG}.phar.pubkeys
    JSON="${JSON},publicKey:\"https://garethmidwood.github.io/cdev/downloads/cdev-${TAG}.phar.pubkey\""
fi

#
# Update manifest
#
cat manifest.json | jsawk -a "this.push({${JSON}})" | python -mjson.tool > manifest.json.tmp
mv manifest.json.tmp manifest.json
git add manifest.json

git commit -m "Add version ${TAG}"

git push origin gh-pages

#
# Go back to master
#
git checkout master
git push --tags
echo "New version created."
# echo "git push origin gh-pages"
# echo "git push ${TAG}"<commit_msg>Add installation script update when creating new release<commit_after>#!/bin/bash

# credit to: https://moquet.net/blog/distributing-php-cli/ 

set -e

if [ $# -ne 1 ]; then
  echo "Usage: `basename $0` <tag>"
  exit 65
fi

TAG=$1

#
# Tag & build master branch
#
git checkout master
git tag ${TAG}
box build

#
# Copy executable file into GH pages
#
git checkout gh-pages

cp cdev.phar downloads/cdev-${TAG}.phar
git add downloads/cdev-${TAG}.phar

# SHA1=$(openssl sha1 cdev.phar)
SHA1=$(shasum cdev.phar | awk '{print $1;}')

JSON='name:"cdev.phar"'
JSON="${JSON},sha1:\"${SHA1}\""
JSON="${JSON},url:\"https://garethmidwood.github.io/cdev/downloads/cdev-${TAG}.phar\""
JSON="${JSON},version:\"${TAG}\""

if [ -f cdev.phar.pubkey ]; then
    cp cdev.phar.pubkey pubkeys/cdev-${TAG}.phar.pubkeys
    git add pubkeys/cdev-${TAG}.phar.pubkeys
    JSON="${JSON},publicKey:\"https://garethmidwood.github.io/cdev/downloads/cdev-${TAG}.phar.pubkey\""
fi

#
# Update manifest
#
cat manifest.json | jsawk -a "this.push({${JSON}})" | python -mjson.tool > manifest.json.tmp
mv manifest.json.tmp manifest.json
git add manifest.json

#
# Update latest version in install script
#
sed -i.bak "3s#.*#LATEST_RELEASE='https://garethmidwood.github.io/cdev/downloads/cdev-${TAG}.phar'#" install
git add install
rm install.bak

#
# Commit and push
#
git commit -m "Add version ${TAG}"

git push origin gh-pages

#
# Go back to master
#
git checkout master
git push --tags
echo "New version created."
# echo "git push origin gh-pages"
# echo "git push ${TAG}"
{'fraction_non_alphanumeric': 0.17963224893917965, 'fraction_numerical': 0.008132956152758133, 'mean_word_length': 4.088129496402877, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 7, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 9, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4773549', 'n_tokens_mistral': 1102, 'n_tokens_neox': 1064, 'n_words': 262}