<commit_before>#!/bin/sh
###############
# Task Runner #
###############

# To make this file runnable:
#    $ chmod +x *.sh.command

projectHome=$(cd $(dirname $0); pwd)

info() {
   # Check for Node.js installation and download project dependencies
   cd $projectHome
   pwd
   echo
   echo "Node.js:"
   which node || { echo "Need to install Node.js: https://nodejs.org"; exit; }
   node --version
   npm install
   npm update
   npm outdated
   echo
   }

releaseInstructions() {
   cd $projectHome
   version=$(grep '"version"' package.json | awk -F'"' '{print $4}')
   echo "To tag this release:"
   echo "   cd $(pwd)"
   echo "   git tag --annotate --force --message 'Stable release' v$version"
   echo "   git remote --verbose"
   echo "   git push origin --tags --force"
   echo "   git tag"
   echo "   npm publish"
   echo
   }

publishSample() {
   cd $projectHome
   publishWebRoot=$(grep ^DocumentRoot /private/etc/apache2/httpd.conf | awk -F\" '{ print $2 }')
   publishFolder=$publishWebRoot/centerkey.com
   copyWebFiles() {
      echo "Publishing:"
      mkdir -p $publishFolder/hamburger-menu/dist
      mkdir -p $publishFolder/hamburger-menu/spec
      cp -v  dist/* $publishFolder/hamburger-menu/dist
      cp -vR spec/* $publishFolder/hamburger-menu/spec
      echo
      }
   test -w $publishFolder && copyWebFiles
   }

runTests() {
   cd $projectHome
   npm test
   echo
   }

openWebBrowser() {
   url=http://localhost:9776/spec
   test -z $(pgrep -f 9776) && npm run web-server  #to shutdown web server: pkill -f 9776
   pgrep -fl 9776
   echo "Opening:"
   echo "   $url"
   echo
   sleep 2
   open $url
   }

echo
echo "Task Runner"
echo "==========="
info
releaseInstructions
publishSample
runTests
openWebBrowser
<commit_msg>Prevent script error if too many releases<commit_after>#!/bin/sh
###############
# Task Runner #
###############

# To make this file runnable:
#    $ chmod +x *.sh.command

projectHome=$(cd $(dirname $0); pwd)

info() {
   # Check for Node.js installation and download project dependencies
   cd $projectHome
   pwd
   echo
   echo "Node.js:"
   which node || { echo "Need to install Node.js: https://nodejs.org"; exit; }
   node --version
   npm install
   npm update
   npm outdated
   echo
   }

releaseInstructions() {
   cd $projectHome
   version=$(grep '"version"' package.json | awk -F'"' '{print $4}')
   echo "To tag this release:"
   echo "   cd $(pwd)"
   echo "   git tag --annotate --force --message 'Stable release' v$version"
   echo "   git remote --verbose"
   echo "   git push origin --tags --force"
   echo "   git tag | tail -10"
   echo "   npm publish"
   echo
   }

publishSample() {
   cd $projectHome
   publishWebRoot=$(grep ^DocumentRoot /private/etc/apache2/httpd.conf | awk -F\" '{ print $2 }')
   publishFolder=$publishWebRoot/centerkey.com
   copyWebFiles() {
      echo "Publishing:"
      mkdir -p $publishFolder/hamburger-menu/dist
      mkdir -p $publishFolder/hamburger-menu/spec
      cp -v  dist/* $publishFolder/hamburger-menu/dist
      cp -vR spec/* $publishFolder/hamburger-menu/spec
      echo
      }
   test -w $publishFolder && copyWebFiles
   }

runTests() {
   cd $projectHome
   npm test
   echo
   }

openWebBrowser() {
   url=http://localhost:9776/spec
   test -z $(pgrep -f 9776) && npm run web-server  #to shutdown web server: pkill -f 9776
   pgrep -fl 9776
   echo "Opening:"
   echo "   $url"
   echo
   sleep 2
   open $url
   }

echo
echo "Task Runner"
echo "==========="
info
releaseInstructions
publishSample
runTests
openWebBrowser

{'fraction_non_alphanumeric': 0.14241486068111456, 'fraction_numerical': 0.01238390092879257, 'mean_word_length': 2.784877529286475, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6307598', 'n_tokens_mistral': 1239, 'n_tokens_neox': 1175, 'n_words': 348}