incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmue...@apache.org
Subject weinre commit: bullet-proof'd modjewel
Date Fri, 02 Mar 2012 15:29:59 GMT
Updated Branches:
  refs/heads/master 3a34438ad -> d0a4694a1


bullet-proof'd modjewel

bug: https://issues.apache.org/jira/browse/CB-293

`require()` and `define()` are no longer globally defined
in modjewel, only the object `modjewel` is globally defined.

Changed references of `define()` to `modjewel.define()`, and
change the initial launching `require()`s in the client and target
to `modjewel.require()`.  There were also a couple of 'scripts'
which needed changes to the `modjewel` specific version of `require()`.

Drive-by fix to upgrade modjewel version to 2.0, and found an
old 512x512 weinre icon (from the old mac app's .icns file) to
add in case we need bigger than 128x128


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/commit/d0a4694a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/tree/d0a4694a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/diff/d0a4694a

Branch: refs/heads/master
Commit: d0a4694a19690ae2c3ce9f0e83c926ed9acd97e3
Parents: 3a34438
Author: Patrick Mueller <pmuellr@apache.org>
Authored: Fri Mar 2 10:25:02 2012 -0500
Committer: Patrick Mueller <pmuellr@apache.org>
Committed: Fri Mar 2 10:25:02 2012 -0500

----------------------------------------------------------------------
 weinre.build/LICENSE-header.js                 |   18 ++++++++++
 weinre.build/scripts/build-client-html.py      |    4 +-
 weinre.build/scripts/build-target-scripts.py   |   12 +++++--
 weinre.build/scripts/collect-all-json-idl.py   |    2 +-
 weinre.build/scripts/module2amd.py             |    2 +-
 weinre.doc/images/weinre-icon-512x512.png      |  Bin 0 -> 22326 bytes
 weinre.web/client/ExtensionRegistryStub.js     |    2 +-
 weinre.web/client/InspectorBackendStub.js      |    2 +-
 weinre.web/client/InspectorFrontendHostStub.js |    2 +-
 weinre.web/modjewel.js                         |   35 ++++++-------------
 10 files changed, 45 insertions(+), 34 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/blob/d0a4694a/weinre.build/LICENSE-header.js
----------------------------------------------------------------------
diff --git a/weinre.build/LICENSE-header.js b/weinre.build/LICENSE-header.js
new file mode 100644
index 0000000..e3f5ab3
--- /dev/null
+++ b/weinre.build/LICENSE-header.js
@@ -0,0 +1,18 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/blob/d0a4694a/weinre.build/scripts/build-client-html.py
----------------------------------------------------------------------
diff --git a/weinre.build/scripts/build-client-html.py b/weinre.build/scripts/build-client-html.py
index 9cb3186..7e1660c 100644
--- a/weinre.build/scripts/build-client-html.py
+++ b/weinre.build/scripts/build-client-html.py
@@ -65,7 +65,7 @@ def createIndexFile(iFileName, oFileName, moduleDir):
                 '<script type="text/javascript" src="weinre/check-for-webkit.js"></script>\n',
                 '<script type="text/javascript" src="weinre/hacks.js"></script>\n',
                 '<script type="text/javascript" src="../modjewel.js"></script>\n',
-                '<script type="text/javascript">require("modjewel").warnOnRecursiveRequire(true)</script>\n',
+                '<script type="text/javascript">modjewel.require("modjewel").warnOnRecursiveRequire(true)</script>\n',
             ])
 
             for module in getModules(moduleDir):
@@ -78,7 +78,7 @@ def createIndexFile(iFileName, oFileName, moduleDir):
             newLines.append("<!-- ========== weinre additions: starting ========== -->\n")
             newLines.append('<link rel="stylesheet" type="text/css" href="weinre/client.css">\n')
             newLines.append('<script type="text/javascript" src="../interfaces/all-json-idls-min.js"></script>\n')
-            newLines.append('<script type="text/javascript">require("weinre/client/Client").main()</script>\n')
+            newLines.append('<script type="text/javascript">modjewel.require("weinre/client/Client").main()</script>\n')
             newLines.append("<!-- ========== weinre additions: done ========== -->\n")
             newLines.append(line)
 

