Gruntfile.coffee 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. spawn = require("child_process").spawn
  2. module.exports = (grunt) ->
  3. grunt.initConfig
  4. forever:
  5. app:
  6. options:
  7. index: "app.js"
  8. coffee:
  9. app_src:
  10. expand: true,
  11. flatten: true,
  12. cwd: "app"
  13. src: ['coffee/*.coffee'],
  14. dest: 'app/js/',
  15. ext: '.js'
  16. app:
  17. src: "app.coffee"
  18. dest: "app.js"
  19. unit_tests:
  20. expand: true
  21. cwd: "test/unit/coffee"
  22. src: ["**/*.coffee"]
  23. dest: "test/unit/js/"
  24. ext: ".js"
  25. acceptance_tests:
  26. expand: true
  27. cwd: "test/acceptance/coffee"
  28. src: ["**/*.coffee"]
  29. dest: "test/acceptance/js/"
  30. ext: ".js"
  31. smoke_tests:
  32. expand: true
  33. cwd: "test/smoke/coffee"
  34. src: ["**/*.coffee"]
  35. dest: "test/smoke/js"
  36. ext: ".js"
  37. clean:
  38. app: ["app/js/"]
  39. unit_tests: ["test/unit/js"]
  40. acceptance_tests: ["test/acceptance/js"]
  41. smoke_tests: ["test/smoke/js"]
  42. execute:
  43. app:
  44. src: "app.js"
  45. mochaTest:
  46. unit:
  47. options:
  48. reporter: grunt.option('reporter') or 'spec'
  49. grep: grunt.option("grep")
  50. src: ["test/unit/js/**/*.js"]
  51. acceptance:
  52. options:
  53. reporter: grunt.option('reporter') or 'spec'
  54. timeout: 40000
  55. grep: grunt.option("grep")
  56. src: ["test/acceptance/js/**/*.js"]
  57. smoke:
  58. options:
  59. reporter: grunt.option('reporter') or 'spec'
  60. timeout: 10000
  61. src: ["test/smoke/js/**/*.js"]
  62. shell:
  63. dockerTests:
  64. command: 'docker run -v "$(pwd):/app" -e AWS_ACCESS_KEY_ID="$AWS_ACCESS_KEY_ID" -e AWS_SECRET_ACCESS_KEY="$AWS_SECRET_ACCESS_KEY" -e AWS_BUCKET="$AWS_BUCKET" --rm sl-acceptance-test-runner'
  65. grunt.loadNpmTasks 'grunt-contrib-coffee'
  66. grunt.loadNpmTasks 'grunt-contrib-clean'
  67. grunt.loadNpmTasks 'grunt-mocha-test'
  68. grunt.loadNpmTasks 'grunt-shell'
  69. grunt.loadNpmTasks 'grunt-execute'
  70. grunt.loadNpmTasks 'grunt-bunyan'
  71. grunt.loadNpmTasks 'grunt-forever'
  72. grunt.registerTask 'compile:app', ['clean:app', 'coffee:app', 'coffee:app_src']
  73. grunt.registerTask 'run', ['compile:app', 'bunyan', 'execute']
  74. grunt.registerTask 'compile:unit_tests', ['clean:unit_tests', 'coffee:unit_tests']
  75. grunt.registerTask 'test:unit', ['compile:app', 'compile:unit_tests', 'mochaTest:unit']
  76. grunt.registerTask 'compile:acceptance_tests', ['clean:acceptance_tests', 'coffee:acceptance_tests']
  77. grunt.registerTask 'test:acceptance', ['compile:acceptance_tests', 'mochaTest:acceptance']
  78. grunt.registerTask 'compile:smoke_tests', ['clean:smoke_tests', 'coffee:smoke_tests']
  79. grunt.registerTask 'test:smoke', ['compile:smoke_tests', 'mochaTest:smoke']
  80. grunt.registerTask 'install', 'compile:app'
  81. grunt.registerTask 'test:acceptance:docker', ['compile:acceptance_tests', 'shell:dockerTests']
  82. grunt.registerTask 'default', ['run']