Permalink
Browse files

first commit

  • Loading branch information...
0 parents commit 32290a8595c5b11209c76d56b12e6db748c3a92b @strobemonkey committed Sep 23, 2011
Showing with 28,159 additions and 0 deletions.
  1. +31 −0 app/app.js
  2. 0 app/controllers/.gitignore
  3. +23 −0 app/controllers/Controller.Config.js
  4. +7 −0 app/controllers/Controller.Main.js
  5. +62 −0 app/controllers/Controller.Sessions.js
  6. +21 −0 app/lib/Ext.Dispatcher.filters.js
  7. 0 app/models/.gitignore
  8. +75 −0 app/models/Model.Config.js
  9. +23 −0 app/models/Model.Session.js
  10. +22 −0 app/routes.js
  11. 0 app/stores/.gitignore
  12. +4 −0 app/stores/Store.Config.js
  13. +4 −0 app/stores/Store.Sessions.js
  14. +25 −0 app/views/ErrorField.js
  15. +39 −0 app/views/View.Main.js
  16. +23 −0 app/views/Viewport.js
  17. +64 −0 app/views/config/View.Config.Form.js
  18. +51 −0 app/views/sessions/View.Sessions.Form.js
  19. +60 −0 index.html
  20. +37 −0 lib/JSBuilder/bin/Dispatch.js
  21. +6 −0 lib/JSBuilder/bin/Generator.js
  22. +2 −0 lib/JSBuilder/bin/JSBuilder.js
  23. +558 −0 lib/JSBuilder/jsdb/license.txt
  24. BIN lib/JSBuilder/jsdb/linux/jsdb
  25. BIN lib/JSBuilder/jsdb/mac/jsdb
  26. +60 −0 lib/JSBuilder/src/Build.js
  27. +140 −0 lib/JSBuilder/src/Cli.js
  28. +11 −0 lib/JSBuilder/src/Cmd.js
  29. +267 −0 lib/JSBuilder/src/Ext.js
  30. +90 −0 lib/JSBuilder/src/Filesystem.js
  31. +203 −0 lib/JSBuilder/src/Generator.js
  32. +77 −0 lib/JSBuilder/src/JSBuilder.js
  33. +74 −0 lib/JSBuilder/src/Loader.js
  34. +8 −0 lib/JSBuilder/src/Logger.js
  35. +5 −0 lib/JSBuilder/src/Package.js
  36. +151 −0 lib/JSBuilder/src/Parser.js
  37. +116 −0 lib/JSBuilder/src/Parser.old.js
  38. +98 −0 lib/JSBuilder/src/Parser/Statement.js
  39. +9 −0 lib/JSBuilder/src/Parser/Statement/Debug.js
  40. +13 −0 lib/JSBuilder/src/Parser/Statement/Deprecated.js
  41. +10 −0 lib/JSBuilder/src/Parser/Statement/Else.js
  42. +17 −0 lib/JSBuilder/src/Parser/Statement/Elseif.js
  43. +55 −0 lib/JSBuilder/src/Parser/Statement/If.js
  44. +4 −0 lib/JSBuilder/src/Platform.js
  45. +211 −0 lib/JSBuilder/src/Project.js
  46. +138 −0 lib/JSBuilder/src/Target.js
  47. +275 −0 lib/JSBuilder/src/Template.js
  48. +469 −0 lib/JSBuilder/src/XTemplate.js
  49. +91 −0 lib/JSBuilder/src/generators/app/Application.js
  50. +18 −0 lib/JSBuilder/src/generators/app/files/app/routes.js
  51. +38 −0 lib/JSBuilder/src/generators/app/files/index.html
  52. +37 −0 lib/JSBuilder/src/generators/app/files/lib/JSBuilder/bin/Dispatch.js
  53. +20 −0 lib/JSBuilder/src/generators/app/files/lib/jasmine/MIT.LICENSE
  54. +182 −0 lib/JSBuilder/src/generators/app/files/lib/jasmine/jasmine-html.js
  55. +166 −0 lib/JSBuilder/src/generators/app/files/lib/jasmine/jasmine.css
  56. +2,421 −0 lib/JSBuilder/src/generators/app/files/lib/jasmine/jasmine.js
  57. +10 −0 lib/JSBuilder/src/generators/app/files/lib/sencha-jasmine/matchers/Controller.js
  58. +54 −0 lib/JSBuilder/src/generators/app/files/lib/sencha-jasmine/matchers/Model.js
  59. +226 −0 lib/JSBuilder/src/generators/app/files/lib/sencha-jasmine/sencha-jasmine.css
  60. +88 −0 lib/JSBuilder/src/generators/app/files/lib/sencha-jasmine/sencha-jasmine.js
  61. +3 −0 lib/JSBuilder/src/generators/app/files/public/resources/css/application.css
  62. +11 −0 lib/JSBuilder/src/generators/app/files/sencha.sh
  63. +2 −0 lib/JSBuilder/src/generators/app/files/test/unit/.htaccess
  64. +9 −0 lib/JSBuilder/src/generators/app/files/test/unit/SpecOptions.js
  65. +69 −0 lib/JSBuilder/src/generators/app/files/test/unit/index.html
  66. +12 −0 lib/JSBuilder/src/generators/app/templates/Application.js
  67. +93 −0 lib/JSBuilder/src/generators/app/templates/Viewport.js
  68. +30 −0 lib/JSBuilder/src/generators/controller/Controller.js
  69. +9 −0 lib/JSBuilder/src/generators/controller/templates/Controller.js
  70. +12 −0 lib/JSBuilder/src/generators/controller/templates/ControllerSpec.js
  71. +47 −0 lib/JSBuilder/src/generators/model/Model.js
  72. +9 −0 lib/JSBuilder/src/generators/model/templates/Fixture.js
  73. +9 −0 lib/JSBuilder/src/generators/model/templates/Model.js
  74. +9 −0 lib/JSBuilder/src/generators/model/templates/ModelSpec.js
  75. +6 −0 lib/JSBuilder/tests/builder.js
  76. +40 −0 lib/JSBuilder/tests/parser.js
  77. +9 −0 lib/JSBuilder/tests/parser/after1.js
  78. +2 −0 lib/JSBuilder/tests/parser/after2.js
  79. +17 −0 lib/JSBuilder/tests/parser/before1.js
  80. +9 −0 lib/JSBuilder/tests/parser/before2.js
  81. +51 −0 lib/JSBuilder/tests/run.js
  82. +378 −0 lib/client/client-framework-debug.js
  83. +1 −0 lib/client/client-framework.js
  84. +20 −0 lib/jasmine/MIT.LICENSE
  85. +182 −0 lib/jasmine/jasmine-html.js
  86. +166 −0 lib/jasmine/jasmine.css
  87. +2,421 −0 lib/jasmine/jasmine.js
  88. +10 −0 lib/sencha-jasmine/matchers/Controller.js
  89. +54 −0 lib/sencha-jasmine/matchers/Model.js
  90. +226 −0 lib/sencha-jasmine/sencha-jasmine.css
  91. +88 −0 lib/sencha-jasmine/sencha-jasmine.js
  92. +42 −0 lib/sinon/jasmine-sinon.js
  93. +2,821 −0 lib/sinon/sinon-1.1.1.js
  94. +82 −0 lib/sinon/sinon-ie-1.1.1.js
  95. +232 −0 lib/sinon/sinon.js
  96. +5,871 −0 lib/touch/pkgs/core.js
  97. +3,992 −0 lib/touch/pkgs/dom.js
  98. +972 −0 lib/touch/pkgs/gestures.js
  99. +1,582 −0 lib/touch/pkgs/layouts.js
  100. +1,572 −0 lib/touch/pkgs/platform/core.js