http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/blob/d0a4694a/weinre.build/scripts/build-target-scripts.py
----------------------------------------------------------------------
diff --git a/weinre.build/scripts/build-target-scripts.py b/weinre.build/scripts/build-target-scripts.py
index 71792b0..ec80bce 100644
--- a/weinre.build/scripts/build-target-scripts.py
+++ b/weinre.build/scripts/build-target-scripts.py
@@ -86,6 +86,12 @@ def main():
 #--------------------------------------------------------------------
 def writeMergedFile(oFileName, scripts, scriptNames, srcs, useEval):
     lines = []
+    
+    licenseFile = os.path.join(os.path.dirname(__file__), "..", "LICENSE-header.js")
+    
+    with open(licenseFile, "r") as iFile:
+        lines.append(iFile.read())
+            
     lines.append(";(function(){")
 
     for script in scripts:
@@ -101,12 +107,12 @@ def writeMergedFile(oFileName, scripts, scriptNames, srcs, useEval):
             lines.append(";eval(%s)" % json.dumps(src))
 
         if srcName == "modjewel.js":
-            lines.append("require('modjewel').warnOnRecursiveRequire(true);")
+            lines.append("modjewel.require('modjewel').warnOnRecursiveRequire(true);")
             if not useEval:
                 lines.append("")
 
-    lines.append("// require('weinre/common/Weinre').showNotImplemented();")
-    lines.append("require('weinre/target/Target').main()")
+    lines.append("// modjewel.require('weinre/common/Weinre').showNotImplemented();")
+    lines.append("modjewel.require('weinre/target/Target').main()")
     lines.append("})();")
     targetScript = "\n".join(lines)
 

http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/blob/d0a4694a/weinre.build/scripts/collect-all-json-idl.py
----------------------------------------------------------------------
diff --git a/weinre.build/scripts/collect-all-json-idl.py b/weinre.build/scripts/collect-all-json-idl.py
index 9448915..9d4099f 100644
--- a/weinre.build/scripts/collect-all-json-idl.py
+++ b/weinre.build/scripts/collect-all-json-idl.py
@@ -64,7 +64,7 @@ def main():
     else:
         jsonString = json.dumps(result, indent=4)
 
-    jsString = "require('weinre/common/Weinre').addIDLs(%s)" % jsonString
+    jsString = "modjewel.require('weinre/common/Weinre').addIDLs(%s)" % jsonString
 
     oFile = open(oFileName, "w")
     oFile.write(jsString)

http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/blob/d0a4694a/weinre.build/scripts/module2amd.py
----------------------------------------------------------------------
diff --git a/weinre.build/scripts/module2amd.py b/weinre.build/scripts/module2amd.py
index c7e7cd3..d09148f 100644
--- a/weinre.build/scripts/module2amd.py
+++ b/weinre.build/scripts/module2amd.py
@@ -157,7 +157,7 @@ def processDir(dir, path=None, modules=None):
 
         modules.append(moduleName)
 
-        header  = ';define("%s", function(require, exports, module) {' % moduleName
+        header  = ';modjewel.define("%s", function(require, exports, module) {' % moduleName
         trailer = '});'
 
         newContents = "%s %s\n%s\n" % (header, contents, trailer)

http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/blob/d0a4694a/weinre.doc/images/weinre-icon-512x512.png
----------------------------------------------------------------------
diff --git a/weinre.doc/images/weinre-icon-512x512.png b/weinre.doc/images/weinre-icon-512x512.png
new file mode 100644
index 0000000..2b80cb6
Binary files /dev/null and b/weinre.doc/images/weinre-icon-512x512.png differ

http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/blob/d0a4694a/weinre.web/client/ExtensionRegistryStub.js
----------------------------------------------------------------------
diff --git a/weinre.web/client/ExtensionRegistryStub.js b/weinre.web/client/ExtensionRegistryStub.js
index 6937fdb..8426fda 100644
--- a/weinre.web/client/ExtensionRegistryStub.js
+++ b/weinre.web/client/ExtensionRegistryStub.js
@@ -18,6 +18,6 @@
  */
 
 (function() {
-    var ExtensionRegistryImpl = require("weinre/client/ExtensionRegistryImpl")
+    var ExtensionRegistryImpl = modjewel.require("weinre/client/ExtensionRegistryImpl")
     window.InspectorExtensionRegistry = new ExtensionRegistryImpl()
 })()

