Permalink
Browse files

perlbrew helper

smartcd now ships with built-in perlbrew integration.  Simply place the
following line in your enter script

    smartcd helper run perlbrew init __PATH__/local/perl

and perlbrew will be loaded and configured for you.  When you cd away,
the settings are undone and you get your "regular" perl back
  • Loading branch information...
1 parent 6fdab2b commit 4ffe143af35e9e8b5b20dc1438af59b282f5874f @cxreg committed Apr 8, 2012
Showing with 44 additions and 5 deletions.
  1. +12 −4 README
  2. +4 −0 helper/perlbrew/meta
  3. +25 −0 helper/perlbrew/script
  4. +3 −1 lib/core/smartcd
View
16 README
@@ -224,11 +224,13 @@ WHAT ARE SOME COMMON RECIPES?
language, allowing you to easily switch between them. This is very valuable
for development, but probably not what you want for your whole system.
- Here is a recipe I've used to allow perlbrew to do its thing from within
- a project folder
+ smartcd now ships with a helper designed to integrate perlbrew and smartcd
+ seamlessly together. Simply put this line in your enter script:
- autostash PATH PERLBREW_PERL PERLBREW_VERSION PERLBREW_PATH PERLBREW_ROOT PATH_WITHOUT_PERLBREW
- source /path/to/perlbrew/install/etc/bashrc
+ smartcd helper run perlbrew init /path/to/perlbrew/install
+
+ When you leave the directory, perlbrew will stop being in effect and you will
+ get your previous perl back.
perlbrew is available at http://search.cpan.org/~gugod/App-perlbrew/
@@ -337,6 +339,12 @@ WHAT ELSE CAN IT DO?
when setting up, so that other history can be availble "further
back" in your history.
+ perlbrew:
+
+ smartcd helper run perlbrew init /path/to/perlbrew/install
+
+ Automagic setup and teardown of Perlbrew
+
TEMPLATES
In addition to configuring scripts individually, smartcd supports a template
View
@@ -0,0 +1,4 @@
+Description: Perlbrew compatibility
+Author: Dave Olszewski <cxreg@pobox.com>
+URI: https://raw.github.com/cxreg/smartcd/master/helper/perlbrew
+Version: 1.0
View
@@ -0,0 +1,25 @@
+###############################################################################
+# Perlbrew compatibility
+#
+# Example usage:
+# smartcd helper run perlbrew init __PATH__/local/perl
+#
+# By using this helper, perlbrew will be loaded automatically on directory
+# enter, and its effects will be undone when you cd away.
+#
+# Due to perlbrew's current assumption about $HOME/.perlbrew/init, you
+# cannot yet affect where your configuration is loaded from.
+#
+###############################################################################
+
+local action=$1; shift
+case $action in
+ init) case $1 in
+ "") echo "Usage: smartcd helper run perlbrew init <perlbrew base>";;
+ *) autostash PATH PERLBREW_PERL PERLBREW_VERSION PERLBREW_PATH PERLBREW_ROOT PATH_WITHOUT_PERLBREW
+ source $1/etc/bashrc
+ ;;
+ esac
+ ;;
+ *) echo "Usage: smartcd helper run perlbrew init <perlbrew base>";;
+esac
View
@@ -79,12 +79,14 @@
# you may find useful. This system also allows people to distribute
# and share these independently of the core smartcd distribution.
#
-# Currently the included helpers are 'path' and 'history'
+# Currently the included helpers are 'path', 'history', and 'perlbrew'
#
# smartcd helper run history localize __PATH__/.history
#
# smartcd helper run path append __PATH__/bin
#
+# smartcd helper run perlbrew init /path/to/perlbrew/install
+#
# #############
# # Templates #
# #############

0 comments on commit 4ffe143

Please sign in to comment.