Gruntfile.coffee 3.9 KB

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