New grunt task : serve

This commit is contained in:
jdescottes 2013-08-11 20:51:04 +02:00
parent 03711869cd
commit d8d6f27462
2 changed files with 24 additions and 13 deletions

View file

@ -18,7 +18,7 @@ module.exports = function(grunt) {
filesSrc : ['tests/integration/casperjs/*_test.js'], filesSrc : ['tests/integration/casperjs/*_test.js'],
options : { options : {
args : { args : {
baseUrl : 'http://localhost:' + '<%= connect.www.options.port %>/', baseUrl : 'http://localhost:' + '<%= connect.test.options.port %>/',
mode : '?debug', mode : '?debug',
delay : delay delay : delay
}, },
@ -32,12 +32,6 @@ module.exports = function(grunt) {
grunt.initConfig({ grunt.initConfig({
jshint: { jshint: {
/*options: {
"evil": true,
"asi": true,
"smarttabs": true,
"eqnull": true
},*/
options: { options: {
indent:2, indent:2,
undef : true, undef : true,
@ -54,10 +48,17 @@ module.exports = function(grunt) {
] ]
}, },
connect : { connect : {
www : { test : {
options : { options : {
base : '.', base : '.',
port : 7357 port : 4321
}
},
serve : {
options : {
base : '.',
port : 1234,
keepalive : true
} }
} }
}, },
@ -101,9 +102,19 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-ghost'); grunt.loadNpmTasks('grunt-ghost');
grunt.loadNpmTasks('grunt-leading-indent'); grunt.loadNpmTasks('grunt-leading-indent');
// Validate
grunt.registerTask('lint', ['leadingIndent:jsFiles', 'leadingIndent:cssFiles', 'jshint']); grunt.registerTask('lint', ['leadingIndent:jsFiles', 'leadingIndent:cssFiles', 'jshint']);
grunt.registerTask('test', ['leadingIndent:jsFiles', 'leadingIndent:cssFiles', 'jshint', 'connect', 'ghost:default']);
grunt.registerTask('precommit', ['leadingIndent:jsFiles', 'leadingIndent:cssFiles', 'jshint', 'connect', 'ghost:local']);
grunt.registerTask('default', ['jshint', 'concat', 'uglify']); // Validate & Test
grunt.registerTask('test', ['leadingIndent:jsFiles', 'leadingIndent:cssFiles', 'jshint', 'connect:test', 'ghost:default']);
// Validate & Test (faster version) will NOT work on travis !!
grunt.registerTask('precommit', ['leadingIndent:jsFiles', 'leadingIndent:cssFiles', 'jshint', 'connect:test', 'ghost:local']);
// Validate & Build
grunt.registerTask('default', ['leadingIndent:jsFiles', 'leadingIndent:cssFiles', 'jshint', 'concat', 'uglify']);
// Start webserver
grunt.registerTask('serve', ['connect:serve']);
}; };

View file

@ -14,9 +14,9 @@
"devDependencies": { "devDependencies": {
"grunt": "~0.4.1", "grunt": "~0.4.1",
"grunt-contrib-connect": "0.3.0", "grunt-contrib-connect": "0.3.0",
"grunt-contrib-concat": "0.1.2",
"grunt-contrib-jshint": "0.5.4", "grunt-contrib-jshint": "0.5.4",
"grunt-contrib-uglify": "0.2.2", "grunt-contrib-uglify": "0.2.2",
"grunt-contrib-concat": "0.1.2",
"grunt-ghost": "1.0.12", "grunt-ghost": "1.0.12",
"grunt-leading-indent" : "0.1.0" "grunt-leading-indent" : "0.1.0"
} }