Skip to content

Instantly share code, notes, and snippets.

@sorin-ionescu
Last active October 2, 2015 02:38
Show Gist options
  • Save sorin-ionescu/2154419 to your computer and use it in GitHub Desktop.
Save sorin-ionescu/2154419 to your computer and use it in GitHub Desktop.
Make a self contained hubugs
#!/bin/zsh
if (( ! $+commands[virtualenv] )); then
print "$0: no such command: virtualenv" >&2
return 1
fi
if (( ! $+commands[git] )); then
print "$0: no such command: git" >&2
return 1
fi
out='hubugs'
executable="$out/bin/hubugs"
environment="$out/libexec/hubugs"
if [[ -d "$out" ]]; then
print "$0: already exists: $out" >&2
return 1
fi
mkdir -p "$executable:h"
mkdir -p "$environment"
virtualenv "$environment"
path=("$environment/bin" $path)
pip install termcolor
pip install 'git+https://github.com/JNRowe/hubugs.git#egg=hubugs'
virtualenv --relocatable "$environment"
print '#!/bin/zsh
"${0:A:h:h}/libexec/hubugs/bin/hubugs" "$@"' > "$executable"
chmod u+x "$executable"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment