Gruntfile.js 3.0 KB

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