Hit Escape to see thumbnails of all slides | Elze Hamilton, January 5, 2015 | My website
By Elze Hamilton / @elze
Installing the right versions of Ruby, Rails, or Python and its packages can be complicated on Windows, unlike on Mac or Unix machines
(e.g. Ruby 1.9 and Ruby 2.0, Python 2 and Python 3. One way to make different versions coexist on one computer is to have them on separate virtual machines.)
From vagrantup.com:
"Vagrant is a tool for building complete development environments"
(pretty vague)
Also,
"Create a single file for your project to describe the type of machine you want, the software that needs to be installed, and the way you want to access the machine. Store this file with your project code. Run a single command "vagrant up" and sit back as Vagrant puts together your complete development environment"
(that's more helpful)
The virtual machine that Vagrant brings up has access to the files on your main (physical) machine.
I will demonstrate this in a minute.
Get an already existing Vagrant file.
For example, rails-dev-box
Download it from
https://github.com/rails/rails-dev-box
... a Vagrant file plus a script to install all sorts of useful software on your virtual machine
(Don't be bothered by the rails-dev-box README page that says "this VM is not designed for Rails application development, only Rails core development." I haven't found a reason yet why its not good for Rails app development, and it is recommended by the RailsBridge workshop.)
Best of all, rails-dev-box is not just for Rails or Ruby!
You can install any programming language or framework on it -- Python, Node, you name it.
1. Install VirtualBox -- the software that enables creation of virtual machines on your computer.
2. Install Vagrant.
3. Launch Vagrant
Vagrant installs all the software specified in the bootstrap.sh
script
vagrant ssh
cd /vagrant
(Ignore what rails-dev-box README page tells you about cloning Rails from Github. This is only for developers who want to work on Rails core. If you just want to develop Rails apps, install Rails the usual way, e.g. gem install rails
.)
In the live presentation there was a demo that
http://localhost:3000/
, in the browser on your main machine and showed that you can test your app outside Vagrant