Gruntfile.js 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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. // Project configuration.
  22. grunt.initConfig({
  23. // Metadata.
  24. // pkg: grunt.file.readJSON(''),
  25. banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
  26. '<%= grunt.template.today("yyyy-mm-dd") %>\n' +
  27. '<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
  28. '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
  29. ' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */\n',
  30. // task configuration
  31. amberc: {
  32. options: {
  33. amber_dir: findAmberPath(['../..', 'bower_components/amber']),
  34. library_dirs: ['src'],
  35. closure_jar: ''
  36. },
  37. all: {
  38. output_dir : 'src',
  39. src: [
  40. // list all sources in dependency order
  41. 'src/Helios-Core.st', 'src/Helios-Exceptions.st', 'src/Helios-Announcements.st',
  42. 'src/Helios-KeyBindings.st', 'src/Helios-Layout.st', 'src/Helios-Helpers.st',
  43. 'src/Helios-Commands-Core.st',
  44. 'src/Helios-Commands-Tools.st', 'src/Helios-Commands-Browser.st', 'src/Helios-Commands-SUnit.st',
  45. 'src/Helios-References.st', 'src/Helios-Inspector.st', 'src/Helios-Browser.st',
  46. 'src/Helios-Transcript.st', 'src/Helios-Workspace.st', 'src/Helios-Debugger.st',
  47. 'src/Helios-SUnit.st',
  48. // list all tests in dependency order
  49. 'src/Helios-Workspace-Tests.st', 'src/Helios-SUnit-Tests.st'
  50. ],
  51. libraries: ['Web', 'SUnit'],
  52. amd_namespace: 'helios',
  53. jsGlobals: ['navigator']
  54. },
  55. test_runner: {
  56. src: ['node_modules/amber-dev/lib/Test.st'],
  57. libraries: [
  58. /* add dependencies packages here */
  59. /* add other code-to-test packages here */
  60. 'SUnit',
  61. /* add other test packages here */
  62. ],
  63. main_class: 'NodeTestRunner',
  64. output_name: 'test_runner'
  65. }
  66. },
  67. execute: {
  68. test_runner: {
  69. src: ['test_runner.js']
  70. }
  71. },
  72. clean: {
  73. test_runner: ['test_runner.js']
  74. }
  75. });
  76. };