All Projects → lwndev → vagrant-yeoman-env

lwndev / vagrant-yeoman-env

Licence: other
A vagrant dev environment for yeoman (http://yeoman.io)

Programming Languages

ruby
36898 projects - #4 most used programming language
Puppet
460 projects
shell
77523 projects
perl
6916 projects

vagrant-yeoman-env

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.

Dependencies

  1. Vagrant
  2. VirtualBox (for local servers)

Usage

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

  1. 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.
  2. Boot the VM and run Puppet to install additional dependencies:
    1. vim
    2. bash
    3. nodejs
    4. git
    5. fontconfig
  3. Then a few gems are installed:
    1. Compass
    2. SASS
  4. Then some additional dependencies for Yeoman are installed via NPM
    1. Yo
    2. Grunt
    3. Bower
    4. Phantomjs
    5. Yeoman "webapp" generator
  5. Then yo is called with the webapp generator as its argument and a project skeleton is created
  6. 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.

Viewing the project

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

Testing

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"

Packaging

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

Notes

  • 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!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].