Gruntfile.js 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /* jshint node:true */
  2. 'use strict';
  3. module.exports = function (grunt) {
  4. var config = {
  5. pkg: grunt.file.readJSON('package.json'),
  6. baseDir: '.',
  7. srcDir: 'src',
  8. destDir: 'dist',
  9. tempDir: 'tmp',
  10. docsDir: 'docs/',
  11. arch: grunt.option('arch') || 'x86_64',
  12. };
  13. // load plugins
  14. require('load-grunt-tasks')(grunt);
  15. // load task definitions
  16. grunt.loadTasks('tasks');
  17. // Utility function to load plugin settings into config
  18. function loadConfig(config,path) {
  19. require('glob').sync('*', {cwd: path}).forEach(function(option) {
  20. var key = option.replace(/\.js$/,'');
  21. // If key already exists, extend it. It is your responsibility to avoid naming collisions
  22. config[key] = config[key] || {};
  23. grunt.util._.extend(config[key], require(path + option)(config,grunt));
  24. });
  25. // technically not required
  26. return config;
  27. }
  28. // Merge that object with what with whatever we have here
  29. loadConfig(config,'./tasks/options/');
  30. // pass the config to grunt
  31. grunt.initConfig(config);
  32. };