http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/blob/d0a4694a/weinre.web/client/InspectorBackendStub.js
----------------------------------------------------------------------
diff --git a/weinre.web/client/InspectorBackendStub.js b/weinre.web/client/InspectorBackendStub.js
index 645163c..aec9436 100644
--- a/weinre.web/client/InspectorBackendStub.js
+++ b/weinre.web/client/InspectorBackendStub.js
@@ -18,6 +18,6 @@
  */
 
 (function() {
-    var InspectorBackendImpl = require("weinre/client/InspectorBackendImpl")
+    var InspectorBackendImpl = modjewel.require("weinre/client/InspectorBackendImpl")
     window.InspectorBackend = new InspectorBackendImpl()
 })()

http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/blob/d0a4694a/weinre.web/client/InspectorFrontendHostStub.js
----------------------------------------------------------------------
diff --git a/weinre.web/client/InspectorFrontendHostStub.js b/weinre.web/client/InspectorFrontendHostStub.js
index 5bca358..64952c3 100644
--- a/weinre.web/client/InspectorFrontendHostStub.js
+++ b/weinre.web/client/InspectorFrontendHostStub.js
@@ -18,6 +18,6 @@
  */
 
 (function() {
-    var InspectorFrontEndHostImpl = require("weinre/client/InspectorFrontendHostImpl")
+    var InspectorFrontEndHostImpl = modjewel.require("weinre/client/InspectorFrontendHostImpl")
     window.InspectorFrontendHost = new InspectorFrontEndHostImpl()
 })()

http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/blob/d0a4694a/weinre.web/modjewel.js
----------------------------------------------------------------------
diff --git a/weinre.web/modjewel.js b/weinre.web/modjewel.js
index 5f84d9c..0a1284b 100644
--- a/weinre.web/modjewel.js
+++ b/weinre.web/modjewel.js
@@ -42,7 +42,7 @@
 // some constants
 //----------------------------------------------------------------------------
 var PROGRAM = "modjewel"
-var VERSION = "1.2.0"
+var VERSION = "2.0.0"
 var global  = this
 
 //----------------------------------------------------------------------------
@@ -55,10 +55,6 @@ if (global.modjewel) {
 
 global.modjewel = null
 
-var OriginalRequire = global.require
-var OriginalDefine  = global.define
-var NoConflict      = false
-
 //----------------------------------------------------------------------------
 // "globals" (local to this function scope though)
 //----------------------------------------------------------------------------
@@ -174,12 +170,15 @@ function require_reset() {
     ModulePreloadStore = {}
     MainModule         = create_module(null)
 
-    require_define("modjewel", modjewel_module)
+    var require = get_require(MainModule)
+    var define  = require_define
+    
+    define("modjewel", modjewel_module)
 
-    global.require    = get_require(MainModule)
-    global.define     = require_define
-    global.define.amd = true
-    global.modjewel   = require("modjewel")
+    global.modjewel            = require("modjewel")
+    global.modjewel.require    = require
+    global.modjewel.define     = define
+    global.modjewel.define.amd = {implementation: PROGRAM, version: VERSION}
 }
 
 //----------------------------------------------------------------------------
@@ -333,29 +332,17 @@ function modjewel_warnOnRecursiveRequire(value) {
 }
 
 //----------------------------------------------------------------------------
-// relinquish modjewel's control of the require variable
-// - like jQuery's version'
-//----------------------------------------------------------------------------
-function modjewel_noConflict() {
-    NoConflict = true
-
-    global.require = OriginalRequire
-    global.define  = OriginalDefine
-}
-
-//----------------------------------------------------------------------------
 // the modjewel module
 //----------------------------------------------------------------------------
 function modjewel_module(require, exports, module) {
     exports.VERSION                = VERSION
-    exports.require                = require
-    exports.define                 = require.define
+    exports.require                = null // filled in later
+    exports.define                 = null // filled in later
     exports.getLoadedModuleIds     = modjewel_getLoadedModuleIds
     exports.getPreloadedModuleIds  = modjewel_getPreloadedModuleIds
     exports.getModule              = modjewel_getModule
     exports.getModuleIdsRequired   = modjewel_getModuleIdsRequired
     exports.warnOnRecursiveRequire = modjewel_warnOnRecursiveRequire
-    exports.noConflict             = modjewel_noConflict
 }
 
 //----------------------------------------------------------------------------


Mime
View raw message