Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 42 lines (34 sloc) 1.33 KB
#!/bin/bash
RVM_AFTERCD_HOOK_PATH="$HOME/.rvm/hooks/after_cd_gpair"
function install_rvm_hook() {
echo " Installing gpair hook into rvm..."
touch $RVM_AFTERCD_HOOK_PATH
echo "[[ -f \"\$PWD/.gpairrc\" && \"\$PWD\" != \"\$HOME\" ]] && gpair --gpairrc \"\$PWD/.gpairrc\"" >> $RVM_AFTERCD_HOOK_PATH
}
if [[ -s "$HOME/.rvm/scripts/rvm" ]]; then
echo "[!] Rvm detected."
[[ -d "$HOME/.rvm/hooks" ]] || mkdir -p "$HOME/.rvm/hooks"
if [[ ! -f "$RVM_AFTERCD_HOOK_PATH" ]]; then
install_rvm_hook
else
echo " Checking gpair hook..."
gpair_hook_string="^.*\[\[\ \-f\ \"\\$\PWD\/\.gpairrc\"\ \&\&\ \"\\$\PWD\"\ \!\=\ \"\\$\HOME\"\ \]\]\ \&\&\ gpair\ \-\-gpairrc\ \"\\$\PWD\/.gpairrc\""
AFTER_CD_HOOK=`cat $RVM_AFTERCD_HOOK_PATH`
if [[ $AFTER_CD_HOOK =~ $gpair_hook_string ]]; then
echo " Gpair hook already present. Nothing todo."
else
echo " Adding gpair hook to $RVM_AFTERCD_HOOK_PATH"
install_rvm_hook
fi
fi
fi
printf "
${name:-"${USER:-$(whoami)}"},
Thank you very much for using gpair !
I hope it helps to make your work more funny =)
To finalize the installation, please insert the following line
at the end of your shell's loading files
(.bashrc or .bash_profile for bash and .zshrc for zsh):
[[ -s $HOME/.gpair/gpair ]] && source $HOME/.gpair/gpair
When it's done, CLOSE THIS SHELL and open a new one in order to use gpair.
"
Jump to Line
Something went wrong with that request. Please try again.