Disallow tabs in testing script.

This commit is contained in:
Sergio Benitez 2016-12-28 22:33:56 -06:00
parent 8deac6dba9
commit 7a882fd967
4 changed files with 18 additions and 5 deletions

View File

@ -23,6 +23,7 @@ function relative() {
fi
}
ROOT_DIR=$(relative "") || exit $?
EXAMPLES_DIR=$(relative "examples") || exit $?
LIB_DIR=$(relative "lib") || exit $?
CODEGEN_DIR=$(relative "codegen") || exit $?

View File

@ -5,7 +5,7 @@ set -e
# Builds the rustdocs for all of the libraries.
#
# Brings in: EXAMPLES_DIR, LIB_DIR, CODEGEN_DIR, and CONTRIB_DIR, DOC_DIR
# Brings in: ROOT_DIR, EXAMPLES_DIR, LIB_DIR, CODEGEN_DIR, CONTRIB_DIR, DOC_DIR
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source $SCRIPT_DIR/config.sh

View File

@ -5,7 +5,7 @@ set -e
# Publishes the current versions of core, contrib, and codegen to crates.io.
#
# Brings in: EXAMPLES_DIR, LIB_DIR, CODEGEN_DIR, CONTRIB_DIR, DOC_DIR
# Brings in: ROOT_DIR, EXAMPLES_DIR, LIB_DIR, CODEGEN_DIR, CONTRIB_DIR, DOC_DIR
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source $SCRIPT_DIR/config.sh

View File

@ -1,7 +1,7 @@
#!/bin/bash
set -e
# Brings in: EXAMPLES_DIR, LIB_DIR, CODEGEN_DIR, and CONTRIB_DIR, DOC_DIR
# Brings in: ROOT_DIR, EXAMPLES_DIR, LIB_DIR, CODEGEN_DIR, CONTRIB_DIR, DOC_DIR
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source $SCRIPT_DIR/config.sh
@ -27,8 +27,6 @@ function build_and_test() {
# Checks that the versions for Cargo projects $@ all match
function check_versions_match() {
echo ":: Ensuring all crate versions match..."
local last_version=""
for dir in $@; do
local cargo_toml="${dir}/Cargo.toml"
@ -47,8 +45,22 @@ function check_versions_match() {
done
}
# Ensures there are not tabs in any file in the directories $@.
function ensure_tab_free() {
local matches=$(egrep -I -R '\t' $ROOT_DIR | egrep -v '/target|/.git|LICENSE')
if ! [ -z "${matches}" ]; then
echo "Tab characters were found in the following:"
echo "${matches}"
exit 1
fi
}
echo ":: Ensuring all crate versions match..."
check_versions_match "${LIB_DIR}" "${CODEGEN_DIR}" "${CONTRIB_DIR}"
echo ":: Checking for tabs..."
ensure_tab_free
# Update dependencies before running tests.
echo ":: Updating dependencies..."
cargo update