Skip to content

Instantly share code, notes, and snippets.

@mithrandi
Last active August 29, 2015 14:18
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 mithrandi/d1e9248300d25015892d to your computer and use it in GitHub Desktop.
Save mithrandi/d1e9248300d25015892d to your computer and use it in GitHub Desktop.
Fish function for development with axiomatic
function ax
if not set -q PROJECT
set PROJECT (basename $VIRTUAL_ENV)
end
set -l SOURCEDIR {$HOME}/code/{$PROJECT}
if test -z "$PROJECT" -o ! -d "$SOURCEDIR"
echo "Unable to locate project; do you have a virtualenv activated?"
return 1
end
set -l BRANCH (hg --repository $SOURCEDIR branch)
set -l BASE {$HOME}/deployment/{$PROJECT}
set -l DEFAULT_STORE {$BASE}/default.axiom
if test $status -ne 0
return $status
end
set -l BRANCH_STORE {$BASE}/{$BRANCH}.axiom
if test ! -d "$BRANCH_STORE"
if test -e "$BRANCH_STORE"
echo "Refusing to overwrite non-directory {$BRANCH_STORE}."
return 1
end
command cp --recursive $DEFAULT_STORE $BRANCH_STORE
if test $status -ne 0
return $status
end
end
command axiomatic -d $BRANCH_STORE $argv
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment