HabitRPG Rewrite under development. Built using Angular, Express, Mongoose, Jade, Stylus, Coffeescript.
Note: This branch is under development, and these instructions may fall out of date. They were accurate as of August 5, 2013. Should you encounter this, join #habitrpg on IRC (Freenode) and talk to litenull.
The general steps are:
- Clone the repo
- Install all dependencies
- Run the client
Or, expressed in commands on the command line:
git clone --recursive -b angular_rewrite https://github.com/lefnire/habitrpg.git
cd habitrpg && npm install
grunt start
(grunt start:production
to concat & minify js)
To access the site, open http://localhost:3000 in your browser.
- Angular, Express, Mongoose. Awesome, tried technologies. Read up on them.
- CoffeeScript, Stylus, Jade - big debate.
- Jade. We need a server-side templating language so we can inject variables (
res.locals
from Express). Jade is great because the "significant whitespace" paradigm protects you from HTML errors such as missing or mal-matched close tags, which has been a pretty common error from multiple contribs on Habit. However, it's not very HTML-y, and makes people mad. We'll re-visit this conversation after the rewrite is done. - Stylus. We're either staying here or moving to LESS, but vanilla CSS isn't cutting it for our app.
- CoffeeScript. This is the hottest debate. I'm using it to rewrite, and Habit was written originally on CS. It's a fantastic language, but it's a barrier-to-entry for potential contribs who don't know it. Will also revisit right after the rewrite.
- Set up MongoDB. Steps:
- Download the latest production release of MongoDB from: http://www.mongodb.org/downloads
- Extract the zip file to the desired application directory. Example: c:\apps\mongodb-win32-x86_64-2.4.6
- Rename the folder from mongodb-win32-x86_64-2.4.6 to mongodo
- Create a data\db directory under the application directory. Example: c:\apps\mongodb\data\db
- Start up MongoDB using the following command: 'c:\apps\mongodb\bin\mongod.exe --dbpath c:\apps\mongodb\data'
If MongoDB starts up successfully, you should see the following at the end of the logs: Sun Sep 01 18:10:21.233 [initandlisten] waiting for connections on port 27017 Sun Sep 01 18:10:21.233 [websvr] admin web console waiting for connections on po rt 28017
- Install Node.js (includes npm). Steps:
- Download and run the latest Node.js msi installation file from http://nodejs.org/download/
- Create a fork of the habitrpg repository on github under your own account
- Install Git and download angular_rewrite code repository. Steps:
- Install latest stable version of Git, found here: http://git-scm.com/downloads 1. Make sure to select "Run Git from the Windows Command Prompt" during the installation process
- Open a command window. Navigate to the location where you would like the project files to live. Example: c:\projects
- Run git command to download angular_rewrite branch. 'git clone --recursive -b angular_rewrite https://github.com/ezinaz/habitrpg.git' (where 'ezinaz' is your account name)
- Run 'cd habitrpg'
- Create upstream remote: 'git remote add upstream https://github.com/lefnire/habitrpg.git'
- Run 'git fetch upstream'
- Run 'npm install'. Read below for possible error message.
You might receive the following error during the 'npm install' command:
[email protected] postinstall C:\Users\022498\Projects\habitrpg ./node_modules/bower/bin/bower install -f '.' is not recognized as an internal or external command, operable program or batch file. npm ERR! weird error 1 npm ERR! not ok code 0
Ignore this error and proceed with the following:
- Run 'npm install -g nodemon'
- Run 'npm install -g bower'
- Run 'bower install -f'
- Run 'copy config.json.example config.json'
grunt start
(grunt start:production
to concat & minify js)
Open a browser to URL http://localhost:3000 to test the application.