A vagrant dev environment for yeoman (http://yeoman.io) that uses a Ubuntu 12.10 Server image and Puppet for provisioning.
This repo is intended as a proof of concept for creating and running a fully-functional Yeoman default scaffolding ("generator-webapp") project in Vagrant.
To create your local Yeoman environment:
$ git clone https://github.com/lwndev/vagrant-yeoman-env.git
$ cd vagrant-yeoman-env/vagrant
$ vagrant up
This will do the following
- Download a Vagrant 'base box' for VirtualBox. The box in question includes Ubuntu Server 12.10 with Ruby 1.9.3p194 and Puppet 2.7.18.
- Boot the VM and run Puppet to install additional dependencies:
- vim
- bash
- nodejs
- git
- fontconfig
- Then a few gems are installed:
- Compass
- SASS
- Then some additional dependencies for Yeoman are installed via NPM
- Yo
- Grunt
- Bower
- Phantomjs
- Yeoman "webapp" generator
- Then yo is called with the webapp generator as its argument and a project skeleton is created
- And finally, once the webapp project is in place a small tweak is made to Gruntfile.js in the /webapp directory that makes the webapp instance available to the host machine when it is running
This entire process will take about 10-15 minutes on a high-speed connection (20MBS+). The base box is about 430MB and there's around 300MB of dependencies that need to be downloaded once the VM boots.
All of the files and directories generated by the webapp scaffolding are available in the "webapp" directory of the folder created when this repo is cloned.
Once everything is downloaded and puppet is done running, you can log in to the VM and start the server
$ vagrant ssh
$ cd ~/yeoman/webapp
$ grunt server
Then you can access the server on your host machine's browsers at http://192.168.40.10:9000
If you want to run unit tests on the project, ssh to the box, cd to ~/yeoman/webapp and run the following command
$ grunt test
This will run your unit tests using the headless Webkit browser "Phantomjs"
If you want to package your project, ssh to the box, cd to ~/yeoman/webapp and run the following command
$ grunt
Compressed, packaged assets can be found in ~/yeoman/webapp/dist
- The VM uses 1GB of RAM. This is probably overkill and you can adjust memory allocation in the Vagrantfile if you wish (/vagrant/Vagrantfile)
- Live refresh of the browser is not currently supported as the project server and your browser are running on different operating systems.
Happy Coding!