This is still a dirty prototype, so please excuse the mess. Please excuse the fact that this is a mega patch. Once things settle down this won't happen any more. Some of the changes squashed into here include: * Merge vertex loop with type loop (The file watcher seems to cache events anyways) * Improve pgraph library * Add indegree, outdegree, and topological sort with tests * Add reverse function for vertex list * Tons of additional cleanup! Amazingly, on my first successful compile, this seemed to run! A special thanks to Ira Cooper who helped me talk through some of the algorithmic decisions and for his help in finding better ones!
52 lines
1002 B
Bash
Executable File
52 lines
1002 B
Bash
Executable File
#!/bin/bash
|
|
# check for any yaml files that aren't properly formatted
|
|
|
|
set -o errexit
|
|
set -o nounset
|
|
set -o pipefail
|
|
|
|
if env | grep -q '^TRAVIS=true$'; then
|
|
echo "Travis gives wonky results here, skipping test!"
|
|
exit 0
|
|
fi
|
|
|
|
ROOT=$(dirname "${BASH_SOURCE}")/..
|
|
|
|
RUBY=`which ruby`
|
|
if [ -z $RUBY ]; then
|
|
echo "The 'ruby' utility can't be found."
|
|
exit 1
|
|
fi
|
|
|
|
$RUBY -e "require 'yaml'" 2>/dev/null || (
|
|
echo "The ruby 'yaml' library can't be found."
|
|
exit 1
|
|
)
|
|
|
|
cd "${ROOT}"
|
|
|
|
find_files() {
|
|
find . -not \( \
|
|
\( \
|
|
-wholename './old' \
|
|
-o -wholename './tmp' \
|
|
-o -wholename './omv.yaml' \
|
|
\) -prune \
|
|
\) -name '*.yaml'
|
|
}
|
|
|
|
bad_files=$(
|
|
for i in $(find_files); do
|
|
if ! diff -q <( ruby -e "require 'yaml'; puts YAML.load_file('$i').to_yaml.each_line.map(&:rstrip).join(10.chr)+10.chr" 2>/dev/null ) <( cat "$i" ) &>/dev/null; then
|
|
echo "$i"
|
|
fi
|
|
done
|
|
)
|
|
|
|
if [[ -n "${bad_files}" ]]; then
|
|
echo 'FAIL'
|
|
echo 'The following files are not properly formatted:'
|
|
echo "${bad_files}"
|
|
exit 1
|
|
fi
|