Gruntfile.coffee 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. module.exports = (grunt) ->
  2. grunt.loadNpmTasks 'grunt-contrib-coffee'
  3. grunt.loadNpmTasks 'grunt-contrib-clean'
  4. grunt.loadNpmTasks 'grunt-mocha-test'
  5. grunt.loadNpmTasks 'grunt-available-tasks'
  6. grunt.loadNpmTasks 'grunt-execute'
  7. grunt.loadNpmTasks 'grunt-bunyan'
  8. grunt.loadNpmTasks 'grunt-forever'
  9. grunt.initConfig
  10. forever:
  11. app:
  12. options:
  13. index: "app.js"
  14. execute:
  15. app:
  16. src: "app.js"
  17. bunyan:
  18. strict: false
  19. coffee:
  20. app_dir:
  21. expand: true,
  22. flatten: false,
  23. cwd: 'app/coffee',
  24. src: ['**/*.coffee'],
  25. dest: 'app/js/',
  26. ext: '.js'
  27. app:
  28. src: 'app.coffee'
  29. dest: 'app.js'
  30. acceptance_tests:
  31. expand: true,
  32. flatten: false,
  33. cwd: 'test/acceptance/coffee',
  34. src: ['**/*.coffee'],
  35. dest: 'test/acceptance/js/',
  36. ext: '.js'
  37. unit_tests:
  38. expand: true,
  39. flatten: false,
  40. cwd: 'test/unit/coffee',
  41. src: ['**/*.coffee'],
  42. dest: 'test/unit/js/',
  43. ext: '.js'
  44. clean:
  45. app: ["app/js"]
  46. acceptance_tests: ["test/acceptance/js"]
  47. unit_tests: ["test/unit/js"]
  48. mochaTest:
  49. unit:
  50. src: ["test/unit/js/#{grunt.option('feature') or '**'}/*.js"]
  51. options:
  52. reporter: grunt.option('reporter') or 'spec'
  53. grep: grunt.option("grep")
  54. acceptance:
  55. src: ["test/acceptance/js/#{grunt.option('feature') or '*'}.js"]
  56. options:
  57. reporter: grunt.option('reporter') or 'spec'
  58. grep: grunt.option("grep")
  59. timeout: 10000
  60. availabletasks:
  61. tasks:
  62. options:
  63. filter: 'exclude',
  64. tasks: [
  65. 'coffee'
  66. 'clean'
  67. 'mochaTest'
  68. 'availabletasks'
  69. 'execute'
  70. 'bunyan'
  71. ]
  72. groups:
  73. "Compile tasks": [
  74. "compile:server"
  75. "compile:tests"
  76. "compile"
  77. "compile:unit_tests"
  78. "compile:acceptance_tests"
  79. "install"
  80. ]
  81. "Test tasks": [
  82. "test:unit"
  83. "test:acceptance"
  84. ]
  85. "Run tasks": [
  86. "run"
  87. "default"
  88. ]
  89. "Misc": [
  90. "help"
  91. ]
  92. grunt.registerTask 'help', 'Display this help list', 'availabletasks'
  93. grunt.registerTask 'compile:server', 'Compile the server side coffee script', ['clean:app', 'coffee:app', 'coffee:app_dir']
  94. grunt.registerTask 'compile:unit_tests', 'Compile the unit tests', ['clean:unit_tests', 'coffee:unit_tests']
  95. grunt.registerTask 'compile:acceptance_tests', 'Compile the acceptance tests', ['clean:acceptance_tests', 'coffee:acceptance_tests']
  96. grunt.registerTask 'compile:tests', 'Compile all the tests', ['compile:acceptance_tests', 'compile:unit_tests']
  97. grunt.registerTask 'compile', 'Compiles everything need to run document-updater-sharelatex', ['compile:server']
  98. grunt.registerTask 'install', "Compile everything when installing as an npm module", ['compile']
  99. grunt.registerTask 'test:unit', 'Run the unit tests (use --grep=<regex> for individual tests)', ['compile:server', 'compile:unit_tests', 'mochaTest:unit']
  100. grunt.registerTask 'test:acceptance', 'Run the acceptance tests (use --grep=<regex> for individual tests)', ['compile:acceptance_tests', 'mochaTest:acceptance']
  101. grunt.registerTask 'run', "Compile and run the document-updater-sharelatex server", ['compile', 'bunyan', 'execute']
  102. grunt.registerTask 'default', 'run'