This commit is contained in:
Matteo Pagliazzi 2013-09-06 22:33:00 +02:00
parent 9046bd5041
commit b0bf1d4c58
5 changed files with 33 additions and 6 deletions

View file

@ -1 +1,2 @@
/public/*
/views/*
/public/build/*

View file

@ -99,6 +99,18 @@ module.exports = function(grunt) {
'public/build/static.css': ['public/build/static.css']
}
}
},
exec: {
start: {
cmd: function(mode){
if(mode && mode == 'production'){
return 'nodemon --exec "./start.sh" production'
}else{
return 'nodemon --exec "./start.sh"'
}
}
}
}
/*hashres: {
@ -117,8 +129,10 @@ module.exports = function(grunt) {
});
// Register tasks.
grunt.registerTask('build', ['clean:build', 'uglify', 'stylus', 'cssmin']);
grunt.registerTask('run', ['clean:build', 'stylus', 'cssmin']);
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']);
// Load tasks
grunt.loadNpmTasks('grunt-contrib-uglify');
@ -126,5 +140,6 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-stylus');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-exec');
};

View file

@ -15,7 +15,7 @@ Or, expressed in commands on the command line:
1. `git clone --recursive -b angular_rewrite https://github.com/lefnire/habitrpg.git`
1. `cd habitrpg && npm install`
1. `npm start`
1. `grunt start` (`grunt start:production` to concat & minify js)
To access the site, open http://localhost:3000 in your browser.
@ -76,7 +76,7 @@ Ignore this error and proceed with the following:
1. Run 'npm install -g bower'
1. Run 'bower install -f'
1. Run 'copy config.json.example config.json'
1. Run 'npm start'
1. `grunt start` (`grunt start:production` to concat & minify js)
Open a browser to URL http://localhost:3000 to test the application.

View file

@ -31,6 +31,7 @@
"grunt-contrib-stylus": "~0.8.0",
"grunt-contrib-clean": "~0.5.0",
"grunt-contrib-cssmin": "~0.6.1",
"grunt-exec": "~0.4.x",
"bower": "~1.2.4",
"nib": "~1.0.1",
"jade": "~0.35.0",
@ -48,7 +49,6 @@
"npm": "1.2.x"
},
"scripts": {
"start": "nodemon src/server.js",
"test": "mocha test/api.mocha.coffee",
"postinstall": "./node_modules/bower/bin/bower install -f"
}

11
start.sh Executable file
View file

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