<commit_before>#!/bin/bash

set -e

if [ "$(uname)" == "Darwin" ]; then
    if ! which gsed; then
        echo gsed missing
        exit 1
    fi
    SED=gsed
else
    SED=sed
fi

if [ $# -eq 0 ];
then
    echo "Invalid or no arguments provided."
    cat <<EOF
Usage: ./prepare.sh VERSION

Prepares a new Chrome app release.

positional arguments:
  VERSION                 Version number to release
EOF
    exit 1
fi

if [ ! -z "`git status -s | grep -v ^??`" ]; then  ## ?? = untracked files
    echo "You have uncommited changes. Please revert/stash them."
    exit 1
fi

$SED -i 's/"version": "[0-9.]\+"/"version": "'$1'"/' manifest.json
$SED -i 's/"version": "[0-9.]\+"/"version": "'$1'"/' manifest_regtest.json
$SED -i 's/"version": "[0-9.]\+"/"version": "'$1'"/' manifest_liveregtest.json
$SED -i 's/"version": "[0-9.]\+"/"version": "'$1'"/' manifest_testnet.json
# _mainnet is optional:
$SED -i 's/"version": "[0-9.]\+"/"version": "'$1'"/' manifest_mainnet.json 2>/dev/null || true
git commit -S -am"bump version for release $1"

$SED -i 's|WEBFILES_BRANCH=${WEBFILES_BRANCH##refs/heads/}|WEBFILES_BRANCH="'crx-v$1'"|' prepare.sh

git commit -S -am"update prepare.sh for release $1"
git tag -s -m"release $1" v$1
git reset --hard HEAD^  # revert the release.sh change for the main branch

cd webfiles
git tag -s -m"release $1 for chrome" crx-v$1
cd ..

echo "Update and tagging done. Now please push this repo and webfiles/ with --tags."<commit_msg>Remove no longer necessary prepare.sh munging<commit_after>#!/bin/bash

set -e

if [ "$(uname)" == "Darwin" ]; then
    if ! which gsed; then
        echo gsed missing
        exit 1
    fi
    SED=gsed
else
    SED=sed
fi

if [ $# -eq 0 ];
then
    echo "Invalid or no arguments provided."
    cat <<EOF
Usage: ./prepare.sh VERSION

Prepares a new Chrome app release.

positional arguments:
  VERSION                 Version number to release
EOF
    exit 1
fi

if [ ! -z "`git status -s | grep -v ^??`" ]; then  ## ?? = untracked files
    echo "You have uncommited changes. Please revert/stash them."
    exit 1
fi

$SED -i 's/"version": "[0-9.]\+"/"version": "'$1'"/' manifest.json
$SED -i 's/"version": "[0-9.]\+"/"version": "'$1'"/' manifest_regtest.json
$SED -i 's/"version": "[0-9.]\+"/"version": "'$1'"/' manifest_liveregtest.json
$SED -i 's/"version": "[0-9.]\+"/"version": "'$1'"/' manifest_testnet.json
# _mainnet is optional:
$SED -i 's/"version": "[0-9.]\+"/"version": "'$1'"/' manifest_mainnet.json 2>/dev/null || true
git commit -S -am"bump version for release $1"
git tag -s -m"release $1" v$1

cd webfiles
git tag -s -m"release $1 for chrome" crx-v$1
cd ..

echo "Update and tagging done. Now please push this repo and webfiles/ with --tags."
{'fraction_non_alphanumeric': 0.18586676481413322, 'fraction_numerical': 0.019138755980861243, 'mean_word_length': 3.0088495575221237, 'pattern_counts': {'":': 20, '<': 7, '<?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': '2787008', 'n_tokens_mistral': 1028, 'n_tokens_neox': 1004, 'n_words': 324}