Blame view

js/lib/JSBuilder/src/JSBuilder.js 2.24 KB
16035364   Benjamin Renard   First commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
var JSBuilderPath = system.script.replace(/bin(\/|\\)JSBuilder\.js/, '');

load(JSBuilderPath + 'src/Loader.js');
Loader.setBasePath(JSBuilderPath + 'src');

Loader.require([
    'Ext', 'Cmd', 'Filesystem', 'Platform', 'Cli', 'Logger', 'Project', 'Target', 'Package', 'Build'
]);

/**
 * @class JSBuilder
 */
JSBuilder = Ext.extend(Cli, {
    name: 'JSBuilder',
    version: '3.0.0',
    
    map: {
        p: {
            name: 'projectFile',
            required: true,
            desc: 'Location of a jsb2 project file'
        },
        d: {
            name: 'deployDir',
            required: true,
            desc: 'The directory to build the project to'
        },
        v: {
            name: 'verbose',
            desc: 'Output detailed information about what is being built'
        },
        s: {
            name: 'debugSuffix',
            desc: 'Suffix to append to JS debug targets, defaults to \'debug\''
        },
        c: {
            name: 'nocompress',
            desc: 'Dont compress the targets'
        }     
    },
    
    usage: [
        'Example Usage:',
        '',
        'Windows:',
        'JSBuilder.bat -p C:\\Apps\\www\\ext3svn\\ext.jsb2 -d C:\\Apps\\www\\deploy\\',
        '',
        'Linux and OS X:',
        'JSBuilder.sh -p /home/tommy/www/trunk/ext.jsb2 -d /home/tommy/www/deploy/',
        '',
        'JSBuilder3 is a Sencha Project build tool.',
        'For additional information, see http://www.sencha.com/products/jsbuilder/'
    ],
    
    run : function() {
        if (JSBuilder.superclass.run.call(this) === false) {
            return;
        }
        
        // true to only set if it is not defined
        this.set('debugSuffix', '-debug', true); 

        this.project = new Project(this.get('projectFile'), this);
        
        if (this.get('sourceFiles')) {
            this.project.getSourceFiles();
        } else if (this.get('specFiles')) {
            this.project.getSpecFiles();
        } else {
            this.log('\nLoading the ' + this.project.get('name') + ' Project'); 
            this.log('Loaded ' + this.project.get('packages').length + ' Packages');
            this.log('Loaded ' + this.project.get('builds').length + ' Builds');

            this.project.build();
        }
    }    
});