1
0

Gruntfile.js 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. ],
  33. amd_namespace: 'amber-trysmalltalk',
  34. libraries: ['SUnit', 'Web']
  35. },
  36. test_runner: {
  37. src: ['node_modules/amber-dev/lib/Test.st'],
  38. libraries: [
  39. /* add dependencies packages here */
  40. /* add other code-to-test packages here */
  41. 'SUnit',
  42. /* add other test packages here */
  43. ],
  44. main_class: 'NodeTestRunner',
  45. output_name: 'test_runner'
  46. }
  47. },
  48. amdconfig: {app: {dest: 'config.js'}},
  49. requirejs: {
  50. deploy: {options: {
  51. mainConfigFile: "config.js",
  52. onBuildWrite: function (moduleName, path, contents) {
  53. return moduleName === "config" ? contents + "\nrequire.config({map:{'*':{app:'deploy'}}});" : contents;
  54. },
  55. pragmas: {
  56. excludeIdeData: true,
  57. excludeDebugContexts: true
  58. },
  59. include: ['config', 'node_modules/requirejs/require', 'deploy'],
  60. out: "the.js"
  61. }},
  62. devel: {options: {
  63. mainConfigFile: "config.js",
  64. onBuildWrite: function (moduleName, path, contents) {
  65. return moduleName === "config" ? contents + "\nrequire.config({map:{'*':{app:'devel'}}});" : contents;
  66. },
  67. include: ['config', 'node_modules/requirejs/require'],
  68. out: "the.js"
  69. }}
  70. },
  71. execute: {
  72. test_runner: {
  73. src: ['test_runner.js']
  74. }
  75. },
  76. clean: {
  77. test_runner: ['test_runner.js']
  78. }
  79. });
  80. };