Upgrade to ExtJS 4.0.1 - Released 05/18/2011
[extjs.git] / jsbuilder / src / JSBuilder.js
1 var JSBuilderPath = system.script.replace(/bin(\/|\\)JSBuilder\.js/, '');
2
3 load(JSBuilderPath + 'src/Loader.js');
4 Loader.setBasePath(JSBuilderPath + 'src');
5
6 Loader.require([
7     'Ext', 'Cmd', 'Filesystem', 'Platform', 'Cli', 'Logger', 'Project', 'Target', 'Package', 'Build'
8 ]);
9
10 /**
11  * @class JSBuilder
12  */
13 JSBuilder = Ext.extend(Cli, {
14     name: 'JSBuilder',
15     version: '3.0.0',
16     
17     map: {
18         p: {
19             name: 'projectFile',
20             required: true,
21             desc: 'Location of a jsb2 project file'
22         },
23         d: {
24             name: 'deployDir',
25             required: true,
26             desc: 'The directory to build the project to'
27         },
28         v: {
29             name: 'verbose',
30             desc: 'Output detailed information about what is being built'
31         },
32         s: {
33             name: 'debugSuffix',
34             desc: 'Suffix to append to JS debug targets, defaults to \'debug\''
35         },
36         c: {
37             name: 'nocompress',
38             desc: 'Dont compress the targets'
39         }     
40     },
41     
42     usage: [
43         'Example Usage:',
44         '',
45         'Windows:',
46         'JSBuilder.bat -p C:\\Apps\\www\\ext3svn\\ext.jsb2 -d C:\\Apps\\www\\deploy\\',
47         '',
48         'Linux and OS X:',
49         'JSBuilder.sh -p /home/tommy/www/trunk/ext.jsb2 -d /home/tommy/www/deploy/',
50         '',
51         'JSBuilder3 is a Sencha Project build tool.',
52         'For additional information, see http://www.sencha.com/products/jsbuilder/'
53     ],
54     
55     run : function() {
56         if (JSBuilder.superclass.run.call(this) === false) {
57             return;
58         }
59         
60         // true to only set if it is not defined
61         this.set('debugSuffix', '-debug', true); 
62
63         this.project = new Project(this.get('projectFile'), this);
64         
65         if (this.get('sourceFiles')) {
66             this.project.getSourceFiles();
67         } else if (this.get('specFiles')) {
68             this.project.getSpecFiles();
69         } else {
70             this.log('\nLoading the ' + this.project.get('name') + ' Project'); 
71             this.log('Loaded ' + this.project.get('packages').length + ' Packages');
72             this.log('Loaded ' + this.project.get('builds').length + ' Builds');
73
74             this.project.build();
75         }
76     }    
77 });