Gruntfile.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*global module:false*/
  2. module.exports = function(grunt) {
  3. // Project configuration.
  4. grunt.initConfig({
  5. pkg: grunt.file.readJSON('package.json'),
  6. meta: {
  7. },
  8. qunit: {
  9. files: ['test/**/*.html']
  10. },
  11. watch: {
  12. files: '<config:lint.files>',
  13. tasks: 'lint qunit'
  14. },
  15. jshint: {
  16. options: {
  17. curly: false,
  18. eqeqeq: true,
  19. immed: true,
  20. latedef: true,
  21. newcap: true,
  22. noarg: true,
  23. sub: true,
  24. undef: false,
  25. boss: true,
  26. eqnull: true,
  27. browser: true
  28. },
  29. globals: {
  30. jQuery: true
  31. },
  32. src: ['src/**/*.js'],
  33. all: ['Gruntfile.js', 'src/**/*.js', 'test/**/*.js']
  34. },
  35. });
  36. grunt.loadNpmTasks('grunt-contrib-jshint');
  37. grunt.loadNpmTasks('grunt-contrib-qunit');
  38. // Default task.
  39. grunt.registerTask('default', ['jshint:src', 'qunit']);
  40. // Server Task
  41. grunt.registerTask('serve', 'Serves any directory on given port', function (env) {
  42. var shell = require('shelljs');
  43. var port = grunt.option('port') || 8000;
  44. var dir = grunt.option('dir') || '.';
  45. console.log(['Serving', dir,'on port:', port].join(' '))
  46. shell.exec('cd '+ dir +' && python -m SimpleHTTPServer ' + port);
  47. });
  48. };