diff --git a/plugins/available/pyenv-virtualenv.plugin.bash b/plugins/available/pyenv-virtualenv.plugin.bash new file mode 100644 index 00000000..1f45dcb2 --- /dev/null +++ b/plugins/available/pyenv-virtualenv.plugin.bash @@ -0,0 +1,58 @@ +# make sure virtualenvwrapper is enabled if available + +cite about-plugin +about-plugin 'pyenv-virtualenvwrapper helper functions' + +export PYENV_VIRTUALENVWRAPPER_PREFER_PYVENV="true" + +# Activate autoenv +source /usr/local/opt/autoenv/activate.sh + +function mkenv { + about 'create a new virtualenv for this directory' + group 'pyenv-virtualenv' + + eval "touch .env" + eval "echo \"#!/bin/bash\" >> .env" + eval "echo \"eval \"wovenv\"\" >> .env" + cwd=`basename \`pwd\`` + mkvirtualenv --distribute $cwd +} + +function mkvbranch { + about 'create a new virtualenv for the current branch' + group 'pyenv-virtualenv' + + mkvirtualenv --distribute "$(basename `pwd`)@$SCM_BRANCH" +} + +function wovbranch { + about 'sets workon branch' + group 'pyenv-virtualenv' + + workon "$(basename `pwd`)@$SCM_BRANCH" +} + +function wovenv { + about 'works on the virtualenv for this directory' + group 'virtualenv' + + workon "$(basename `pwd`)" +} + +function rmenv { + about 'removes virtualenv for this directory' + group 'virtualenv' + + eval "deactivate" + rmvirtualenv "$(basename `pwd`)" + eval "rm .env" +} + +function rmenvbranch { + about 'removes virtualenv for this directory' + group 'virtualenv' + + eval "deactivate" + rmvirtualenv "$(basename `pwd`)@$SCM_BRANCH" +} \ No newline at end of file diff --git a/plugins/available/pyenv.plugin.bash b/plugins/available/pyenv.plugin.bash index 7ed2d3cd..a9034ee7 100644 --- a/plugins/available/pyenv.plugin.bash +++ b/plugins/available/pyenv.plugin.bash @@ -1,8 +1,9 @@ cite about-plugin about-plugin 'load pyenv, if you are using it' -export PYENV_ROOT="$HOME/.pyenv" -export PATH="$PYENV_ROOT/bin:$PATH" +export PYENV_PATH=`which pyenv` +export PATH="$PYENV_PATH:$PATH" + [[ `which pyenv` ]] && eval "$(pyenv init -)" #Load pyenv virtualenv if the virtualenv plugin is installed. diff --git a/themes/bobby/bobby.theme.bash b/themes/bobby/bobby.theme.bash index 308b412b..ccb71edd 100644 --- a/themes/bobby/bobby.theme.bash +++ b/themes/bobby/bobby.theme.bash @@ -14,7 +14,7 @@ RVM_THEME_PROMPT_SUFFIX="|" function prompt_command() { #PS1="${bold_cyan}$(scm_char)${green}$(scm_prompt_info)${purple}$(ruby_version_prompt) ${yellow}\h ${reset_color}in ${green}\w ${reset_color}\n${green}→${reset_color} " - PS1="\n${yellow}$(ruby_version_prompt) ${purple}\h ${reset_color}in ${green}\w\n${bold_cyan}$(scm_char)${green}$(scm_prompt_info) ${green}→${reset_color} " + PS1="\n${yellow}$(virtualenv_prompt)$(ruby_version_prompt) ${purple}\h ${reset_color}in ${green}\w\n${bold_cyan}$(scm_char)${green}$(scm_prompt_info) ${green}→${reset_color} " } PROMPT_COMMAND=prompt_command;