<commit_before>#!/bin/bash

if [ ! "$#" -eq 1 ]; then
#    echo >&2 "Usage: $0 [orion-codemirror repo directory]"
    echo >&2 "Usage: cat $0 | bash -s [orion-codemirror repo directory]"
    exit 1
fi

projDir=$1
buildDir=build
outDir=out

function check_err() {
	if [[ "$1" -ne "0" ]]; then
		echo $2
		exit $1
	fi
}

# reset gh-pages to latest in master
pushd $projDir
echo "Checking out gh-pages..."
git checkout -f gh-pages
check_err $? "checkout failed."
echo "Resetting gh-pages to master..."
git reset --hard master
check_err $? "reset failed."

# run the build
pushd $buildDir
./build.sh
sleep 2
check_err $? "Build failed."
popd

# Commit the built code
git add $outDir
git commit -m "Update built code for gh-pages"

# Copy the resulting codeMirrorPlugin.html and js/ to the toplevel project folder, so http://mamacdon.github.io/orion-codemirror/codeMirrorPlugin.html will work
pushd $outDir
echo Copying $outDir/codeMirrorPlugin.html to $projDir
cp codeMirrorPlugin.html ../
cp -r ./js ../
popd

# Commit the change from previous step
git add codeMirrorPlugin.html
git add js
git commit -m "Copy built code to project root for gh-pages"

# clean up
git co master
git clean -df codeMirrorPlugin.html
git clean -df js
git clean -df out

echo 
echo To update the GitHub page, run:
echo 
echo cd "$projDir" "&&" git push -f origin gh-pages:refs/heads/gh-pages

#popd
#popd<commit_msg>Update deploy script to push to Google Code<commit_after>#!/bin/bash

if [ ! "$#" -eq 1 ]; then
#    echo >&2 "Usage: $0 [orion-codemirror repo directory]"
    echo >&2 "Usage: cat $0 | bash -s [orion-codemirror repo directory]"
    exit 1
fi

projDir=$1
buildDir=build
outDir=out

function check_err() {
	if [[ "$1" -ne "0" ]]; then
		echo $2
		exit $1
	fi
}

# reset gh-pages to latest in master
pushd $projDir
echo "Checking out gh-pages..."
git checkout -f gh-pages
check_err $? "checkout failed."
echo "Resetting gh-pages to master..."
git reset --hard master
check_err $? "reset failed."

# run the build
pushd $buildDir
./build.sh
sleep 2
check_err $? "Build failed."
popd

# Commit the built code
git add $outDir
git commit -m "Update built code for gh-pages"

# Copy the resulting codeMirrorPlugin.html and js/ to the toplevel project folder, so http://mamacdon.github.io/orion-codemirror/codeMirrorPlugin.html will work
pushd $outDir
echo Copying $outDir/codeMirrorPlugin.html to $projDir
cp codeMirrorPlugin.html ../
cp -r ./js ../
popd

# Commit the change from previous step
git add codeMirrorPlugin.html
git add js
git commit -m "Copy built code to project root for gh-pages"

# clean up
git co master
git clean -df codeMirrorPlugin.html
git clean -df js
git clean -df out

echo 
echo To update the Google Code mirror, run:
echo 
echo cd "$projDir" "&&" git push -f googlecode gh-pages:refs/heads/master

#popd
#popd
{'fraction_non_alphanumeric': 0.11237149946827366, 'fraction_numerical': 0.008507621410847217, 'mean_word_length': 3.672185430463576, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '2077297', 'n_tokens_mistral': 1031, 'n_tokens_neox': 965, 'n_words': 377}