<commit_before>#! /bin/bash
#

pushd $(dirname $0)                                                                                     2> /dev/null  > /dev/null


# ---------------------------------------------------------------------------
# stage 1: rebuild all libraries from scratch, using existing NPM packages.
#          Commit. (`npm install` fails often enough that we invoke the bastard TWICE!)
# ---------------------------------------------------------------------------

make superclean ; make prep ; make prep ; make site


# git submodule foreach git commit -a -m 'rebuilt library files'
# ^-- one or more subrepo's may fail as there'ld be nothing to commit,
#     which would abort the `git submodule foreach` command!
pushd modules/ebnf-parser/                                                                                     2> /dev/null  > /dev/null
git commit -a -m 'rebuilt library files'
git push --all
popd                                                                                                           2> /dev/null  > /dev/null
pushd modules/jison2json/                                                                                      2> /dev/null  > /dev/null
git commit -a -m 'rebuilt library files'
git push --all
popd                                                                                                           2> /dev/null  > /dev/null
pushd modules/jison-lex/                                                                                       2> /dev/null  > /dev/null
git commit -a -m 'rebuilt library files'
git push --all
popd                                                                                                           2> /dev/null  > /dev/null
pushd modules/json2jison/                                                                                      2> /dev/null  > /dev/null
git commit -a -m 'rebuilt library files'
git push --all
popd                                                                                                           2> /dev/null  > /dev/null
pushd modules/lex-parser/                                                                                      2> /dev/null  > /dev/null
git commit -a -m 'rebuilt library files'
git push --all
popd                                                                                                           2> /dev/null  > /dev/null

git commit -a -m 'rebuilt library files'
git push --all


make superclean ; make prep ; make prep ; make site


pushd modules/ebnf-parser/                                                                                     2> /dev/null  > /dev/null
git commit -a -m 'rebuilt library files'
git push --all
popd                                                                                                           2> /dev/null  > /dev/null
pushd modules/jison2json/                                                                                      2> /dev/null  > /dev/null
git commit -a -m 'rebuilt library files'
git push --all
popd                                                                                                           2> /dev/null  > /dev/null
pushd modules/jison-lex/                                                                                       2> /dev/null  > /dev/null
git commit -a -m 'rebuilt library files'
git push --all
popd                                                                                                           2> /dev/null  > /dev/null
pushd modules/json2jison/                                                                                      2> /dev/null  > /dev/null
git commit -a -m 'rebuilt library files'
git push --all
popd                                                                                                           2> /dev/null  > /dev/null
pushd modules/lex-parser/                                                                                      2> /dev/null  > /dev/null
git commit -a -m 'rebuilt library files'
git push --all
popd                                                                                                           2> /dev/null  > /dev/null

git commit -a -m 'rebuilt library files'
git push --all


# ---------------------------------------------------------------------------
# stage 2: Tag and Publish.
# ---------------------------------------------------------------------------


make git-tag

npm publish


# ---------------------------------------------------------------------------
# stage 3: Bump build revision for future work, commit & push.
# ---------------------------------------------------------------------------


make bump


# git submodule foreach git commit -a -m 'rebuilt library files'
# ^-- one or more subrepo's may fail as there'ld be nothing to commit,
#     which would abort the `git submodule foreach` command!
pushd modules/ebnf-parser/                                                                                     2> /dev/null  > /dev/null
git commit -a -m 'bumped build revision'
git push --all
popd                                                                                                           2> /dev/null  > /dev/null
pushd modules/jison2json/                                                                                      2> /dev/null  > /dev/null
git commit -a -m 'bumped build revision'
git push --all
popd                                                                                                           2> /dev/null  > /dev/null
pushd modules/jison-lex/                                                                                       2> /dev/null  > /dev/null
git commit -a -m 'bumped build revision'
git push --all
popd                                                                                                           2> /dev/null  > /dev/null
pushd modules/json2jison/                                                                                      2> /dev/null  > /dev/null
git commit -a -m 'bumped build revision'
git push --all
popd                                                                                                           2> /dev/null  > /dev/null
pushd modules/lex-parser/                                                                                      2> /dev/null  > /dev/null
git commit -a -m 'bumped build revision'
git push --all
popd                                                                                                           2> /dev/null  > /dev/null

