Skip to content

Instantly share code, notes, and snippets.

@xtetsuji
Forked from ytnobody/plenvsetup
Created May 31, 2014 19:34
Show Gist options
  • Save xtetsuji/ce60340dbfbddf6658c5 to your computer and use it in GitHub Desktop.
Save xtetsuji/ce60340dbfbddf6658c5 to your computer and use it in GitHub Desktop.
#!/bin/bash
# plenvを自動的に入れてくれるやつです
set -e
if [[ $(which plenv 2> /dev/null) ]]; then
echo 'plenv already installed.'
elif [[ ! $(which git) ]]; then
echo 'git is not installed!!!!!!!'
exit 1;
else
PLENV_REPO=git://github.com/tokuhirom/plenv.git
PLENV_ROOT=$HOME/.plenv
PERLBUILDER_REPO=git://github.com/tokuhirom/Perl-Build.git
PLENV_PLUGIN_DIR=$PLENV_ROOT/plugins
write_profile () {
local prof_file
for prof_file in "$HOME/.zprofile" "$HOME/.bash_profile" ; do
if [[ $(grep "$1" "$prof_file" | wc -l) -le 0 ]]; then
echo "$1" >> $prof_file
fi
done
}
### setup plenv
git clone $PLENV_REPO $PLENV_ROOT
write_profile 'export PLENV_ROOT=$HOME/.plenv'
write_profile 'export PATH=$PLENV_ROOT/bin:$PATH'
write_profile 'eval "$(plenv init -)"'
### setup Perl-Build
mkdir $PLENV_PLUGIN_DIR
git clone $PERLBUILDER_REPO $PLENV_PLUGIN_DIR/perl-build
### notify to finished installing
echo 'plenv was installed.'
echo ''
echo 'To finish install plenv, please reload your shell.'
echo ''
echo 'enjoy.'
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment