This commit is contained in:
Matteo Pagliazzi 2013-09-07 12:47:44 +02:00
parent 4e10fc65cf
commit 40d6df1776
5 changed files with 44 additions and 44 deletions

View file

@ -1,2 +1,3 @@
/views/*
/public/build/*
public/*
views/*
Gruntfile.js

View file

@ -101,45 +101,44 @@ module.exports = function(grunt) {
}
},
exec: {
start: {
cmd: function(mode){
if(mode && mode == 'production'){
return 'nodemon --exec "./start.sh" production'
}else{
return 'nodemon --exec "./start.sh"'
}
nodemon: {
dev: {
ignoredFiles: ['public/*', 'Gruntfile.js', 'views/*'] // Do not work!
}
},
watch: {
dev: {
files: ['public/**/*.css'], // 'public/**/*.js' Not needed because not in production
tasks: [ 'build:dev' ],
options: {
nospawn: true
}
}
}
},
/*hashres: {
concurrent: {
dev: ['nodemon', 'watch'],
options: {
fileNameFormat: '${name}-${hash}.${ext}',
},
build: {
src: [
'public/build/app.js',
'public/build/static.js'
],
dest: 'views/i-do-not-exist.jade' // Non existing file!
logConcurrentOutput: true
}
}*/
}
});
// Register tasks.
grunt.registerTask('production', ['clean:build', 'uglify', 'stylus', 'cssmin']);
grunt.registerTask('development', ['clean:build', 'stylus', 'cssmin']);
grunt.registerTask('start:production', ['exec:start:production']);
grunt.registerTask('start', ['exec:start']);
grunt.registerTask('build:prod', ['clean:build', 'uglify', 'stylus', 'cssmin']);
grunt.registerTask('build:dev', ['clean:build', 'stylus', 'cssmin']);
grunt.registerTask('run:dev', [ 'build:dev', 'concurrent' ]);
// Load tasks
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-hashres');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-stylus');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-exec');
grunt.loadNpmTasks('grunt-nodemon');
grunt.loadNpmTasks('grunt-concurrent');
grunt.loadNpmTasks('grunt-contrib-watch');
};

View file

@ -5,20 +5,30 @@ HabitRPG Rewrite under development. Built using Angular, Express, Mongoose, Jade
**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.
Before starting install [MongoDB](http://www.mongodb.org/) and [NodeJS](http://nodejs.org/)
The general steps are:
1. Clone the repo
1. Install the global dependencies
1. Install all dependencies
1. Run the client
Or, expressed in commands on the command line:
1. `git clone --recursive -b angular_rewrite https://github.com/lefnire/habitrpg.git`
1. 'npm install -g grunt-cli' (you may need to add `sudo` in front of it)
1. `cd habitrpg && npm install`
1. `grunt start` (`grunt start:production` to concat & minify js)
1. `grunt run:dev`
To access the site, open http://localhost:3000 in your browser.
There are a few other Grunt task avalaible:
- `grunt build:dev` - Compile, concat and minify Stylus files
- `grunt build:prod` - Same as `grunt build:dev` but concat and minify Javascript files.
- `grunt nodemon` - Start the server with **nodemon**, restart when a file change but without compiling Stylus files
# Technologies
1. Angular, Express, Mongoose. Awesome, tried technologies. Read up on them.
@ -72,11 +82,11 @@ npm ERR! not ok code 0
Ignore this error and proceed with the following:
1. Run 'npm install -g nodemon'
1. Run 'npm install -g grunt-cli'
1. Run 'npm install -g bower'
1. Run 'bower install -f'
1. Run 'copy config.json.example config.json'
1. `grunt start` (`grunt start:production` to concat & minify js)
1. `grunt run:dev`
Open a browser to URL http://localhost:3000 to test the application.

View file

@ -2,7 +2,7 @@
"name": "habitrpg",
"description": "A habit tracker app which treats your goals like a Role Playing Game.",
"version": "0.0.0-152",
"main": "./server.js",
"main": "./src/server.js",
"dependencies": {
"habitrpg-shared": "git://github.com/HabitRPG/habitrpg-shared#rewrite",
"derby-auth": "git://github.com/lefnire/derby-auth#master",
@ -27,11 +27,12 @@
"stylus": "~0.37.0",
"grunt": "~0.4.1",
"grunt-contrib-uglify": "~0.2.4",
"grunt-hashres": "~0.3.2",
"grunt-contrib-stylus": "~0.8.0",
"grunt-contrib-clean": "~0.5.0",
"grunt-contrib-cssmin": "~0.6.1",
"grunt-exec": "~0.4.x",
"grunt-contrib-watch": "~0.5.x",
"grunt-nodemon": "~0.1.1",
"grunt-concurrent": "~0.3.1",
"bower": "~1.2.4",
"nib": "~1.0.1",
"jade": "~0.35.0",

View file

@ -1,11 +0,0 @@
#!/bin/sh
if [ $1 = "production" ]; then
echo "Starting production server";
grunt production;
else
echo "Starting development server";
grunt development;
fi
node ./src/server.js