git commit -a -m 'bumped build revision'
git push --all


# ---------------------------------------------------------------------------
# stage 4: update NPM packages, if any; rebuild & commit
# ---------------------------------------------------------------------------


# rebuild everything before we go and tag the buggers!
#make git-tag
#make site

#../../../util/git_pull_push.sh -f

pushd modules/ebnf-parser/                                                                                     2> /dev/null  > /dev/null
ncu -a --packageFile package.json 
git commit -a -m 'updated NPM packages'
git push --all
popd                                                                                                           2> /dev/null  > /dev/null
pushd modules/jison2json/                                                                                      2> /dev/null  > /dev/null
ncu -a --packageFile package.json 
git commit -a -m 'updated NPM packages'
git push --all
popd                                                                                                           2> /dev/null  > /dev/null
pushd modules/jison-lex/                                                                                       2> /dev/null  > /dev/null
ncu -a --packageFile package.json 
git commit -a -m 'updated NPM packages'
git push --all
popd                                                                                                           2> /dev/null  > /dev/null
pushd modules/json2jison/                                                                                      2> /dev/null  > /dev/null
ncu -a --packageFile package.json 
git commit -a -m 'updated NPM packages'
git push --all
popd                                                                                                           2> /dev/null  > /dev/null
pushd modules/lex-parser/                                                                                      2> /dev/null  > /dev/null
ncu -a --packageFile package.json 
git commit -a -m 'updated NPM packages'
git push --all
popd                                                                                                           2> /dev/null  > /dev/null

ncu -a --packageFile package.json 
git commit -a -m 'updated NPM packages'
git push --all


make superclean ; make prep ; make prep ; make site


pushd modules/ebnf-parser/                                                                                     2> /dev/null  > /dev/null
git commit -a -m 'rebuilt library files'
git push --all
popd                                                                                                           2> /dev/null  > /dev/null
pushd modules/jison2json/                                                                                      2> /dev/null  > /dev/null
git commit -a -m 'rebuilt library files'
git push --all
popd                                                                                                           2> /dev/null  > /dev/null
pushd modules/jison-lex/                                                                                       2> /dev/null  > /dev/null
git commit -a -m 'rebuilt library files'
git push --all
popd                                                                                                           2> /dev/null  > /dev/null
pushd modules/json2jison/                                                                                      2> /dev/null  > /dev/null
git commit -a -m 'rebuilt library files'
git push --all
popd                                                                                                           2> /dev/null  > /dev/null
pushd modules/lex-parser/                                                                                      2> /dev/null  > /dev/null
git commit -a -m 'rebuilt library files'
git push --all
popd                                                                                                           2> /dev/null  > /dev/null

git commit -a -m 'rebuilt library files'
git push --all



echo "Done. You can now continue work on the new version:"
node lib/cli.js -V


popd                                                                                                    2> /dev/null  > /dev/null


<commit_msg>updated git tag and build and publish script to prevent future booboo's due to files getting deleted and not regenerated due to script errors.<commit_after>#! /bin/bash
#


#
# check if important files exist; if not, abort mission!
# Prevent major boo-boo's which only pollute our git repo!
# 
are_we_okay() {
	if ! file_exists lib/util/ebnf-parser.js ; then
		return 1;  // fail
	fi
	if ! file_exists lib/util/ebnf-transform.js ; then
		return 1;  // fail
	fi
	if ! file_exists lib/util/lex-parser.js ; then
		return 1;  // fail
	fi
	if ! file_exists lib/util/parser.js ; then
		return 1;  // fail
	fi
	if ! file_exists lib/util/regexp-lexer.js ; then
		return 1;  // fail
	fi
	if ! file_exists lib/util/set.js ; then
		return 1;  // fail
	fi
	if ! file_exists lib/util/transform-parser.js ; then
		return 1;  // fail
	fi
	if ! file_exists lib/util/typal.js ; then
		return 1;  // fail
	fi
	return 0; 	 // ok!
} 

