Let's learn about sandboxing our environments shall we?

Sandbox - get it?Sandbox - get it?

A few years ago, i decided to refresh my Python by building a complex Django project from scratch.

It reminded me why Python is so awesome!

On top of that I had a chance to see how Django is bringing Python to the web development world with a lot of parallels taken from Ruby on Rails and the MVC concept in general.

I've recently been dabbling with Ruby on Rails and was glad to learn about RVM, which is a tool that lets you switch between Ruby versions and gemsets as easy as writing a single command!

1
rvm use 1.9.1

Will switch your Ruby version to 1.9.1

Added modules (gems in Ruby) would be packaged as gemsets, created via:

1
rvm gemset create newgemset

To use a certain gemset one has to name the version@gemset like so:

1
rvm use 1.9.1@newgemset

The most useful feature you should use is to set the gemset automatically when entering your project folder, this will save you time and make your workflow more efficient.
The key files you need to create are .ruby-version and .ruby-gemset.
The former will hold your Ruby version (e.g. 1.9.1), whereas the latter the name of the gemset (definitely not rocket science)!

Like most things Ruby, it’s ridiculously easy & intuitive.

RVM is a massive tool, with loads of options, you should check the Doc here

This of course reminded me of Python’s Virtualenv, which works by making Python run from your project folder (including all the different modules you want to attach), very clever!

PHP developers don’t have a good solution for sandboxing, but worry not! There’s a tool to help you out, and it goes by the name of Vagrant.

Vagrant is actually a tool for a complete dev environment, and is language agnostic. It works by running a lightweight virtual box including an OS with everything you need for your project.

Vagrant is useful for PHP because there aren’t any mature solutions for what Virtualenv or RVM are doing (though some attempts, such as phpenv are out there).

The only problem I have with Vagrant is that it’s far heavier than RVM & Virtualenv, which makes sense. We’re talking about a complete Virtual Box running instead of just swapping versions & modules.

To get started on Vagrant you can read the guide here, it’s pretty straightforward.