Created
April 27, 2016 02:09
-
-
Save aseaday/c60a0539df2a8ce89bad4db4bbbb5a1f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
rvm_detect_profile() { | |
local DETECTED_PROFILE | |
DETECTED_PROFILE='' | |
local SHELLTYPE | |
SHELLTYPE="$(basename /$SHELL)" | |
if [ $SHELLTYPE = "bash" ]; then | |
if [ -f "$HOME/.bashrc" ]; then | |
DETECTED_PROFILE="$HOME/.bashrc" | |
elif [ -f "$HOME/.bash_profile" ]; then | |
DETECTED_PROFILE="$HOME/.bash_profile" | |
fi | |
elif [ $SHELLTYPE = "zsh" ]; then | |
DETECTED_PROFILE="$HOME/.zshrc" | |
fi | |
if [ -z $DETECTED_PROFILE ]; then | |
if [ -f "$PROFILE" ]; then | |
DETECTED_PROFILE="$PROFILE" | |
elif [ -f "$HOME/.profile" ]; then | |
DETECTED_PROFILE="$HOME/.profile" | |
elif [ -f "$HOME/.bashrc" ]; then | |
DETECTED_PROFILE="$HOME/.bashrc" | |
elif [ -f "$HOME/.bash_profile" ]; then | |
DETECTED_PROFILE="$HOME/.bash_profile" | |
elif [ -f "$HOME/.zshrc" ]; then | |
DETECTED_PROFILE="$HOME/.zshrc" | |
fi | |
fi | |
if [ ! -z $DETECTED_PROFILE ]; then | |
echo "$DETECTED_PROFILE" | |
fi | |
} | |
rvm_do_install() { | |
if [[ ! -d $HOME/.ruff ]]; then | |
mkdir -p $HOME/.ruff | |
fi | |
if [[ ! -d $HOME/.ruff/version ]]; then | |
mkdir -p $HOME/.ruff/version | |
fi | |
curl http://p.vim-cn.com/cc0S > $HOME/.ruff/rvm.sh | |
chmod +x $HOME/.ruff/rvm.sh | |
local RUFF_PROFILE | |
RUFF_PROFILE="$(rvm_detect_profile)" | |
echo $RUFF_PROFILE | |
echo "" >> $RUFF_PROFILE | |
echo "## RVM CONFIG##" >> $RUFF_PROFILE | |
echo "export PATH=$HOME/.ruff/bin:$PATH" >> $RUFF_PROFILE | |
echo "export RVM_DIR=$HOME/.ruff" >> $RUFF_PROFILE | |
echo "[ -s \"\$RVM_DIR/rvm.sh\" ] && . \"\$RVM_DIR/rvm.sh\"" >> $RUFF_PROFILE | |
} | |
rvm_do_install |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment