Vendoring dependencies can provide quite a bit of freedom: from properly specified versions to clearly defined isolation. There's also some interesting interplay with OS level (or external to the language) dependencies which can be handled with proper package management; see Dependency management for grown ups. This serves as a guide for similar usage across languages.
Research:
local::lib + $PERL5LIB
(see: Perl CPAN Modules without sudo, virtualenv for Perl, perl-virtualenv)
Example usage:
# Install local::lib to a subdirectory, then install any CPAN module(s).
curl -L -o local-lib.tar.gz http://search.cpan.org/CPAN/authors/id/A/AP/APEIRON/local-lib-1.008009.tar.gz
tar -xzf local-lib.tar.gz
LIBSPWD=`pwd`
cd local-lib-1.008009
perl Makefile.PL --bootstrap=$LIBSPWD
make test
make install
eval $(perl -I$LIBSPWD/lib/perl5 -Mlocal::lib=$LIBSPWD)
echo "eval \$(perl -I$LIBSPWD/lib/perl5 -Mlocal::lib=$LIBSPWD)"
echo "Install CPAN modules with:"
echo "perl -I$LIBSPWD/lib/perl5 -MCPAN -Mlocal::lib=$LIBSPWD -e 'CPAN::install(LWP)'"
echo "Run an app with the installed deps:"
echo "perl -I$LIBSPWD/lib/perl5 -Mlocal::lib=$LIBSPWD appname.pl"
# Alternatively (to CPAN::install) use App::cpanminus
curl -LO http://xrl.us/cpanm
chmod +x cpanm
echo "perl -I$LIBSPWD/lib/perl5 -Mlocal::lib=$LIBSPWD ./cpanm RTSP::Lite"
Composer (see also: Pear and Pecl)
Example usage:
# Get a project
git clone [email protected]:igorw/fab-symfony-console.git; cd fab-symfony-console
# Get composer
curl -sS https://getcomposer.org/installer | php
# Install dependencies locally in ./vendor
# (Note: You may need to set `php -d suhosin.executor.include.whitelist=phar ...`; http://cweiske.de/tagebuch/suhosin-phar.htm)
php composer.phar install
# Run commands in context
php example.php
setuptools + $PYTHONPATH
(see also: virtualenv (Install virtualenv without root))
Example usage:
Caveat emptor: One time setup: gem install bundler #sudo?
# Get a project
git clone [email protected]:arangamani/jenkins_launcher.git; cd jenkins_launcher
# Install dependencies locally in ./vendor
bundle install --path vendor
# Run commands in the project vendor context
bundle exec ruby bin/jlaunch help
bundle exec jenkinscli help