1 Loader.require('Parser');
3 Build = Ext.extend(Target, {
4 getDefaultTarget : function() {
5 return (this.get('id') || this.get('name').replace(/ /g, '').toLowerCase()) + '.js';
8 onCreate: function(file) {
9 Build.superclass.onCreate.apply(this, arguments);
11 var project = this.project,
12 verbose = project.builder.get('verbose'),
13 packages = this.get('packages') || [];
15 if (verbose && packages.length) {
16 Logger.log(' - ' + packages.length + ' package(s) included in this target.');
19 // Loop over all file includes, read the contents, and write
20 // it to our target file
21 packages.forEach(function(id) {
22 var pkg = this.project.getPackageById(id),
30 Logger.log(' + ' + pkg.get('target'));
33 pkg = new Stream(pkg.get('targetPath'));
34 content = pkg.readFile();
37 file.writeln(content);
42 afterCreate : function() {
43 var params = Ext.apply({debug: this.get('debug'), debugLevel: 1}, this.get('options') || {});
45 Logger.log(' * Parse ' + this.get('target') + ' with options:');
47 Ext.iterate(params, function(n, v) {
48 Logger.log(' - ' + n + ": " + v);
51 Parser.setParams(params);
53 var filePath = this.get('targetPath');
54 var parsedContent = Parser.parse(filePath);
56 var file = new Stream(filePath, 'w');
57 file.writeln(parsedContent);
60 Build.superclass.afterCreate.apply(this);