2 * @class Ext.generator.Model
3 * @extends Ext.generator.Base
4 * Generates a model file based on config
6 Ext.generator.Model = Ext.extend(Ext.generator.Base, {
9 var modelFile = 'app/models/' + this.name + '.js',
10 specFile = 'test/unit/models/' + this.name + '.js',
11 fixtureFile = 'test/fixtures/' + this.name + '.js';
13 this.headline("Generating the " + this.name + " model");
14 this.template("Model", this, modelFile);
15 this.template("ModelSpec", this, specFile);
16 this.template("Fixture", this, fixtureFile);
18 this.insertInclude(modelFile, 'sencha-models');
20 this.insertInclude('../../' + modelFile, 'app-models', 'test/unit/index.html');
21 this.insertInclude('models/' + this.name + '.js', 'spec-models', 'test/unit/index.html');
22 this.insertInclude('../fixtures/' + this.name + '.js', 'fixtures', 'test/unit/index.html');
25 decodeArgs: function(args) {
27 this.fields = args.slice(1);
29 var length = this.fields.length,
32 for (i = 0; i < length; i++) {
33 field = this.fields[i].split(':');
43 Ext.regGenerator('model', Ext.generator.Model);
45 load('src/generators/model/templates/ModelSpec.js');
46 load('src/generators/model/templates/Model.js');
47 load('src/generators/model/templates/Fixture.js');