8
0

dev.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /**
  2. * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md.
  4. */
  5. 'use strict';
  6. const initTask = require( './utils/dev-init' );
  7. const pluginCreateTask = require( './utils/dev-plugin-create' );
  8. const pluginInstallTask = require( './utils/dev-plugin-install' );
  9. const pluginUpdateTask = require( './utils/dev-update' );
  10. const pluginStatusTask = require( './utils/dev-status' );
  11. const boilerplateUpdateTask = require( './utils/dev-boilerplate-update' );
  12. const ckeditor5Path = process.cwd();
  13. module.exports = ( grunt ) => {
  14. const packageJSON = grunt.config.data.pkg;
  15. grunt.registerTask( 'dev-init', function() {
  16. const options = getOptions( this );
  17. initTask( ckeditor5Path, packageJSON, options, grunt.log.writeln, grunt.log.error );
  18. } );
  19. grunt.registerTask( 'dev-plugin-create', function() {
  20. const done = this.async();
  21. const options = getOptions( this );
  22. pluginCreateTask( ckeditor5Path, options, grunt.log.writeln, grunt.log.error ).then( done );
  23. } );
  24. grunt.registerTask( 'dev-plugin-install', function() {
  25. const done = this.async();
  26. const options = getOptions( this );
  27. pluginInstallTask( ckeditor5Path, options, grunt.log.writeln, grunt.log.error ).then( done );
  28. } );
  29. grunt.registerTask( 'dev-update', function() {
  30. const options = getOptions( this );
  31. pluginUpdateTask( ckeditor5Path, packageJSON, options, grunt.log.writeln, grunt.log.error );
  32. } );
  33. grunt.registerTask( 'dev-status', function() {
  34. const options = getOptions( this );
  35. pluginStatusTask( ckeditor5Path, packageJSON, options, grunt.log.writeln, grunt.log.error );
  36. } );
  37. grunt.registerTask( 'dev-boilerplate-update', function() {
  38. const options = getOptions( this );
  39. boilerplateUpdateTask( ckeditor5Path, packageJSON, options, grunt.log.writeln, grunt.log.error );
  40. } );
  41. function getOptions( context ) {
  42. const options = {
  43. workspaceRoot: '..'
  44. };
  45. return context.options( options );
  46. }
  47. };