file_exists() {
	if test -n "$1" && test -f "$1"; then
		return 0;  // ok 
	else
		return 1;  // fail
	fi
}


# ---------------------------------------------------------------------------




pushd $(dirname $0)                                                                                     2> /dev/null  > /dev/null


# to emulate GOTO: we run a loop and BREAK out of it:
while true; do


# ---------------------------------------------------------------------------
# stage 1: rebuild all libraries from scratch, using existing NPM packages.
#          Commit. (`npm install` fails often enough that we invoke the bastard TWICE!)
# ---------------------------------------------------------------------------

make superclean ; make prep ; make prep ; make site


if ! are_we_okay ; then break; fi; 			# GOTO END on failure


# git submodule foreach git commit -a -m 'rebuilt library files'
# ^-- one or more subrepo's may fail as there'ld be nothing to commit,
#     which would abort the `git submodule foreach` command!
pushd modules/ebnf-parser/                                                                                     2> /dev/null  > /dev/null
git commit -a -m 'rebuilt library files'
git push --all
popd                                                                                                           2> /dev/null  > /dev/null
pushd modules/jison2json/                                                                                      2> /dev/null  > /dev/null
git commit -a -m 'rebuilt library files'
git push --all
popd                                                                                                           2> /dev/null  > /dev/null
pushd modules/jison-lex/                                                                                       2> /dev/null  > /dev/null
git commit -a -m 'rebuilt library files'
git push --all
popd                                                                                                           2> /dev/null  > /dev/null
pushd modules/json2jison/                                                                                      2> /dev/null  > /dev/null
git commit -a -m 'rebuilt library files'
git push --all
popd                                                                                                           2> /dev/null  > /dev/null
pushd modules/lex-parser/                                                                                      2> /dev/null  > /dev/null
git commit -a -m 'rebuilt library files'
git push --all
popd                                                                                                           2> /dev/null  > /dev/null

git commit -a -m 'rebuilt library files'
git push --all


make superclean ; make prep ; make prep ; make site


if ! are_we_okay ; then break; fi; 			# GOTO END on failure


pushd modules/ebnf-parser/                                                                                     2> /dev/null  > /dev/null
git commit -a -m 'rebuilt library files'
git push --all
popd                                                                                                           2> /dev/null  > /dev/null
pushd modules/jison2json/                                                                                      2> /dev/null  > /dev/null
git commit -a -m 'rebuilt library files'
git push --all
popd                                                                                                           2> /dev/null  > /dev/null
pushd modules/jison-lex/                                                                                       2> /dev/null  > /dev/null
git commit -a -m 'rebuilt library files'
git push --all
popd                                                                                                           2> /dev/null  > /dev/null
pushd modules/json2jison/                                                                                      2> /dev/null  > /dev/null
git commit -a -m 'rebuilt library files'
git push --all
popd                                                                                                           2> /dev/null  > /dev/null
pushd modules/lex-parser/                                                                                      2> /dev/null  > /dev/null
git commit -a -m 'rebuilt library files'
git push --all
popd                                                                                                           2> /dev/null  > /dev/null

git commit -a -m 'rebuilt library files'
git push --all


# ---------------------------------------------------------------------------
# stage 2: Tag and Publish.
# ---------------------------------------------------------------------------


make git-tag

if ! are_we_okay ; then break; fi; 			# GOTO END on failure

npm publish


# ---------------------------------------------------------------------------
# stage 3: Bump build revision for future work, commit & push.
# ---------------------------------------------------------------------------


make bump


if ! are_we_okay ; then break; fi; 			# GOTO END on failure


