|
|
|
|
@ -5,14 +5,35 @@ echo "# Install testing tools."
|
|
|
|
|
echo "# Only works with Ubuntu / APT."
|
|
|
|
|
echo "# --------------------------------------"
|
|
|
|
|
|
|
|
|
|
hook_script_name=".git/hooks/pre-push"
|
|
|
|
|
hook_script_path=".git/hooks/pre-push"
|
|
|
|
|
hook_script=$(
|
|
|
|
|
cat << 'EOF'
|
|
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
|
|
diff_command="git diff --no-ext-diff --ignore-submodules"
|
|
|
|
|
|
|
|
|
|
old_diff=$($diff_command)
|
|
|
|
|
|
|
|
|
|
./lint.sh -f
|
|
|
|
|
exit_code=$?
|
|
|
|
|
|
|
|
|
|
new_diff=$($diff_command)
|
|
|
|
|
|
|
|
|
|
if [[ "$new_diff" != "$old_diff" ]]; then
|
|
|
|
|
echo "Files were modified by the linter, amend your commit and try again"
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
exit $exit_code
|
|
|
|
|
EOF
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
if [ -t 1 ]; then
|
|
|
|
|
echo "Install a git hook to automatically lint files before pushing? (y/N)"
|
|
|
|
|
read yn
|
|
|
|
|
if [[ "$yn" == [Yy]* ]]; then
|
|
|
|
|
echo "./lint.sh -f" >>$hook_script_name
|
|
|
|
|
echo "pre-push hook installed to $hook_script_name"
|
|
|
|
|
echo "$hook_script" > "$hook_script_path"
|
|
|
|
|
echo "pre-push hook installed to $hook_script_path"
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
@ -69,7 +90,7 @@ install_apt() {
|
|
|
|
|
|
|
|
|
|
tar -C /tmp -xJf /tmp/zig.tar.xz
|
|
|
|
|
|
|
|
|
|
mv /tmp/zig-linux-x86_64-* ${ZIGPATH} 2>/dev/null >/dev/null || true
|
|
|
|
|
mv /tmp/zig-linux-x86_64-* ${ZIGPATH} &> /dev/null || true
|
|
|
|
|
echo "Zig installed to ${ZIGPATH}"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|