Skip to content

Instantly share code, notes, and snippets.

@Songmu
Forked from ytnobody/plenvsetup
Last active August 29, 2015 14:01
Show Gist options
  • Save Songmu/e0ba1e574d9e142fd3a6 to your computer and use it in GitHub Desktop.
Save Songmu/e0ba1e574d9e142fd3a6 to your computer and use it in GitHub Desktop.
#!/bin/sh
# 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