Skip to content

Instantly share code, notes, and snippets.

@pyrat
Created December 20, 2012 10:46
Show Gist options
  • Save pyrat/4344562 to your computer and use it in GitHub Desktop.
Save pyrat/4344562 to your computer and use it in GitHub Desktop.

Setting up Node Environment

Prerequisites for development

  • node - install from nodejs.org, most recent version 0.8.x
  • mongodb - install from source 2.x
  • redis - install from source 2.6.7
  • mysql - 5.x install from package manager / source
  • ruby - preferably 1.9.x (maybe install from source)
  • rubygems - 1.8.x

Setting up the project

sudo gem install bundler
bundle
guard

This installs the rubygems package manager, bundles the dependencies for the coffeescript autocompiler and starts the autocompiler.

Coffeescript

The /src directory has all the source files which are written in coffeescript. http://coffeescript.org/ is the best introduction to developing in coffeescript. Essentially it is javascript with less syntax.

One of the things to be aware of is the -> operator versus the => operator as this is used to maintain the correct scope in javascript. Something which can normally be quite diffucult, read about the this operator for more information.

Testing

The tests are written in coffeescript using a library called mocha which is essentially a lightweight bdd library. To run the tests run

make

Note: There is currently no redis teardown in operation between test cases.. this is normally not a problem, but something the very first time you run the test suite for a project some of the tests may fail. This should then no longer be an issue.

Deployment

Capistrano is used for deployment. Depending on the project they are either multistage or single stage.

cap deploy

or

cap production deploy

will do the job for deployment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment