Upgrade to ExtJS 4.0.1 - Released 05/18/2011
[extjs.git] / jsbuilder / src / generators / controller / Controller.js
1 /**
2  * @class Ext.generator.Controller
3  * @extends Ext.generator.Base
4  * Generates a Controller file based on a template
5  */
6 Ext.generator.Controller = Ext.extend(Ext.generator.Base, {
7
8     generate: function() {
9         var controllerFile = 'app/controllers/' + this.name + '.js';
10         
11         this.headline("Generating the " + this.name + " controller");
12         
13         this.template('Controller', this, controllerFile);
14         this.template('ControllerSpec', this, 'test/unit/controllers/' + this.name + '.js');
15         
16         this.insertInclude(controllerFile, 'sencha-controllers');
17         this.insertInclude('../../' + controllerFile, 'app-controllers', 'test/unit/index.html');
18         this.insertInclude('controllers/' + this.name + '.js', 'spec-controllers', 'test/unit/index.html');
19     },
20     
21     decodeArgs: function(args) {
22         this.name = args[0];
23         this.actions = args.slice(1);
24     }
25 });
26
27 Ext.regGenerator('controller', Ext.generator.Controller);
28
29 load('src/generators/controller/templates/ControllerSpec.js');
30 load('src/generators/controller/templates/Controller.js');