Skip to content

Instantly share code, notes, and snippets.

@gradha
Last active June 21, 2018 21:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gradha/aff3c6d53657a27e4cae to your computer and use it in GitHub Desktop.
Save gradha/aff3c6d53657a27e4cae to your computer and use it in GitHub Desktop.
#!/bin/sh
# Set errors to bail out.
set -e
# Display commands
#set -v
BASE_DIR=~/shelltest_dropbox_filename_sanitizer
TEST_DIR="${BASE_DIR}/1398956253"
NIM_DIR="${TEST_DIR}/compiler"
NIM_BIN="${NIM_DIR}/bin/nimrod"
BABEL_CFG=~/.babel
BABEL_BIN="${BABEL_CFG}/bin"
BABEL_SRC="${TEST_DIR}/babel"
# Try to purge babel absolute temp directory for reruns and other users. See
# https://github.com/nimrod-code/babel/issues/28.
trap "rm -Rf /tmp/babel" EXIT
rm -Rf "${BASE_DIR}" "${BABEL_CFG}"
if test -d "${BASE_DIR}"; then
echo "Could not purge $BASE_DIR"
exit 1
fi
mkdir -p "${TEST_DIR}"
echo "Downloading Nimrod compiler 'devel'…"
git clone -q --depth 1 -b devel git://github.com/Araq/Nimrod.git "${NIM_DIR}"
git clone -q --depth 1 -b master git://github.com/nimrod-code/csources "${NIM_DIR}/csources"
echo "Compiling csources (master)…"
cd "${NIM_DIR}/csources"
sh build.sh 2>&1 >/dev/null
echo "Compiling koch…"
cd "${NIM_DIR}"
bin/nimrod c koch 2>&1 >/dev/null
echo "Compiling Nimrod…"
./koch boot -d:release 2>&1 >/dev/null
echo "Testing Nimrod compiler invokation through adhoc path…"
export PATH="${NIM_DIR}/bin:${PATH}"
which nimrod
nimrod -v|grep "Nimrod Compiler Version"
echo "Downloading Babel package manager…"
git clone -q --depth 1 https://github.com/nimrod-code/babel.git "${BABEL_SRC}"
cd "${BABEL_SRC}"
echo "Compiling Babel…"
nimrod c -r src/babel install 2>&1 >/dev/null
echo "Installing Babel itself through environment path…"
export PATH="${BABEL_BIN}:${PATH}"
babel update 2>&1 >/dev/null
babel install -y babel 2>&1 >/dev/null
babel update
babel install argument_parser
babel install dropbox_filename_sanitizer
echo "Testing installed binary version."
dropbox_filename_sanitizer -v | grep "0.4.0"
echo "Test script finished successfully, removing stuff…"
rm -Rf "${BASE_DIR}" "${BABEL_CFG}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment