From a40cdd4259620a7c9267bd4077b860d40737fb2b Mon Sep 17 00:00:00 2001 From: Ray Miller Date: Fri, 12 Aug 2011 14:44:43 +0100 Subject: [PATCH] Initial check-in --- new-profile | 32 ++++++++++++++++++++++++++++++++ switch-profile | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100755 new-profile create mode 100755 switch-profile diff --git a/new-profile b/new-profile new file mode 100755 index 0000000..684750e --- /dev/null +++ b/new-profile @@ -0,0 +1,32 @@ +#!/bin/bash +# +# This is based on an idea stolen from Oliver; see his great blog post +# http://blogs.perl.org/users/oliver_gorwits/2011/07/locallibs-for-dist-development.html +# for the rationale. +# +# This script works hand-in-hand with switch-profile. +# + +set -e + +if [ -z "$1" ] + then + echo 'Pass the profile name, please' >&2 + exit 2 +fi + +echo "Creating local::lib for $1 ..." +sleep 3 + +test -d "${HOME}/perl-profiles" || mkdir -v "${HOME}/perl-profiles" +PROFILE_DIR="${HOME}/perl-profiles/$1" + +curl -L http://cpanmin.us/ | perl - --notest --quiet --local-lib "${PROFILE_DIR}" \ + App::cpanminus \ + Dist::Zilla \ + App::local::lib::helper + +mkdir -p "${PROFILE_DIR}/etc" +cat > "${PROFILE_DIR}/etc/bashrc" <&2 + exit 2 +fi + +export PROFILE +exec env PATH=${HOME}/bin:/bin:/usr/bin PERL5LIB= \ + "${HOME}/perl-profiles/${PROFILE}/bin/localenv" \ + /bin/bash --rcfile "${HOME}/perl-profiles/${PROFILE}/etc/bashrc"