Let’s suppose for a minute you’re working on a new rails app.
(which always somehow happens to be the next big thing in your opinion).
Well you implement whatever you have to implement, you run it, it’s working ! awesome !
You probably already have a git repo setup somewhere to collaborate with other developers in your team on the same code, the problem is … some of them can’t get the app to run ! Maybe they have a different ruby version, or gems with different versions … or they are on Windows !
How do you go from “works on my machine” to work on all machines … Well, usually problems in life accept different solutions, but what would be the most efficient solution for such a problem ?
Say hello to Vagrant !
Vagrant allows you to run your Rails application and all of its dependencies in a portable, sharable environment.
So basically you package the rails app inside a lightweight virtual machine that you can distribute later to other developers working on the same project …
This is also really helpful when distributing open-source project, an example of that would be Discourse.
Installing it without vagrant usually require installing a whole bunch of tools and managing a lot of dependencies, but what if you just wanna try it, and then decide if you really wanna setup the whole thing in the future, well with Vagrant, running Discourse on your local computer is as easy as running — really — few shell commands !
Basically you clone the project, make one tiny small change to a file there, then you run
And wait until the VM is downloaded and configured, finally you run
To ssh to the new VM on your local machine, go the rails app folder, install necessary gems, migrate the database and start the server ! That’s all …