Sorry, we could not display the entire diff because too many files (504) changed.
31 app/app.js
@@ -0,0 +1,31 @@
+App = new Ext.Application({
+
+ name: "App",
+
+ requireUser: function() {
+ if(App.isAuthenticated()) return true;
+ Ext.redirect('login');
+ return false;
+ },
+
+ // does a session record exist and is the authToken set?
+ isAuthenticated: function() {
+ var store,
+ model;
+
+ store = App.stores.sessions;
+ if (!store) return false;
+ model = store.first();
+ if (!model) return false;
+ return (model.get("authToken") !== null);
+ },
+
+ launch: function() {
+ this.views.viewport = new this.views.Viewport();
+
+ this.views.main = this.views.viewport.down('#main');
+ this.views.configForm = this.views.viewport.down('#configForm');
+ this.views.loginForm = this.views.viewport.down('#loginForm');
+ }
+
+});
0 app/controllers/.gitignore
No changes.
23 app/controllers/Controller.Config.js
@@ -0,0 +1,23 @@
+Ext.regController('Config', {
+
+ beforeFilter: App.requireUser,
+
+ store: App.stores.config,
+
+ editForm: function() {
+
+ App.views.configForm.addEvents('beforeactivate');
+ App.views.configForm.addListener({
+ beforeactivate: function() {
+ var deleteButton = this.down('#configFormDeleteButton'),
+ titlebar = this.down('#configFormTitlebar'),
+ model = this.getRecord();
+
+ }
+ });
+
+ App.views.viewport.reveal('configForm');
+
+ }
+
+});
7 app/controllers/Controller.Main.js
@@ -0,0 +1,7 @@
+Ext.regController('Main', {
+
+ index: function() {
+ App.views.viewport.reveal('main');
+ }
+
+});
62 app/controllers/Controller.Sessions.js
@@ -0,0 +1,62 @@
+Ext.regController('UserSessions', {
+
+ store: App.stores.sessions,
+
+ new: function() {
+
+ this.destroy();
+
+ var model = new App.models.Session();
+
+ App.views.loginForm.load(model);
+
+ App.views.loginForm.query('#loginFormLoginButton')[0].on({
+ tap: function() { this.save(model, App.views.loginForm.getValues(), this); },
+ scope: this
+ });
+
+ App.views.loginForm.query('#loginFormResetButton')[0].on({
+ tap: function() { App.views.loginForm.reset() },
+ scope: this
+ });
+
+ App.views.viewport.reveal('loginForm');
+
+ },
+
+ save: function(record, data, form) {
+
+ console.log("Controller.Sessions.save");
+
+ data.authToken = this.getAuthToken();
+
+ record.set(data);
+ var errors = record.validate();
+
+ if (errors.isValid()) {
+ this.store.create(data);
+ console.log("Controller.Sessions.save login success");
+
+ Ext.dispatch({
+ controller: 'Main',
+ action: 'index'
+ });
+
+ } else {
+ console.log("Controller.Sessions.save login failed");
+ form.showErrors(errors);
+ }
+
+ },
+
+ destroy: function() {
+ console.log("Controller.Sessions.destroy");
+ },
+
+ getAuthToken: function() {
+ // TODO put your server login code here
+ // and set the authToken
+ return "notavalidauthtoken";
+ }
+
+});
21 app/lib/Ext.Dispatcher.filters.js
@@ -0,0 +1,21 @@
+/*
+ * Example: to add a before filter to a controller add the following
+ * beforeFilter: App.requireUser
+ * where App.requireUser is a method you've defined on the App object.
+ */
+
+Ext.Dispatcher.on('before-dispatch', function(interaction) {
+ console.log("before-dispatch");
+ if(Ext.isFunction(interaction.controller.beforeFilter)) {
+ console.log("before-dispatch - beforeFilter defined");
+ return interaction.controller.beforeFilter.call();
+ };
+ return true;
+});
+
+Ext.Dispatcher.on('dispatch', function(interaction) {
+ if(Ext.isFunction(interaction.controller.afterFilter)) {
+ return interaction.controller.afterFilter.call();
+ };
+ return true;
+});
0 app/models/.gitignore
No changes.
75 app/models/Model.Config.js
@@ -0,0 +1,75 @@
+App.models.Config = Ext.regModel('Config', {
+ fields: [
+ {
+ name: 'id',
+ type: 'int'
+ }, {
+ name: 'server',
+ type: 'string'
+ }, {
+ name: 'key',
+ type: 'string'
+ }, {
+ name: 'nickname',
+ type: 'string',
+ }, {
+ name: 'email',
+ type: 'string'
+ }, {
+ name: 'gravatar',
+ type: 'string'
+ }, {
+ name: 'messaging',
+ type: 'string',
+ defaultValue: 'Polling'
+ },{
+ name: 'timerInterval',
+ type: 'int',
+ defaultValue: 500
+ }
+ ],
+
+ validations: [
+ {
+ type: 'format',
+ name: 'server',
+ matcher: /^https?:\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/,
+ message: 'must be a valid url'
+ }, {
+ type: 'length',
+ name: 'key',
+ min: 6,
+ message: 'must be at least 6 characters'
+ }, {
+ type: 'format',
+ name: 'nickname',
+ matcher: /^[a-zA-Z0-9]+$/,
+ message: 'must only contain characters and numbers'
+ }, {
+ type: 'format',
+ name: 'email',
+ matcher: /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/,
+ message: 'must be a valid email'
+ }, {
+ type: 'inclusion',
+ name: 'messaging',
+ list: ['polling', 'asynchronous', 'off'],
+ message: 'must be either polling, asynchronous or off'
+ }
+ ],
+
+ proxy: {
+ type: 'localstorage',
+ id: 'config-settings'
+ },
+
+ // Update the gravatar field based upon the email value.
+ updateGravatar: function() {
+ var email = this.get('email'),
+ gravatar = Ext.util.MD5(email);
+
+ this.set('gravatar', gravatar);
+
+ }
+
+});
23 app/models/Model.Session.js
@@ -0,0 +1,23 @@
+App.models.Session = Ext.regModel('Session', {
+ fields: [
+ {
+ name: 'id',
+ type: 'int'
+ }, {
+ name: 'username',
+ type: 'string',
+ }, {
+ name: 'password',
+ type: 'string'
+ }, {
+ name: 'authToken',
+ type: 'string'
+ }
+ ],
+
+ proxy: {
+ type: 'sessionstorage',
+ id: 'login-user'
+ }
+
+});
22 app/routes.js
@@ -0,0 +1,22 @@
+/**
+ * The Router maps local urls to controller and action pairs. This is used primarily
+ * for providing history support without reloading the page. Example usage:
+ *
+ * Connects http://myapp.com/#home to the index controller's overview action
+ * map.connect("home", {controller: 'index', action: 'overview'});
+ *
+ * Connects urls like "images/myImage.jpg" to the images controller's show action, passing
+ * "myImage.jpg" as the "url" property of the options object each controller action receives
+ * map.connect("images/:url", {controller: 'images', action: 'show'});
+ */
+Ext.Router.draw(function(map) {
+
+ map.connect('home', { controller: 'Main', action: 'index' });
+
+ map.connect('login', { controller: 'UserSessions', action: 'new' });
+ map.connect('logout', { controller: 'UserSessions', action: 'destroy'});
+
+ //These are default fallback routes and can be removed if not needed
+ map.connect(':controller/:action');
+ map.connect(':controller/:action/:id');
+});
0 app/stores/.gitignore
No changes.
4 app/stores/Store.Config.js
@@ -0,0 +1,4 @@
+App.stores.config = new Ext.data.Store({
+ model: 'Config',
+ autoLoad: true
+});
4 app/stores/Store.Sessions.js
@@ -0,0 +1,4 @@
+App.stores.sessions = new Ext.data.Store({
+ model: 'Session',
+ autoLoad: true
+});
25 app/views/ErrorField.js
@@ -0,0 +1,25 @@
+App.views.ErrorField = Ext.extend(Ext.Component, {
+
+ initComponent: function() {
+ config = {
+ xtype: 'component',
+ id: this.fieldname + 'ErrorField',
+ cls: 'errorfield',
+ tpl: [
+ '<tpl if="values.length &gt; 0">',
+ ' <ul>',
+ ' <tpl for=".">',
+ ' <li>{field} {message}</li>',
+ ' </tpl>',
+ ' </ul>',
+ '</tpl>'
+ ],
+ hidden: true
+ };
+
+ Ext.apply(this, config);
+ App.views.ErrorField.superclass.initComponent.call(this);
+ },
+
+});
+Ext.reg('App.views.ErrorField', App.views.ErrorField);
39 app/views/View.Main.js
@@ -0,0 +1,39 @@
+App.views.Main = Ext.extend(Ext.Panel, {
+ initComponent: function(){
+ var settingsButton, titlebar;
+
+ settingsButton = {
+ itemId: 'settingsButton',
+ iconCls: 'settings',
+ iconMask: true,
+ ui: 'plain',
+ handler: this.onSettingsAction,
+ scope: this
+ };
+
+ titlebar = {
+ dock: 'top',
+ xtype: 'toolbar',
+ title: 'Main',
+ items: [ settingsButton ]
+ };
+
+ Ext.apply(this, {
+ html: 'placeholder',
+ layout: 'fit',
+ dockedItems: [titlebar]
+ });
+
+ App.views.Main.superclass.initComponent.call(this);
+ },
+
+ onSettingsAction: function() {
+ Ext.dispatch({
+ controller: 'Config',
+ action: 'editForm'
+ });
+ }
+
+});
+
+Ext.reg('App.views.Main', App.views.Main);
23 app/views/Viewport.js
@@ -0,0 +1,23 @@
+App.views.Viewport = Ext.extend(Ext.Panel, {
+ fullscreen: true,
+ layout: 'card',
+
+ initComponent: function() {
+ Ext.apply(this, {
+ items: [
+ { xtype: 'App.views.Main', id: 'main' },
+ { xtype: 'App.views.ConfigForm', id: 'configForm' },
+ { xtype: 'App.views.LoginForm', id: 'loginForm' },
+ ]
+ });
+ App.views.Viewport.superclass.initComponent.apply(this, arguments);
+ },
+
+ reveal: function(target) {
+ var direction = (target === 'main') ? 'right' : 'left';
+ this.setActiveItem(
+ App.views[target],
+ { type: 'slide', direction: direction }
+ );
+ }
+});
64 app/views/config/View.Config.Form.js
@@ -0,0 +1,64 @@
+App.views.ConfigForm = Ext.extend(Ext.form.FormPanel, {
+ defaultInstructions: 'This page requires authentication to be able to see it.',
+
+ initComponent: function(){
+ var titlebar, cancelButton, buttonbar, fields, config;
+
+ cancelButton = {
+ text: 'cancel',
+ ui: 'back',
+ handler: this.onCancelAction,
+ scope: this
+ };
+
+ titlebar = {
+ id: 'configFormTitlebar',
+ xtype: 'toolbar',
+ title: 'Create config',
+ items: [ cancelButton ]
+ };
+
+ buttonbar = {
+ xtype: 'toolbar',
+ dock: 'bottom',
+ items: []
+ };
+
+ fields = {
+ xtype: 'fieldset',
+ id: 'configFormFieldset',
+ title: 'Config details',
+ instructions: this.defaultInstructions,
+ defaults: {
+ xtype: 'textfield',
+ labelAlign: 'left',
+ labelWidth: '40%',
+ required: false,
+ useClearIcon: true,
+ autoCapitalize : false
+ },
+ items: [
+ ]
+ };
+
+ config = {
+ scroll: 'vertical',
+ dockedItems: [ titlebar, buttonbar ],
+ items: [ fields ]
+ };
+
+ Ext.apply(this, config);
+
+ App.views.ConfigForm.superclass.initComponent.call(this);
+ },
+
+ onCancelAction: function() {
+ Ext.dispatch({
+ controller: 'Main',
+ action: 'index'
+ });
+ }
+
+});
+
+Ext.reg('App.views.ConfigForm', App.views.ConfigForm);
51 app/views/sessions/View.Sessions.Form.js
@@ -0,0 +1,51 @@
+App.views.LoginForm = Ext.extend(Ext.form.FormPanel, {
+
+ initComponent: function() {
+
+ var saveButton, resetButton, config;
+
+ saveButton = {
+ id: 'loginFormLoginButton',
+ text: 'save',
+ ui: 'confirm',
+ scope: this
+ };
+
+ resetButton = {
+ id: 'loginFormResetButton',
+ text: 'reset',
+ ui: 'drastic',
+ scope: this
+ };
+
+ config = {
+ scroll: 'vertical',
+ fullscreen: true,
+ url: 'login',
+ items: [{
+ xtype: 'textfield',
+ label: 'Login',
+ name: 'username'
+ },{
+ xtype: 'passwordfield',
+ label: 'Password',
+ name: 'password'
+ }],
+ dockedItems: [{
+ xtype: 'toolbar',
+ dock: 'bottom',
+ items: [
+ resetButton
+ ,
+ saveButton
+ ]
+ }]
+ };
+
+ Ext.apply(this, config);
+
+ App.views.LoginForm.superclass.initComponent.call(this);
+ }
+});
+
+Ext.reg('App.views.LoginForm', App.views.LoginForm);
60 index.html
@@ -0,0 +1,60 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>Sencha Touch</title>
+
+ <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" />
+ <meta name="apple-mobile-web-app-capable" content="yes" />
+ <link rel="apple-touch-icon" href="apple-touch-icon.png" />
+
+ <link rel="stylesheet" href="lib/touch/resources/css/sencha-touch.css" type="text/css" media="screen"/>
+ <link rel="stylesheet" href="resources/css/styles.css" type="text/css" media="screen"/>
+
+ </head>
+ <body>
+ <div id="sencha-app">
+
+ <script src="lib/touch/sencha-touch-debug.js" type="text/javascript"></script>
+
+ <!-- lib, app, models, stores, views, controllers [in that order!] -->
+
+ <!-- Place your lib files here -->
+ <div id="sencha-lib">
+ <script src="app/lib/Ext.Dispatcher.filters.js" type="text/javascript" charset="utf-8"></script>
+ </div>
+
+ <script src="app/routes.js" type="text/javascript" charset="utf-8"></script>
+ <script src="app/app.js" type="text/javascript"></script>
+
+ <!-- Place your model files here -->
+ <div id="sencha-models">
+ <script src="app/models/Model.Session.js" type="text/javascript"></script>
+ <script src="app/models/Model.Config.js" type="text/javascript"></script>
+ </div>
+
+ <!-- Place your store files here -->
+ <div id="sencha-stores">
+ <script src="app/stores/Store.Sessions.js" type="text/javascript"></script>
+ <script src="app/stores/Store.Config.js" type="text/javascript"></script>
+ </div>
+
+ <!-- Place your view files here -->
+ <div id="sencha-views">
+ <script src="app/views/ErrorField.js" type="text/javascript"></script>
+ <script src="app/views/View.Main.js" type="text/javascript"></script>
+ <script src="app/views/config/View.Config.Form.js" type="text/javascript"></script>
+ <script src="app/views/Viewport.js" type="text/javascript"></script>
+ <script src="app/views/sessions/View.Sessions.Form.js" type="text/javascript"></script>
+ </div>
+
+ <!-- Place your controller files here -->
+ <div id="sencha-controllers">
+ <script src="app/controllers/Controller.Main.js" type="text/javascript"></script>
+ <script src="app/controllers/Controller.Sessions.js" type="text/javascript"></script>
+ <script src="app/controllers/Controller.Config.js" type="text/javascript"></script>
+ </div>
+
+ </div>
+ </body>
+
+</html>
37 lib/JSBuilder/bin/Dispatch.js
@@ -0,0 +1,37 @@
+var JSBuilderPath = system.cwd + '/lib/JSBuilder/';
+
+load(JSBuilderPath + 'src/Loader.js');
+Loader.setBasePath(JSBuilderPath + 'src');
+
+Loader.require([
+ 'Ext', 'Cmd', 'Filesystem', 'Platform', 'Cli', 'Logger', 'Project', 'Target', 'Package', 'Build'
+]);
+
+/**
+ * @class Ext.CommandDispatcher
+ * @extends Object
+ * Dispaches to the relevant Cli subclass from the command line 'sencha' command. e.g.
+ * sencha generate xyz is dispatched to whichever Ext.Cli subclass registered itself to
+ * handler the 'generate' command (Ext.generator.Factory in this case).
+ */
+Ext.CommandDispatcher = {
+ types: {},
+
+ dispatch: function(module, args) {
+ new this.types[module]({args: args});
+ }
+};
+
+Ext.regDispatchable = function(name, constructor) {
+ Ext.CommandDispatcher.types[name] = constructor;
+};
+
+load('src/Generator.js');
+load('src/generators/app/Application.js');
+load('src/generators/controller/Controller.js');
+load('src/generators/model/Model.js');
+
+var args = system.arguments,
+ module = args[0];
+
+Ext.CommandDispatcher.dispatch(module, args.slice(1));
6 lib/JSBuilder/bin/Generator.js
@@ -0,0 +1,6 @@
+load('src/Generator.js');
+load('src/generators/app/Application.js');
+load('src/generators/controller/Controller.js');
+load('src/generators/model/Model.js');
+
+new Ext.generator.Factory();
2 lib/JSBuilder/bin/JSBuilder.js
@@ -0,0 +1,2 @@
+load('src/JSBuilder.js');
+new JSBuilder();
558 lib/JSBuilder/jsdb/license.txt
@@ -0,0 +1,558 @@
+The source code in this package comes in three parts: Raosoft, ZLIB, and SpiderMonkey, each of which
+come with separate license and copyright statements.
+
+The Raosoft component and the JSDB environment linking the major components were written by
+Potluri M. Rao and Shanti R. Rao. To the best of their knowledge, this code is not encumbered
+by any patent or undisclosed intellectual property claims. Their license statement follows.
+
+ The Raosoft libraries: Copyright 1993-2004 by Potluri M. Rao and Shanti R. Rao
+ The JSDB program: Copyright 2003-2004 by Shanti R. Rao
+
+ Copyright License
+
+ The authors grant you a world-wide, royalty-free, non-exclusive license to use this software.
+
+ JSDB is a trademark of Shanti R. Rao.
+
+ Permission is granted to anyone to use this software for any purpose, including commercial
+ applications, and to alter it and redistribute it freely, subject to the following restrictions:
+
+ 1. Modifications made to this code and submitted to the authors will be considered to be a gift.
+ Persons contributing to JSDB certify that they are submitting their own original work, that the
+ contributions are free of patent or other intellectual property claims, and that they do not
+ expect renumeration for their work.
+
+ 2. The origin of this software must not be misrepresented; you must not claim that you wrote
+ the original software. If you use this software in a product, acknowledge the authors
+ and reference the JSDB.org web site near your own copyright statement or license terms.
+ Copyright notices embedded in the program and source code may not be removed or defaced.
+
+ 3. Altered versions of this software, whether distributed in binary or source form, must be
+ plainly marked as such, and not represented as being JSDB. Altered versions must plainly say
+ that they are derived from JSDB, reference the JSDB.org web site, and refer to the JSDB
+ copyright and trademark. In particular, altered versions may not be called JSDB, or given
+ any confusingly similar name, pursuant to United States trademark law. Linking any portion
+ of the JSDB code with another program is considered an altered version.
+
+ 4. This software is provided 'as-is', without warranty of any kind. The authors make no
+ express or implied guarantee that this code is free from defects, or fit for a particular
+ purpose. The authors will not be held responsible for damages arising from the use of the
+ software.
+
+ 5. This license and the rights granted hereunder will terminate automatically if you fail to
+ comply with these terms and fail to cure such breach within 30 days of becoming aware of the
+ breach.
+
+ 6. This entire notice must be included, unaltered, with any distribution of all or a part of
+ the source code.
+
+ 7. Any redistribution of this program, whether in source or binary form, must be under license
+ terms not less restrictive than those described here.
+
+ END
+---------------
+
+ZLIB was written by Mark Adler and Jean-Loup Gailly. Its license statement follows.
+
+ Copyright (C) 1995-2002 Jean-loup Gailly and Mark Adler
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+
+ Jean-loup Gailly Mark Adler
+ jloup@gzip.org madler@alumni.caltech.edu
+
+
+ The data format used by the zlib library is described by RFCs (Request for
+ Comments) 1950 to 1952 in the files ftp://ds.internic.net/rfc/rfc1950.txt
+ (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format).
+
+ END
+------------------
+
+SpiderMonkey is licensed by the Mozilla organization. Its license statement follows.
+
+ MOZILLA PUBLIC LICENSE
+ Version 1.1
+
+ ---------------
+
+1. Definitions.
+
+ 1.0.1. "Commercial Use" means distribution or otherwise making the
+ Covered Code available to a third party.
+
+ 1.1. "Contributor" means each entity that creates or contributes to
+ the creation of Modifications.
+
+ 1.2. "Contributor Version" means the combination of the Original
+ Code, prior Modifications used by a Contributor, and the Modifications
+ made by that particular Contributor.
+
+ 1.3. "Covered Code" means the Original Code or Modifications or the
+ combination of the Original Code and Modifications, in each case
+ including portions thereof.
+
+ 1.4. "Electronic Distribution Mechanism" means a mechanism generally
+ accepted in the software development community for the electronic
+ transfer of data.
+
+ 1.5. "Executable" means Covered Code in any form other than Source
+ Code.
+
+ 1.6. "Initial Developer" means the individual or entity identified
+ as the Initial Developer in the Source Code notice required by Exhibit
+ A.
+
+ 1.7. "Larger Work" means a work which combines Covered Code or
+ portions thereof with code not governed by the terms of this License.
+
+ 1.8. "License" means this document.
+
+ 1.8.1. "Licensable" means having the right to grant, to the maximum
+ extent possible, whether at the time of the initial grant or
+ subsequently acquired, any and all of the rights conveyed herein.
+
+ 1.9. "Modifications" means any addition to or deletion from the
+ substance or structure of either the Original Code or any previous
+ Modifications. When Covered Code is released as a series of files, a
+ Modification is:
+ A. Any addition to or deletion from the contents of a file
+ containing Original Code or previous Modifications.
+
+ B. Any new file that contains any part of the Original Code or
+ previous Modifications.
+
+ 1.10. "Original Code" means Source Code of computer software code
+ which is described in the Source Code notice required by Exhibit A as
+ Original Code, and which, at the time of its release under this
+ License is not already Covered Code governed by this License.
+
+ 1.10.1. "Patent Claims" means any patent claim(s), now owned or
+ hereafter acquired, including without limitation, method, process,
+ and apparatus claims, in any patent Licensable by grantor.
+
+ 1.11. "Source Code" means the preferred form of the Covered Code for
+ making modifications to it, including all modules it contains, plus
+ any associated interface definition files, scripts used to control
+ compilation and installation of an Executable, or source code
+ differential comparisons against either the Original Code or another
+ well known, available Covered Code of the Contributor's choice. The
+ Source Code can be in a compressed or archival form, provided the
+ appropriate decompression or de-archiving software is widely available
+ for no charge.
+
+ 1.12. "You" (or "Your") means an individual or a legal entity
+ exercising rights under, and complying with all of the terms of, this
+ License or a future version of this License issued under Section 6.1.
+ For legal entities, "You" includes any entity which controls, is
+ controlled by, or is under common control with You. For purposes of
+ this definition, "control" means (a) the power, direct or indirect,
+ to cause the direction or management of such entity, whether by
+ contract or otherwise, or (b) ownership of more than fifty percent
+ (50%) of the outstanding shares or beneficial ownership of such
+ entity.
+
+2. Source Code License.
+
+ 2.1. The Initial Developer Grant.
+ The Initial Developer hereby grants You a world-wide, royalty-free,
+ non-exclusive license, subject to third party intellectual property
+ claims:
+ (a) under intellectual property rights (other than patent or
+ trademark) Licensable by Initial Developer to use, reproduce,
+ modify, display, perform, sublicense and distribute the Original
+ Code (or portions thereof) with or without Modifications, and/or
+ as part of a Larger Work; and
+
+ (b) under Patents Claims infringed by the making, using or
+ selling of Original Code, to make, have made, use, practice,
+ sell, and offer for sale, and/or otherwise dispose of the
+ Original Code (or portions thereof).
+
+ (c) the licenses granted in this Section 2.1(a) and (b) are
+ effective on the date Initial Developer first distributes
+ Original Code under the terms of this License.
+
+ (d) Notwithstanding Section 2.1(b) above, no patent license is
+ granted: 1) for code that You delete from the Original Code; 2)
+ separate from the Original Code; or 3) for infringements caused
+ by: i) the modification of the Original Code or ii) the
+ combination of the Original Code with other software or devices.
+
+ 2.2. Contributor Grant.
+ Subject to third party intellectual property claims, each Contributor
+ hereby grants You a world-wide, royalty-free, non-exclusive license
+
+ (a) under intellectual property rights (other than patent or
+ trademark) Licensable by Contributor, to use, reproduce, modify,
+ display, perform, sublicense and distribute the Modifications
+ created by such Contributor (or portions thereof) either on an
+ unmodified basis, with other Modifications, as Covered Code
+ and/or as part of a Larger Work; and
+
+ (b) under Patent Claims infringed by the making, using, or
+ selling of Modifications made by that Contributor either alone
+ and/or in combination with its Contributor Version (or portions
+ of such combination), to make, use, sell, offer for sale, have
+ made, and/or otherwise dispose of: 1) Modifications made by that
+ Contributor (or portions thereof); and 2) the combination of
+ Modifications made by that Contributor with its Contributor
+ Version (or portions of such combination).
+
+ (c) the licenses granted in Sections 2.2(a) and 2.2(b) are
+ effective on the date Contributor first makes Commercial Use of
+ the Covered Code.
+
+ (d) Notwithstanding Section 2.2(b) above, no patent license is
+ granted: 1) for any code that Contributor has deleted from the
+ Contributor Version; 2) separate from the Contributor Version;
+ 3) for infringements caused by: i) third party modifications of
+ Contributor Version or ii) the combination of Modifications made
+ by that Contributor with other software (except as part of the
+ Contributor Version) or other devices; or 4) under Patent Claims
+ infringed by Covered Code in the absence of Modifications made by
+ that Contributor.
+
+3. Distribution Obligations.
+
+ 3.1. Application of License.
+ The Modifications which You create or to which You contribute are
+ governed by the terms of this License, including without limitation
+ Section 2.2. The Source Code version of Covered Code may be
+ distributed only under the terms of this License or a future version
+ of this License released under Section 6.1, and You must include a
+ copy of this License with every copy of the Source Code You
+ distribute. You may not offer or impose any terms on any Source Code
+ version that alters or restricts the applicable version of this
+ License or the recipients' rights hereunder. However, You may include
+ an additional document offering the additional rights described in
+ Section 3.5.
+
+ 3.2. Availability of Source Code.
+ Any Modification which You create or to which You contribute must be
+ made available in Source Code form under the terms of this License
+ either on the same media as an Executable version or via an accepted
+ Electronic Distribution Mechanism to anyone to whom you made an
+ Executable version available; and if made available via Electronic
+ Distribution Mechanism, must remain available for at least twelve (12)
+ months after the date it initially became available, or at least six
+ (6) months after a subsequent version of that particular Modification
+ has been made available to such recipients. You are responsible for
+ ensuring that the Source Code version remains available even if the
+ Electronic Distribution Mechanism is maintained by a third party.
+
+ 3.3. Description of Modifications.
+ You must cause all Covered Code to which You contribute to contain a
+ file documenting the changes You made to create that Covered Code and
+ the date of any change. You must include a prominent statement that
+ the Modification is derived, directly or indirectly, from Original
+ Code provided by the Initial Developer and including the name of the
+ Initial Developer in (a) the Source Code, and (b) in any notice in an
+ Executable version or related documentation in which You describe the
+ origin or ownership of the Covered Code.
+
+ 3.4. Intellectual Property Matters
+ (a) Third Party Claims.
+ If Contributor has knowledge that a license under a third party's
+ intellectual property rights is required to exercise the rights
+ granted by such Contributor under Sections 2.1 or 2.2,
+ Contributor must include a text file with the Source Code
+ distribution titled "LEGAL" which describes the claim and the
+ party making the claim in sufficient detail that a recipient will
+ know whom to contact. If Contributor obtains such knowledge after
+ the Modification is made available as described in Section 3.2,
+ Contributor shall promptly modify the LEGAL file in all copies
+ Contributor makes available thereafter and shall take other steps
+ (such as notifying appropriate mailing lists or newsgroups)
+ reasonably calculated to inform those who received the Covered
+ Code that new knowledge has been obtained.
+
+ (b) Contributor APIs.
+ If Contributor's Modifications include an application programming
+ interface and Contributor has knowledge of patent licenses which
+ are reasonably necessary to implement that API, Contributor must
+ also include this information in the LEGAL file.
+
+ (c) Representations.
+ Contributor represents that, except as disclosed pursuant to
+ Section 3.4(a) above, Contributor believes that Contributor's
+ Modifications are Contributor's original creation(s) and/or
+ Contributor has sufficient rights to grant the rights conveyed by
+ this License.
+
+ 3.5. Required Notices.
+ You must duplicate the notice in Exhibit A in each file of the Source
+ Code. If it is not possible to put such notice in a particular Source
+ Code file due to its structure, then You must include such notice in a
+ location (such as a relevant directory) where a user would be likely
+ to look for such a notice. If You created one or more Modification(s)
+ You may add your name as a Contributor to the notice described in
+ Exhibit A. You must also duplicate this License in any documentation
+ for the Source Code where You describe recipients' rights or ownership
+ rights relating to Covered Code. You may choose to offer, and to
+ charge a fee for, warranty, support, indemnity or liability
+ obligations to one or more recipients of Covered Code. However, You
+ may do so only on Your own behalf, and not on behalf of the Initial
+ Developer or any Contributor. You must make it absolutely clear than
+ any such warranty, support, indemnity or liability obligation is
+ offered by You alone, and You hereby agree to indemnify the Initial
+ Developer and every Contributor for any liability incurred by the
+ Initial Developer or such Contributor as a result of warranty,
+ support, indemnity or liability terms You offer.
+
+ 3.6. Distribution of Executable Versions.
+ You may distribute Covered Code in Executable form only if the
+ requirements of Section 3.1-3.5 have been met for that Covered Code,
+ and if You include a notice stating that the Source Code version of
+ the Covered Code is available under the terms of this License,
+ including a description of how and where You have fulfilled the
+ obligations of Section 3.2. The notice must be conspicuously included
+ in any notice in an Executable version, related documentation or
+ collateral in which You describe recipients' rights relating to the
+ Covered Code. You may distribute the Executable version of Covered
+ Code or ownership rights under a license of Your choice, which may
+ contain terms different from this License, provided that You are in
+ compliance with the terms of this License and that the license for the
+ Executable version does not attempt to limit or alter the recipient's
+ rights in the Source Code version from the rights set forth in this
+ License. If You distribute the Executable version under a different
+ license You must make it absolutely clear that any terms which differ
+ from this License are offered by You alone, not by the Initial
+ Developer or any Contributor. You hereby agree to indemnify the
+ Initial Developer and every Contributor for any liability incurred by
+ the Initial Developer or such Contributor as a result of any such
+ terms You offer.
+
+ 3.7. Larger Works.
+ You may create a Larger Work by combining Covered Code with other code
+ not governed by the terms of this License and distribute the Larger
+ Work as a single product. In such a case, You must make sure the
+ requirements of this License are fulfilled for the Covered Code.
+
+4. Inability to Comply Due to Statute or Regulation.
+
+ If it is impossible for You to comply with any of the terms of this
+ License with respect to some or all of the Covered Code due to
+ statute, judicial order, or regulation then You must: (a) comply with
+ the terms of this License to the maximum extent possible; and (b)
+ describe the limitations and the code they affect. Such description
+ must be included in the LEGAL file described in Section 3.4 and must
+ be included with all distributions of the Source Code. Except to the
+ extent prohibited by statute or regulation, such description must be
+ sufficiently detailed for a recipient of ordinary skill to be able to
+ understand it.
+
+5. Application of this License.
+
+ This License applies to code to which the Initial Developer has
+ attached the notice in Exhibit A and to related Covered Code.
+
+6. Versions of the License.
+
+ 6.1. New Versions.
+ Netscape Communications Corporation ("Netscape") may publish revised
+ and/or new versions of the License from time to time. Each version
+ will be given a distinguishing version number.
+
+ 6.2. Effect of New Versions.
+ Once Covered Code has been published under a particular version of the
+ License, You may always continue to use it under the terms of that
+ version. You may also choose to use such Covered Code under the terms
+ of any subsequent version of the License published by Netscape. No one
+ other than Netscape has the right to modify the terms applicable to
+ Covered Code created under this License.
+
+ 6.3. Derivative Works.
+ If You create or use a modified version of this License (which you may
+ only do in order to apply it to code which is not already Covered Code
+ governed by this License), You must (a) rename Your license so that
+ the phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape",
+ "MPL", "NPL" or any confusingly similar phrase do not appear in your
+ license (except to note that your license differs from this License)
+ and (b) otherwise make it clear that Your version of the license
+ contains terms which differ from the Mozilla Public License and
+ Netscape Public License. (Filling in the name of the Initial
+ Developer, Original Code or Contributor in the notice described in
+ Exhibit A shall not of themselves be deemed to be modifications of
+ this License.)
+
+7. DISCLAIMER OF WARRANTY.
+
+ COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF
+ DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING.
+ THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE
+ IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT,
+ YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE
+ COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER
+ OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF
+ ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
+
+8. TERMINATION.
+
+ 8.1. This License and the rights granted hereunder will terminate
+ automatically if You fail to comply with terms herein and fail to cure
+ such breach within 30 days of becoming aware of the breach. All
+ sublicenses to the Covered Code which are properly granted shall
+ survive any termination of this License. Provisions which, by their
+ nature, must remain in effect beyond the termination of this License
+ shall survive.
+
+ 8.2. If You initiate litigation by asserting a patent infringement
+ claim (excluding declatory judgment actions) against Initial Developer
+ or a Contributor (the Initial Developer or Contributor against whom
+ You file such action is referred to as "Participant") alleging that:
+
+ (a) such Participant's Contributor Version directly or indirectly
+ infringes any patent, then any and all rights granted by such
+ Participant to You under Sections 2.1 and/or 2.2 of this License
+ shall, upon 60 days notice from Participant terminate prospectively,
+ unless if within 60 days after receipt of notice You either: (i)
+ agree in writing to pay Participant a mutually agreeable reasonable
+ royalty for Your past and future use of Modifications made by such
+ Participant, or (ii) withdraw Your litigation claim with respect to
+ the Contributor Version against such Participant. If within 60 days
+ of notice, a reasonable royalty and payment arrangement are not
+ mutually agreed upon in writing by the parties or the litigation claim
+ is not withdrawn, the rights granted by Participant to You under
+ Sections 2.1 and/or 2.2 automatically terminate at the expiration of
+ the 60 day notice period specified above.
+
+ (b) any software, hardware, or device, other than such Participant's
+ Contributor Version, directly or indirectly infringes any patent, then
+ any rights granted to You by such Participant under Sections 2.1(b)
+ and 2.2(b) are revoked effective as of the date You first made, used,
+ sold, distributed, or had made, Modifications made by that
+ Participant.
+
+ 8.3. If You assert a patent infringement claim against Participant
+ alleging that such Participant's Contributor Version directly or
+ indirectly infringes any patent where such claim is resolved (such as
+ by license or settlement) prior to the initiation of patent
+ infringement litigation, then the reasonable value of the licenses
+ granted by such Participant under Sections 2.1 or 2.2 shall be taken
+ into account in determining the amount or value of any payment or
+ license.
+
+ 8.4. In the event of termination under Sections 8.1 or 8.2 above,
+ all end user license agreements (excluding distributors and resellers)
+ which have been validly granted by You or any distributor hereunder
+ prior to termination shall survive termination.
+
+9. LIMITATION OF LIABILITY.
+
+ UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT
+ (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL
+ DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE,
+ OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR
+ ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY
+ CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL,
+ WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER
+ COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN
+ INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF
+ LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY
+ RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW
+ PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE
+ EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO
+ THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU.
+
+10. U.S. GOVERNMENT END USERS.
+
+ The Covered Code is a "commercial item," as that term is defined in
+ 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer
+ software" and "commercial computer software documentation," as such
+ terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48
+ C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995),
+ all U.S. Government End Users acquire Covered Code with only those
+ rights set forth herein.
+
+11. MISCELLANEOUS.
+
+ This License represents the complete agreement concerning subject
+ matter hereof. If any provision of this License is held to be
+ unenforceable, such provision shall be reformed only to the extent
+ necessary to make it enforceable. This License shall be governed by
+ California law provisions (except to the extent applicable law, if
+ any, provides otherwise), excluding its conflict-of-law provisions.
+ With respect to disputes in which at least one party is a citizen of,
+ or an entity chartered or registered to do business in the United
+ States of America, any litigation relating to this License shall be
+ subject to the jurisdiction of the Federal Courts of the Northern
+ District of California, with venue lying in Santa Clara County,
+ California, with the losing party responsible for costs, including
+ without limitation, court costs and reasonable attorneys' fees and
+ expenses. The application of the United Nations Convention on
+ Contracts for the International Sale of Goods is expressly excluded.
+ Any law or regulation which provides that the language of a contract
+ shall be construed against the drafter shall not apply to this
+ License.
+
+12. RESPONSIBILITY FOR CLAIMS.
+
+ As between Initial Developer and the Contributors, each party is
+ responsible for claims and damages arising, directly or indirectly,
+ out of its utilization of rights under this License and You agree to
+ work with Initial Developer and Contributors to distribute such
+ responsibility on an equitable basis. Nothing herein is intended or
+ shall be deemed to constitute any admission of liability.
+
+13. MULTIPLE-LICENSED CODE.
+
+ Initial Developer may designate portions of the Covered Code as
+ "Multiple-Licensed". "Multiple-Licensed" means that the Initial
+ Developer permits you to utilize portions of the Covered Code under
+ Your choice of the NPL or the alternative licenses, if any, specified
+ by the Initial Developer in the file described in Exhibit A.
+
+EXHIBIT A -Mozilla Public License.
+
+ ``The contents of this file are subject to the Mozilla Public License
+ Version 1.1 (the "License"); you may not use this file except in
+ compliance with the License. You may obtain a copy of the License at
+ http://www.mozilla.org/MPL/
+
+ Software distributed under the License is distributed on an "AS IS"
+ basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ License for the specific language governing rights and limitations
+ under the License.
+
+ The Original Code is ______________________________________.
+
+ The Initial Developer of the Original Code is ________________________.
+ Portions created by ______________________ are Copyright (C) ______
+ _______________________. All Rights Reserved.
+
+ Contributor(s): ______________________________________.
+
+ Alternatively, the contents of this file may be used under the terms
+ of the _____ license (the "[___] License"), in which case the
+ provisions of [______] License are applicable instead of those
+ above. If you wish to allow use of your version of this file only
+ under the terms of the [____] License and not to allow others to use
+ your version of this file under the MPL, indicate your decision by
+ deleting the provisions above and replace them with the notice and
+ other provisions required by the [___] License. If you do not delete
+ the provisions above, a recipient may use your version of this file
+ under either the MPL or the [___] License."
+
+ [NOTE: The text of this Exhibit A may differ slightly from the text of
+ the notices in the Source Code files of the Original Code. You should
+ use the text of this Exhibit A rather than the text found in the
+ Original Code Source Code for Your Modifications.]
+
+END
BIN lib/JSBuilder/jsdb/linux/jsdb
Binary file not shown.
BIN lib/JSBuilder/jsdb/mac/jsdb
Binary file not shown.
60 lib/JSBuilder/src/Build.js
@@ -0,0 +1,60 @@
+Loader.require('Parser');
+
+Build = Ext.extend(Target, {
+ getDefaultTarget : function() {
+ return (this.get('id') || this.get('name').replace(/ /g, '').toLowerCase()) + '.js';
+ },
+
+ onCreate : function(file) {
+ var project = this.project,
+ verbose = project.builder.get('verbose'),
+ packages = this.get('packages') || [];
+
+ if (verbose && packages.length) {
+ Logger.log(' - ' + packages.length + ' package(s) included in this target.');
+ }
+
+ // Loop over all file includes, read the contents, and write
+ // it to our target file
+ packages.forEach(function(id) {
+ var pkg = this.project.getPackageById(id),
+ content;
+
+ if (!pkg) {
+ return true;
+ }
+
+ if (verbose) {
+ Logger.log(' + ' + pkg.get('target'));
+ }
+
+ pkg = new Stream(pkg.get('targetPath'));
+ content = pkg.readFile();
+ pkg.close();
+
+ file.writeln(content);
+ return true;
+ }, this);
+ },
+
+ afterCreate : function() {
+ var params = Ext.apply(this.get('options') || {}, {debug: this.get('debug')});
+
+ Logger.log(' * Parse ' + this.get('target') + ' with options:');
+
+ Ext.iterate(params, function(n, v) {
+ Logger.log(' - ' + n + ": " + v);
+ });
+
+ Parser.setParams(params);
+
+ var filePath = this.get('targetPath');
+ var parsedContent = Parser.parse(filePath);
+
+ var file = new Stream(filePath, 'w');
+ file.writeln(parsedContent);
+ file.close();
+
+ Build.superclass.afterCreate.apply(this);
+ }
+});
140 lib/JSBuilder/src/Cli.js
@@ -0,0 +1,140 @@
+Cli = Ext.extend(Object, {
+ map: {
+ h: {
+ name: 'help',
+ desc: 'Prints this help display'
+ }
+ },
+
+ // Override this on a subclass of Cli.
+ // An array with a description on how to use this Cli.
+ // Each entry in the array is printed on a new line.
+ usage: [],
+
+ constructor : function() {
+ if (this.map !== this.superproto.map) {
+ this.map = Ext.apply({}, this.map, this.superproto.map);
+ }
+
+ this.initArguments();
+
+ try {
+ this.run();
+ }
+ catch (e) {
+ Logger.log(e);
+ if (e.stack) {
+ Logger.log('\n' + 'Stack trace:\n' + e.stack);
+ }
+ }
+ },
+
+ initArguments : function() {
+ var args = system.arguments,
+ ln = args.length,
+ parsedArgs = this.args = {},
+ curArg = null,
+ i, arg;
+
+ for (i = 0; i < ln; i++) {
+ arg = args[i];
+ if (arg[0] == '-') {
+ if (arg[1] == '-') {
+ curArg = arg.substr(2);
+ }
+ else if (arg.length == 2) {
+ curArg = this.map[arg[1]] ? this.map[arg[1]].name : arg[1];
+ }
+ else {
+ continue;
+ }
+
+ if (args[i + 1] && args[i + 1][0] != '-') {
+ parsedArgs[curArg] = args[i + 1] || true;
+ i++;
+ }
+ else {
+ parsedArgs[curArg] = true;
+ }
+ }
+ }
+ },
+
+ printUsage : function(message) {
+ var map = this.map,
+ usage = [''],
+ i, mapping;
+
+ if (!message) {
+ usage.push(this.name + ' version ' + this.version);
+ usage.push('Powered by Sencha Inc');
+ usage.push('');
+ usage.push('Available arguments:');
+ for (i in map) {
+ mapping = map[i];
+ usage.push(
+ ' --' + mapping.name + ' -' + i
+ );
+ usage.push(' ' + (mapping.required ? '(required)' : '(optional)') + ' ' + (mapping.desc || ''));
+ usage.push('');
+ }
+ }
+ else {
+ usage.push(message);
+ }
+
+ usage.push('');
+ usage = usage.concat(this.usage);
+ usage.push('');
+
+ for (i = 0; i < usage.length; i++) {
+ Logger.log(usage[i]);
+ }
+ },
+
+ checkRequired : function() {
+ var args = this.args,
+ i, req;
+
+ for (i in this.map) {
+ if (this.map[i].required && args[this.map[i].name] === undefined) {
+ return i;
+ }
+ }
+
+ return true;
+ },
+
+ run : function() {
+ if (this.get('help')) {
+ this.printUsage();
+ return false;
+ }
+
+ var required = this.checkRequired();
+ if (required !== true) {
+ this.error('The --' + this.map[required].name + ' or -' + required + ' argument is required');
+ this.printUsage();
+ return false;
+ }
+ },
+
+ get : function(key) {
+ return this.args[key] || false;
+ },
+
+ set : function(key, value, ifNotExists) {
+ if (ifNotExists && this.get(key) !== false) {
+ return;
+ }
+ this.args[key] = value;
+ },
+
+ log : function(variable) {
+ Logger.log(variable);
+ },
+
+ error : function(error) {
+ throw error;
+ }
+});
11 lib/JSBuilder/src/Cmd.js
@@ -0,0 +1,11 @@
+Cmd = {
+ execute: function(cmd) {
+ if (Platform.isWindows) {
+ var stream = new Stream('exec://' + cmd);
+ stream.close();
+ }
+ else {
+ system.execute(cmd);
+ }
+ }
+};
267 lib/JSBuilder/src/Ext.js
@@ -0,0 +1,267 @@
+Ext = {
+ /**
+ * Copies all the properties of config to obj.
+ * @param {Object} object The receiver of the properties
+ * @param {Object} config The source of the properties
+ * @param {Object} defaults A different object that will also be applied for default values
+ * @return {Object} returns obj
+ * @member Ext apply
+ */
+ apply : function(object, config, defaults) {
+ // no "this" reference for friendly out of scope calls
+ if (defaults) {
+ Ext.apply(object, defaults);
+ }
+ if (object && config && typeof config == 'object') {
+ for (var key in config) {
+ object[key] = config[key];
+ }
+ }
+ return object;
+ },
+
+ /**
+ * Copies all the properties of config to obj if they don't already exist.
+ * @param {Object} obj The receiver of the properties
+ * @param {Object} config The source of the properties
+ * @return {Object} returns obj
+ */
+ applyIf : function(object, config) {
+ var property, undefined;
+ if (object) {
+ for (property in config) {
+ if (object[property] === undefined) {
+ object[property] = config[property];
+ }
+ }
+ }
+ return object;
+ },
+
+ /**
+ * <p>Extends one class to create a subclass and optionally overrides members with the passed literal. This method
+ * also adds the function "override()" to the subclass that can be used to override members of the class.</p>
+ * @param {Function} superclass The constructor of class being extended.
+ * @param {Object} overrides <p>A literal with members which are copied into the subclass's
+ * prototype, and are therefore shared between all instances of the new class.</p>
+ * <p>This may contain a special member named <tt><b>constructor</b></tt>. This is used
+ * to define the constructor of the new class, and is returned. If this property is
+ * <i>not</i> specified, a constructor is generated and returned which just calls the
+ * superclass's constructor passing on its parameters.</p>
+ * <p><b>It is essential that you call the superclass constructor in any provided constructor. See example code.</b></p>
+ * @return {Function} The subclass constructor from the <code>overrides</code> parameter, or a generated one if not provided.
+ */
+ extend : function() {
+ // inline overrides
+ var inlineOverrides = function(o){
+ for(var m in o){
+ this[m] = o[m];
+ }
+ };
+
+ var objectConstructor = Object.prototype.constructor;
+
+ return function(subclass, superclass, overrides){
+ // First we check if the user passed in just the superClass with overrides
+ if(Ext.isObject(superclass)){
+ overrides = superclass;
+ superclass = subclass;
+ subclass = overrides.constructor != objectConstructor
+ ? overrides.constructor
+ : function(){
+ superclass.apply(this, arguments);
+ };
+ }
+
+ // We create a new temporary class
+ var F = function(){},
+ subclassProto,
+ superclassProto = superclass.prototype;
+
+ F.prototype = superclassProto;
+ subclassProto = subclass.prototype = new F();
+ subclassProto.constructor = subclass;
+ subclass.superclass = superclassProto;
+
+ if(superclassProto.constructor == objectConstructor){
+ superclassProto.constructor = superclass;
+ }
+
+ subclass.override = function(overrides){
+ Ext.override(subclass, overrides);
+ };
+
+ subclassProto.superclass = subclassProto.supr = (function(){
+ return superclassProto;
+ });
+
+ subclassProto.override = inlineOverrides;
+ subclassProto.proto = subclassProto;
+ subclassProto.superproto = superclassProto;
+
+ subclass.override(overrides);
+ subclass.extend = function(o){
+ return Ext.extend(subclass, o);
+ };
+
+ return subclass;
+ };
+ }(),
+
+ /**
+ * Adds a list of functions to the prototype of an existing class, overwriting any existing methods with the same name.
+ * @param {Object} origclass The class to override
+ * @param {Object} overrides The list of functions to add to origClass. This should be specified as an object literal
+ * containing one or more methods.
+ * @method override
+ */
+ override : function(origclass, overrides) {
+ if (overrides) {
+ Ext.apply(origclass.prototype, overrides);
+ }
+ },
+
+ /**
+ * <p>Returns true if the passed value is empty.</p>
+ * <p>The value is deemed to be empty if it is<div class="mdetail-params"><ul>
+ * <li>null</li>
+ * <li>undefined</li>
+ * <li>an empty array</li>
+ * <li>a zero length string (Unless the <tt>allowBlank</tt> parameter is <tt>true</tt>)</li>
+ * </ul></div>
+ * @param {Mixed} value The value to test
+ * @param {Boolean} allowBlank (optional) true to allow empty strings (defaults to false)
+ * @return {Boolean}
+ */
+ isEmpty : function(v, allowBlank) {
+ return v == null || ((Ext.isArray(v) && !v.length)) || (!allowBlank ? v === '' : false);
+ },
+
+ /**
+ * Returns true if the passed value is a JavaScript array, otherwise false.
+ * @param {Mixed} value The value to test
+ * @return {Boolean}
+ */
+ isArray : function(v) {
+ return Object.prototype.toString.apply(v) === '[object Array]';
+ },
+
+ /**
+ * Returns true if the passed object is a JavaScript date object, otherwise false.
+ * @param {Object} object The object to test
+ * @return {Boolean}
+ */
+ isDate : function(v) {
+ return Object.prototype.toString.apply(v) === '[object Date]';
+ },
+
+ /**
+ * Returns true if the passed value is a JavaScript Object, otherwise false.
+ * @param {Mixed} value The value to test
+ * @return {Boolean}
+ */
+ isObject : function(v) {
+ return !!v && Object.prototype.toString.call(v) === '[object Object]';
+ },
+
+ /**
+ * Returns true if the passed value is a JavaScript 'primitive', a string, number or boolean.
+ * @param {Mixed} value The value to test
+ * @return {Boolean}
+ */
+ isPrimitive : function(v) {
+ return Ext.isString(v) || Ext.isNumber(v) || Ext.isBoolean(v);
+ },
+
+ /**
+ * Returns true if the passed value is a JavaScript Function, otherwise false.
+ * @param {Mixed} value The value to test
+ * @return {Boolean}
+ */
+ isFunction : function(v) {
+ return Object.prototype.toString.apply(v) === '[object Function]';
+ },
+
+ /**
+ * Returns true if the passed value is a number. Returns false for non-finite numbers.
+ * @param {Mixed} value The value to test
+ * @return {Boolean}
+ */
+ isNumber : function(v) {
+ return Object.prototype.toString.apply(v) === '[object Number]' && isFinite(v);
+ },
+
+ /**
+ * Returns true if the passed value is a string.
+ * @param {Mixed} value The value to test
+ * @return {Boolean}
+ */
+ isString : function(v) {
+ return Object.prototype.toString.apply(v) === '[object String]';
+ },
+
+ /**util
+ * Returns true if the passed value is a boolean.
+ * @param {Mixed} value The value to test
+ * @return {Boolean}
+ */
+ isBoolean : function(v) {
+ return Object.prototype.toString.apply(v) === '[object Boolean]';
+ },
+
+ /**
+ * Returns true if the passed value is not undefined.
+ * @param {Mixed} value The value to test
+ * @return {Boolean}
+ */
+ isDefined : function(v){
+ return typeof v !== 'undefined';
+ },
+
+ each : function(array, fn, scope) {
+ if (Ext.isEmpty(array, true)) {
+ return 0;
+ }
+ if (!Ext.isIterable(array) || Ext.isPrimitive(array)) {
+ array = [array];
+ }
+ for (var i = 0, len = array.length; i < len; i++) {
+ if (fn.call(scope || array[i], array[i], i, array) === false) {
+ return i;
+ }
+ }
+ return true;
+ },
+
+ iterate : function(obj, fn, scope) {
+ if (Ext.isEmpty(obj)) {
+ return;
+ }
+ if (Ext.isIterable(obj)) {
+ Ext.each(obj, fn, scope);
+ return;
+ }
+ else if (Ext.isObject(obj)) {
+ for (var prop in obj) {
+ if (obj.hasOwnProperty(prop)) {
+ if (fn.call(scope || obj, prop, obj[prop], obj) === false) {
+ return;
+ }
+ }
+ }
+ }
+ },
+
+ isIterable : function(v) {
+ //check for array or arguments
+ if (Ext.isArray(v) || v.callee) {
+ return true;
+ }
+ },
+
+ $included: {},
+
+ require: function(className) {
+
+ }
+}
90 lib/JSBuilder/src/Filesystem.js
@@ -0,0 +1,90 @@
+Filesystem = {
+ exists : function(path) {
+ return system.exists(path);
+ },
+
+ getFullPath: function(path) {
+ var currentPath = system.setcwd(path);
+ return system.setcwd(currentPath);
+ },
+
+ getPath: function(path){
+ return path.replace(/\//g, Fs.sep);
+ },
+
+ mkdir: function(path) {
+ if (Platform.isWindows) {
+ system.mkdir(path);
+ }
+ else {
+ Cmd.execute('mkdir -p ' + path);
+ }
+ return this.getFullPath(path);
+ },
+
+ readFile : function(file) {
+ if (!Fs.exists(file)) {
+ return '';
+ }
+
+ file = new Stream(file);
+ var contents = file.readFile();
+ file.close();
+
+ return contents;
+ },
+
+ copy: function(src, dest) {
+ src = Fs.getPath(src);
+ dest = Fs.getPath(dest);
+
+ if (Platform.isWindows) {
+ if (Fs.endsWith(src, Fs.sep)) {
+ // remove the trailing \
+ src = src.substr(0, src.length - 1);
+
+ var folders = src.split(Fs.sep),
+ folder = folders[folders.length - 1];
+
+ // Ensure we have a trailing \ on the directory
+ dest += (Fs.endsWith(dest, Fs.sep) ? '' : Fs.sep) + folder + Fs.sep;
+ }
+ Cmd.execute('xcopy ' + src + ' ' + dest + ' /E /Y /I');
+ }
+ else {
+ try {
+ // q: quiet
+ // r: recursive
+ // u: only update if newer
+ // p: keep permissions
+ // L: copy the contents of symlinks
+ Cmd.execute('rsync -qrupL ' + src + ' ' + dest);
+ }
+ catch(e) {
+ Cmd.execute('cp -Rpf ' + src + ' ' + dest);
+ }
+ }
+ },
+
+ endsWith: function(str, last){
+ return str.lastIndexOf(last) == str.length - 1;
+ },
+
+ split: function(file) {
+ var split = [];
+ if (!Fs.exists(file)) {
+ return split;
+ }
+ file = new Stream(file);
+ while (!file.eof) {
+ split.push(file.readln().trim());
+ }
+ return split;
+ }
+};
+
+// Create short alias
+Fs = Filesystem;
+
+Fs.sep = (Fs.getFullPath('.')[0] == '/') ? '/': '\\';
+Fs.fileWorkingDir = Fs.getFullPath('.');
203 lib/JSBuilder/src/Generator.js
@@ -0,0 +1,203 @@
+load(JSBuilderPath + 'src/Template.js');
+load(JSBuilderPath + 'src/XTemplate.js');
+
+Ext.generator = {};
+
+/**
+ * @class Ext.generator.Base
+ * @extends Object
+ * Base class for all Generators
+ */
+Ext.generator.Base = Ext.extend(Object, {
+ /**
+ * @cfg {Boolean} pretend True to only output what the generator would do (e.g. which files would be created),
+ * without actually modifying anything on the filesystem.
+ */
+ pretend: false,
+
+ basePath: '.',
+
+ constructor: function(config) {
+ Ext.apply(this, config);
+
+ if (this.args) {
+ this.decodeArgs(this.args);
+ }
+ },
+
+ /**
+ * Creates an empty directory at the given location
+ * @param {String} path The directory path
+ */
+ mkdir: function() {
+ var length = arguments.length,
+ dirName, i;
+
+ for (i = 0; i < length; i++) {
+ dirName = this.basePath + "/" + arguments[i];
+ Logger.log(" Creating dir: " + dirName);
+
+ if (!this.pretend) {
+ Filesystem.mkdir(dirName);
+ }
+ }
+ },
+
+ /**
+ * Applies data to an XTemplate, saving its output to the given file name
+ * @param {String} name The name of the template
+ */
+ template: function(name, data, filename) {
+ Logger.log(" Creating file: " + filename);
+
+ // dirty hack to let <tpl> get through without being picked up
+ Ext.apply(data, {
+ tpl: 'tpl'
+ });
+
+ var name = 'src/generators/' + this.dirName + '/templates/' + name + '.js',
+ stream = new Stream(name, 'rw'),
+ template = new Ext.XTemplate(stream.readText()),
+ contents = template.apply(data),
+ destination = this.basePath + '/' + filename,
+ newFile = new Stream(destination, "w");
+
+ newFile.writeLine(contents);
+ system.move(destination, filename, true);
+ newFile.close();
+ },
+
+ /**
+ * Copies a file from the generator's files directory into the app
+ * @param {String} fileName The name of the file to copy
+ * @param {String} destination The destination path (defaults to the fileName)
+ * @param {Boolean} silent True to not log any messages (defaults to false)
+ */
+ file: function(fileName, destination, silent) {
+ Logger.log(" Copying " + fileName);
+
+ destination = this.basePath + '/' + (destination || fileName);
+ fileName = 'src/generators/' + this.dirName + '/files/' + fileName;
+
+ if (!this.pretend && this.silent !== true) {
+ Filesystem.copy(fileName, destination);
+ }
+ },
+
+ /**
+ * Copies all contents of the given source directory to a destination
+ * @param {String} dirName The name of the directory to copy
+ * @param {String} destination The destination for the source files
+ */
+ copyDir: function(dirName, destination) {
+ destination = this.basePath + '/' + (destination || dirName);
+
+ if (!this.pretend) {
+ Filesystem.copy(dirName, destination);
+ }
+ },
+
+ /**
+ * Inserts a script tag to load the given src file inside the given div id
+ * @param {String} path The path to the script to be included
+ * @param {String} id The id of the div to include after
+ * @param {String} htmlFile Optional html file to update (defaults to index.html)
+ */
+ insertInclude: function(path, id, htmlFile) {
+ htmlFile = htmlFile || 'index.html';
+
+ var stream = new Stream(htmlFile, 'rw'),
+ regex = new RegExp('<div id="' + id + '">'),
+ lines = [],
+ line;
+
+ while (line = stream.readLine()) {
+ lines.push(line);
+
+ if (regex.test(line)) {
+ lines.push(' <script type="text/javascript" src="' + path + '"></script>');
+ }
+ }
+
+ var destination = htmlFile + "-modified",
+ newFile = new Stream(destination, "w");
+
+ newFile.writeLine(lines.join("\n"));
+ system.move(destination, htmlFile, true);
+ newFile.close();
+ },
+
+ /**
+ * Convenience function for displaying a clear message to the user
+ * @param {String} message The message to display
+ */
+ headline: function(message) {
+ Logger.log("");
+ Logger.log("*********************************************");
+ Logger.log(message);
+ Logger.log("*********************************************");
+ Logger.log("");
+ },
+
+ generate: function() {
+
+ }
+});
+
+/**
+ * @class GeneratorHelper
+ * @extends Cli
+ * Generates files and folders based on a template
+ */
+Ext.generator.Factory = Ext.extend(Object, {
+ name: "Generator",
+ version: "0.0.1",
+
+ constructor: function(config) {
+ Ext.apply(this, config);
+
+ Cli.call(this);
+ },
+
+ initArguments: function() {},
+
+ usage: [
+ 'Example usage:',
+ 'Arguments in square brackets are optional',
+ '',
+ 'Generating an application:',
+ ' ./generate app AppName [../path/to/app]',
+ '',
+ 'Generating a model:',
+ ' ./generate model User id:int name:string active:boolean',
+ '',
+ 'Generating a controller:',
+ ' ./generate controller users create update destroy',
+ ''
+ ],
+
+ run: function() {
+ var args = this.args || system.arguments,
+ Gen = Ext.generator.Factory.types[args[0]];
+
+ if (Gen) {
+ new Gen({args: args.slice(1)}).generate();
+ } else {
+ this.printUsage();
+ }
+ }
+});
+
+Ext.generator.Factory.types = {};
+Ext.regGenerator = function(name, constructor) {
+ Ext.generator.Factory.types[name] = constructor;
+
+ constructor.prototype.dirName = name;
+ constructor.templates = {};
+};
+
+Ext.regDispatchable('generate', Ext.generator.Factory);
+
+// generate app FB examples/facebook
+// generate model User id:int name:string email:string
+// generate controller users index build show new
77 lib/JSBuilder/src/JSBuilder.js
@@ -0,0 +1,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();
+ }
+ }
+});
74 lib/JSBuilder/src/Loader.js
@@ -0,0 +1,74 @@
+(function(ROOT) {
+
+var Loader = ROOT.Loader = {
+ paths: {
+ _base: "."
+ },
+
+ existing: {},
+
+ exists: function(name) {
+ var root = ROOT;
+ var chunks = name.split('.');
+
+ for (var i = 0; i < chunks.length; i++) {
+ if (!root.hasOwnProperty(chunks[i]))
+ return false;
+
+ root = root[chunks[i]];
+ }
+
+ return true;
+ },
+
+ setBasePath: function(name, path) {
+ if (!path) {
+ path = name;
+ name = "_base";
+ }
+
+ Loader.paths[name] = path;
+ },
+
+ getBasePath: function(name) {
+ // Start with the base path
+ var path = Loader.paths._base;
+
+ // Iterate through each specified name path ("Ext.layout.Layout" => "js/Ext/layout/Layout.js")
+ for (var stub in Loader.paths) {
+ if (stub === name.substring(0, stub.length)) {
+ path += "/" + Loader.paths[stub];
+ // Remove stub from name, as we've already pathed it
+ name = name.substring(stub.length + 1);
+ break;
+ }
+ }
+
+ return path + "/" + name.replace(/\./g, "/");
+ },
+
+ require: function(names, compulsory) {
+ if (compulsory == undefined)
+ compulsory = true;
+
+ if (typeof names == 'string')
+ names = [names];
+
+ names.forEach(function(name) {
+ if (!this.existing.hasOwnProperty(name)) {
+// writeln(this.getBasePath(name) + '.js');
+ load(this.getBasePath(name) + '.js');
+
+ var loaded = this.exists(name);
+ this.existing[name] = loaded;
+ }
+
+ if (this.existing[name] == false && compulsory) {
+ throw new Error("[Loader] Failed loading '" + name + "'");
+ }
+ }, Loader);
+ }
+};
+
+})(this);
+
8 lib/JSBuilder/src/Logger.js
@@ -0,0 +1,8 @@
+Logger = {
+ /**
+ * Logs the variable to the command line
+ */
+ log: function(variable) {
+ writeln(variable);
+ }
+};
5 lib/JSBuilder/src/Package.js
@@ -0,0 +1,5 @@
+Package = Ext.extend(Target, {
+ getDefaultTarget : function() {
+ return 'pkgs' + Fs.sep + (this.get('id') || this.get('name').replace(/ /g, '').toLowerCase()) + '.js';
+ }
+});
151 lib/JSBuilder/src/Parser.js
@@ -0,0 +1,151 @@
+// Singleton
+Parser = new (Ext.extend(Object, {
+ START: '//<',
+ END: '>',
+
+ params: {},
+
+ parse: function(filename) {
+ var stream = new Stream(filename);
+
+ Loader.require('Parser.Statement');
+ var ret = (new Parser.Statement()).parse(stream);
+ stream.close();
+
+ return ret;
+ },
+
+ evaluate: function(name, value) {
+ var modifier = null;
+ var param = (this.params.hasOwnProperty(name)) ? this.params[name] : false;
+ var match;