Gruntfile.js 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. 'use strict';
  2. module.exports = function (grunt) {
  3. var path = require('path');
  4. // These plugins provide necessary tasks.
  5. grunt.loadNpmTasks('grunt-contrib-clean');
  6. grunt.loadNpmTasks('grunt-contrib-requirejs');
  7. grunt.loadNpmTasks('grunt-execute');
  8. grunt.loadNpmTasks('amber-dev');
  9. // Default task.
  10. grunt.registerTask('default', ['amberc:all']);
  11. grunt.registerTask('test', ['amberc:test_runner', 'execute:test_runner', 'clean:test_runner']);
  12. grunt.registerTask('devel', ['amdconfig:app', 'requirejs:devel']);
  13. grunt.registerTask('deploy', ['amdconfig:app', 'requirejs:deploy']);
  14. // Project configuration.
  15. grunt.initConfig({
  16. // Metadata.
  17. // pkg: grunt.file.readJSON(''),
  18. banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
  19. '<%= grunt.template.today("yyyy-mm-dd") %>\n' +
  20. '<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
  21. '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
  22. ' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */\n',
  23. // task configuration
  24. amberc: {
  25. options: {
  26. amber_dir: path.join(__dirname, "bower_components", "amber"),
  27. library_dirs: ['src'],
  28. closure_jar: ''
  29. },
  30. all: {
  31. src: [
  32. 'src/Lyst.st' // list all sources in dependency order
  33. // list all tests in dependency order
  34. ],
  35. amd_namespace: 'lyst',
  36. libraries: ['SUnit', 'Web']
  37. },
  38. test_runner: {
  39. src: ['node_modules/amber-dev/lib/Test.st'],
  40. libraries: [
  41. /* add dependencies packages here */
  42. 'Lyst', /* add other code-to-test packages here */
  43. 'SUnit'
  44. /* add other test packages here */
  45. ],
  46. main_class: 'NodeTestRunner',
  47. output_name: 'test_runner'
  48. }
  49. },
  50. amdconfig: {app: {dest: 'config.js'}},
  51. requirejs: {
  52. deploy: {
  53. options: {
  54. mainConfigFile: "config.js",
  55. onBuildWrite: function (moduleName, path, contents) {
  56. return moduleName === "config" ? contents + "\nrequire.config({map:{'*':{app:'deploy'}}});" : contents;
  57. },
  58. pragmas: {
  59. excludeIdeData: true,
  60. excludeDebugContexts: true
  61. },
  62. include: ['config', 'node_modules/requirejs/require', 'deploy'],
  63. out: "the.js"
  64. }
  65. },
  66. devel: {
  67. options: {
  68. mainConfigFile: "config.js",
  69. onBuildWrite: function (moduleName, path, contents) {
  70. return moduleName === "config" ? contents + "\nrequire.config({map:{'*':{app:'devel'}}});" : contents;
  71. },
  72. include: ['config', 'node_modules/requirejs/require'],
  73. out: "the.js"
  74. }
  75. }
  76. },
  77. execute: {
  78. test_runner: {
  79. src: ['test_runner.js']
  80. }
  81. },
  82. clean: {
  83. test_runner: ['test_runner.js']
  84. }
  85. });
  86. };