You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by an...@apache.org on 2014/04/24 23:14:05 UTC
[07/28] git commit: adding clobbers/merges support
adding clobbers/merges support
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/cd13a49a
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/cd13a49a
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/cd13a49a
Branch: refs/heads/master
Commit: cd13a49a7ae5ab110b132d67fe64d222da0b54d9
Parents: 57bba0d
Author: Anis Kadri <an...@apache.org>
Authored: Thu Mar 27 19:48:50 2014 +0100
Committer: Anis Kadri <an...@apache.org>
Committed: Thu Mar 27 19:48:50 2014 +0100
----------------------------------------------------------------------
src/prepare.js | 22 ++++++++++++++++++++--
1 file changed, 20 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/cd13a49a/src/prepare.js
----------------------------------------------------------------------
diff --git a/src/prepare.js b/src/prepare.js
index fd12d34..5c6b694 100644
--- a/src/prepare.js
+++ b/src/prepare.js
@@ -187,10 +187,11 @@ module.exports = function handlePrepare(project_dir, platform, plugins_dir, www_
var fsPath = path.join.apply(path, pathParts);
var scriptPath = path.join(pluginDir, fsPath);
-
- libraryRelease.add(scriptPath);
+ var bScriptPath = util.format("%s.%s", scriptPath, 'browserify');
var scriptContent = fs.readFileSync(scriptPath, 'utf-8');
+ fs.writeFileSync(bScriptPath, scriptContent, 'utf-8');
+
scriptContent = 'cordova.define("' + moduleName + '", function(require, exports, module) { ' + scriptContent + '\n});\n';
fs.writeFileSync(path.join(platformPluginsDir, plugin_id, fsPath), scriptContent, 'utf-8');
if(platform == 'wp7' || platform == 'wp8' || platform == "windows8") {
@@ -210,11 +211,27 @@ module.exports = function handlePrepare(project_dir, platform, plugins_dir, www_
obj.clobbers = [];
}
obj.clobbers.push(child.attrib.target);
+ /* FIXME: browserify guettho clobber */
+ fs.appendFileSync(bScriptPath,
+ util.format(
+ "require('cordova/builder').assignOrWrapInDeprecateGetter(window, '%s', module.exports);",
+ child.attrib.target
+ ),
+ 'utf-8');
+ /* end browserify guettho clobber */
} else if (child.tag.toLowerCase() == 'merges') {
if (!obj.merges) {
obj.merges = [];
}
obj.merges.push(child.attrib.target);
+ /* FIXME: browserify guettho clobber */
+ fs.appendFileSync(bScriptPath,
+ util.format(
+ "require('cordova/builder').recursiveMerge(window, '%s', module.exports);",
+ child.attrib.target
+ ),
+ 'utf-8');
+ /* end browserify guettho clobber */
} else if (child.tag.toLowerCase() == 'runs') {
obj.runs = true;
}
@@ -222,6 +239,7 @@ module.exports = function handlePrepare(project_dir, platform, plugins_dir, www_
// Add it to the list of module objects bound for cordova_plugins.json
moduleObjects.push(obj);
+ libraryRelease.add(bScriptPath);
});
});