Gruntfile.js 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. 'use strict';
  2. var fs = require('fs'),
  3. path = require('path');
  4. function findAmberPath(options) {
  5. var result;
  6. options.some(function (x) {
  7. var candidate = path.join(__dirname, x);
  8. return fs.existsSync(path.join(candidate, 'support/boot.js')) && (result = candidate);
  9. });
  10. return result;
  11. }
  12. module.exports = function(grunt) {
  13. var path = require('path');
  14. // These plugins provide necessary tasks.
  15. grunt.loadNpmTasks('grunt-contrib-clean');
  16. grunt.loadNpmTasks('grunt-execute');
  17. grunt.loadNpmTasks('amber-dev');
  18. // Default task.
  19. grunt.registerTask('default', ['amberc:all']);
  20. grunt.registerTask('test', ['amberc:test_runner', 'execute:test_runner', 'clean:test_runner']);
  21. grunt.registerTask('devel', ['amdconfig:helios']);
  22. // Project configuration.
  23. grunt.initConfig({
  24. // Metadata.
  25. // pkg: grunt.file.readJSON(''),
  26. banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
  27. '<%= grunt.template.today("yyyy-mm-dd") %>\n' +
  28. '<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
  29. '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
  30. ' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */\n',
  31. // task configuration
  32. amberc: {
  33. options: {
  34. amber_dir: findAmberPath(['../..', 'bower_components/amber']),
  35. library_dirs: ['src'],
  36. closure_jar: ''
  37. },
  38. all: {
  39. output_dir : 'src',
  40. src: [
  41. // list all sources in dependency order
  42. 'src/Helios-Core.st', 'src/Helios-Exceptions.st', 'src/Helios-Announcements.st',
  43. 'src/Helios-KeyBindings.st', 'src/Helios-Layout.st', 'src/Helios-Helpers.st',
  44. 'src/Helios-Commands-Core.st',
  45. 'src/Helios-Commands-Tools.st', 'src/Helios-Commands-Browser.st', 'src/Helios-Commands-SUnit.st',
  46. 'src/Helios-References.st', 'src/Helios-Inspector.st', 'src/Helios-Browser.st',
  47. 'src/Helios-Transcript.st', 'src/Helios-Workspace.st', 'src/Helios-Debugger.st',
  48. 'src/Helios-SUnit.st',
  49. // list all tests in dependency order
  50. 'src/Helios-Browser-Tests.st', 'src/Helios-Workspace-Tests.st', 'src/Helios-SUnit-Tests.st'
  51. ],
  52. libraries: ['Web', 'SUnit'],
  53. amd_namespace: 'helios',
  54. jsGlobals: ['navigator']
  55. },
  56. test_runner: {
  57. src: ['node_modules/amber-dev/lib/Test.st'],
  58. libraries: [
  59. /* add dependencies packages here */
  60. /* add other code-to-test packages here */
  61. 'SUnit',
  62. /* add other test packages here */
  63. ],
  64. main_class: 'NodeTestRunner',
  65. output_name: 'test_runner'
  66. }
  67. },
  68. amdconfig: {helios: {dest: 'config.js'}},
  69. execute: {
  70. test_runner: {
  71. src: ['test_runner.js']
  72. }
  73. },
  74. clean: {
  75. test_runner: ['test_runner.js']
  76. }
  77. });
  78. };