X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/7a654f8d43fdb43d78b63d90528bed6e86b608cc..3789b528d8dd8aad4558e38e22d775bcab1cbd36:/jsbuilder/src/generators/controller/Controller.js?ds=inline diff --git a/jsbuilder/src/generators/controller/Controller.js b/jsbuilder/src/generators/controller/Controller.js new file mode 100644 index 00000000..3482fe33 --- /dev/null +++ b/jsbuilder/src/generators/controller/Controller.js @@ -0,0 +1,30 @@ +/** + * @class Ext.generator.Controller + * @extends Ext.generator.Base + * Generates a Controller file based on a template + */ +Ext.generator.Controller = Ext.extend(Ext.generator.Base, { + + generate: function() { + var controllerFile = 'app/controllers/' + this.name + '.js'; + + this.headline("Generating the " + this.name + " controller"); + + this.template('Controller', this, controllerFile); + this.template('ControllerSpec', this, 'test/unit/controllers/' + this.name + '.js'); + + this.insertInclude(controllerFile, 'sencha-controllers'); + this.insertInclude('../../' + controllerFile, 'app-controllers', 'test/unit/index.html'); + this.insertInclude('controllers/' + this.name + '.js', 'spec-controllers', 'test/unit/index.html'); + }, + + decodeArgs: function(args) { + this.name = args[0]; + this.actions = args.slice(1); + } +}); + +Ext.regGenerator('controller', Ext.generator.Controller); + +load('src/generators/controller/templates/ControllerSpec.js'); +load('src/generators/controller/templates/Controller.js'); \ No newline at end of file