Gruntfile.coffee 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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. mochaTest:
  48. unit:
  49. src: ["test/unit/js/#{grunt.option("feature") or "**"}/*.js"]
  50. options:
  51. reporter: grunt.option('reporter') or 'spec'
  52. grep: grunt.option("grep")
  53. acceptance:
  54. src: ["test/acceptance/js/**/*.js"]
  55. options:
  56. reporter: grunt.option('reporter') or 'spec'
  57. grep: grunt.option("grep")
  58. timeout: 10000
  59. availabletasks:
  60. tasks:
  61. options:
  62. filter: 'exclude',
  63. tasks: [
  64. 'coffee'
  65. 'clean'
  66. 'mochaTest'
  67. 'availabletasks'
  68. 'execute'
  69. 'bunyan'
  70. ]
  71. groups:
  72. "Compile tasks": [
  73. "compile:server"
  74. "compile:tests"
  75. "compile"
  76. "compile:unit_tests"
  77. "compile:acceptance_tests"
  78. "install"
  79. ]
  80. "Test tasks": [
  81. "test:unit"
  82. "test:acceptance"
  83. ]
  84. "Run tasks": [
  85. "run"
  86. "default"
  87. ]
  88. "Misc": [
  89. "help"
  90. ]
  91. grunt.registerTask 'help', 'Display this help list', 'availabletasks'
  92. grunt.registerTask 'compile:server', 'Compile the server side coffee script', ['clean:app', 'coffee:app', 'coffee:app_dir']
  93. grunt.registerTask 'compile:unit_tests', 'Compile the unit tests', ['coffee:unit_tests']
  94. grunt.registerTask 'compile:acceptance_tests', 'Compile the acceptance tests', ['clean:acceptance_tests', 'coffee:acceptance_tests']
  95. grunt.registerTask 'compile:tests', 'Compile all the tests', ['compile:acceptance_tests', 'compile:unit_tests']
  96. grunt.registerTask 'compile', 'Compiles everything need to run track-changes-sharelatex', ['compile:server']
  97. grunt.registerTask 'install', "Compile everything when installing as an npm module", ['compile']
  98. grunt.registerTask 'test:unit', 'Run the unit tests (use --grep=<regex> for individual tests)', ['compile:server', 'compile:unit_tests', 'mochaTest:unit']
  99. grunt.registerTask 'test:acceptance', 'Run the acceptance tests (use --grep=<regex> for individual tests)', ['compile:acceptance_tests', 'mochaTest:acceptance']
  100. grunt.registerTask 'run', "Compile and run the track-changes-sharelatex server", ['compile', 'bunyan', 'execute']
  101. grunt.registerTask 'default', 'run'