# git submodule foreach git commit -a -m 'rebuilt library files'
# ^-- one or more subrepo's may fail as there'ld be nothing to commit,
#     which would abort the `git submodule foreach` command!
pushd modules/ebnf-parser/                                                                                     2> /dev/null  > /dev/null
git commit -a -m 'bumped build revision'
git push --all
popd                                                                                                           2> /dev/null  > /dev/null
pushd modules/jison2json/                                                                                      2> /dev/null  > /dev/null
git commit -a -m 'bumped build revision'
git push --all
popd                                                                                                           2> /dev/null  > /dev/null
pushd modules/jison-lex/                                                                                       2> /dev/null  > /dev/null
git commit -a -m 'bumped build revision'
git push --all
popd                                                                                                           2> /dev/null  > /dev/null
pushd modules/json2jison/                                                                                      2> /dev/null  > /dev/null
git commit -a -m 'bumped build revision'
git push --all
popd                                                                                                           2> /dev/null  > /dev/null
pushd modules/lex-parser/                                                                                      2> /dev/null  > /dev/null
git commit -a -m 'bumped build revision'
git push --all
popd                                                                                                           2> /dev/null  > /dev/null

git commit -a -m 'bumped build revision'
git push --all


# ---------------------------------------------------------------------------
# stage 4: update NPM packages, if any; rebuild & commit
# ---------------------------------------------------------------------------


# rebuild everything before we go and tag the buggers!
#make git-tag
#make site

#../../../util/git_pull_push.sh -f

pushd modules/ebnf-parser/                                                                                     2> /dev/null  > /dev/null
ncu -a --packageFile package.json 
git commit -a -m 'updated NPM packages'
git push --all
popd                                                                                                           2> /dev/null  > /dev/null
pushd modules/jison2json/                                                                                      2> /dev/null  > /dev/null
ncu -a --packageFile package.json 
git commit -a -m 'updated NPM packages'
git push --all
popd                                                                                                           2> /dev/null  > /dev/null
pushd modules/jison-lex/                                                                                       2> /dev/null  > /dev/null
ncu -a --packageFile package.json 
git commit -a -m 'updated NPM packages'
git push --all
popd                                                                                                           2> /dev/null  > /dev/null
pushd modules/json2jison/                                                                                      2> /dev/null  > /dev/null
ncu -a --packageFile package.json 
git commit -a -m 'updated NPM packages'
git push --all
popd                                                                                                           2> /dev/null  > /dev/null
pushd modules/lex-parser/                                                                                      2> /dev/null  > /dev/null
ncu -a --packageFile package.json 
git commit -a -m 'updated NPM packages'
git push --all
popd                                                                                                           2> /dev/null  > /dev/null

ncu -a --packageFile package.json 
git commit -a -m 'updated NPM packages'
git push --all


make superclean ; make prep ; make prep ; make site


if ! are_we_okay ; then break; fi; 			# GOTO END on failure


pushd modules/ebnf-parser/                                                                                     2> /dev/null  > /dev/null
git commit -a -m 'rebuilt library files'
git push --all
popd                                                                                                           2> /dev/null  > /dev/null
pushd modules/jison2json/                                                                                      2> /dev/null  > /dev/null
git commit -a -m 'rebuilt library files'
git push --all
popd                                                                                                           2> /dev/null  > /dev/null
pushd modules/jison-lex/                                                                                       2> /dev/null  > /dev/null
git commit -a -m 'rebuilt library files'
git push --all
popd                                                                                                           2> /dev/null  > /dev/null
pushd modules/json2jison/                                                                                      2> /dev/null  > /dev/null
git commit -a -m 'rebuilt library files'
git push --all
popd                                                                                                           2> /dev/null  > /dev/null
pushd modules/lex-parser/                                                                                      2> /dev/null  > /dev/null
git commit -a -m 'rebuilt library files'
git push --all
popd                                                                                                           2> /dev/null  > /dev/null

git commit -a -m 'rebuilt library files'
git push --all



echo "Done. You can now continue work on the new version:"
node lib/cli.js -V


# end of BREAK-as-emulation-of-GOTO loop:
break
done


popd                                                                                                    2> /dev/null  > /dev/null


{'fraction_non_alphanumeric': 0.12151273609426443, 'fraction_numerical': 0.006368047132212788, 'mean_word_length': 0.6071428571428571, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 211, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 466, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4645681', 'n_tokens_mistral': 4627, 'n_tokens_neox': 4409, 'n_words': 1646}