Skip to content

Instantly share code, notes, and snippets.

@catharinejm
Last active August 29, 2015 14:18
Show Gist options
  • Save catharinejm/932eedbd58d98f7eda2d to your computer and use it in GitHub Desktop.
Save catharinejm/932eedbd58d98f7eda2d to your computer and use it in GitHub Desktop.
Coffeescript Nave shim
#!/usr/bin/env zsh
set -e
function nave_version_file {
file="$(pwd)/.nave-version"
if [ -f "$file" ]; then
echo "$file"
elif `git rev-parse &>/dev/null`; then
file="$(git rev-parse --show-toplevel)/.nave-version"
if [ -f "$file" ]; then
echo "$file"
fi
fi
}
function nave_version {
file=$(nave_version_file)
if [[ "$file" ]]; then
head -n1 $(nave_version_file)
fi
}
if [ -z "$NAVE" ]; then
version=$(nave_version)
if [[ "$version" ]]; then
exec nave use "$version" coffee "$@"
fi
echo 'no nave version!' >&2
exit 1
fi
exec "$NAVEPATH/coffee" "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment