cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From na...@apache.org
Subject [26/32] git commit: CB-5889 Make update script find project name instead of using "null" for CordovaLib
Date Mon, 03 Feb 2014 20:26:27 GMT
CB-5889 Make update script find project name instead of using "null" for CordovaLib


Project: http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/commit/51cc2bef
Tree: http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/tree/51cc2bef
Diff: http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/diff/51cc2bef

Branch: refs/heads/3.4.x
Commit: 51cc2bef43eeb8a4d93a659c04e02b72eb5c9954
Parents: 3974c2d
Author: Andrew Grieve <agrieve@chromium.org>
Authored: Fri Jan 24 10:40:09 2014 -0500
Committer: Archana Naik <naika@lab126.com>
Committed: Mon Feb 3 11:09:46 2014 -0800

----------------------------------------------------------------------
 bin/lib/create.js | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/blob/51cc2bef/bin/lib/create.js
----------------------------------------------------------------------
diff --git a/bin/lib/create.js b/bin/lib/create.js
index e92027c..1b62bd8 100755
--- a/bin/lib/create.js
+++ b/bin/lib/create.js
@@ -195,20 +195,29 @@ exports.createProject = function(project_path, package_name, project_name,
proje
 
 // Attribute removed in Cordova 4.4 (CB-5447).
 function removeDebuggableFromManifest(projectPath) {
-    var manifestPath   = path.join(projectPath, 'AndroidManifest.xml');
+    var manifestPath = path.join(projectPath, 'AndroidManifest.xml');
     shell.sed('-i', /\s*android:debuggable="true"/, '', manifestPath);
 }
 
+function extractProjectNameFromManifest(projectPath) {
+    var manifestPath = path.join(projectPath, 'AndroidManifest.xml');
+    var manifestData = fs.readFileSync(manifestPath, 'utf8');
+    var m = /<activity[\s\S]*?android:name\s*=\s*"(.*?)"/i.exec(manifestData);
+    if (!m) {
+      throw new Error('Could not find activity name in ' + manifestPath);
+    }
+    return m[1];
+}
+
 // Returns a promise.
 exports.updateProject = function(projectPath) {
     var version = fs.readFileSync(path.join(ROOT, 'VERSION'), 'utf-8').trim();
     // Check that requirements are met and proper targets are installed
     return check_reqs.run()
     .then(function() {
+        var projectName = extractProjectNameFromManifest(projectPath);
         var target_api = check_reqs.get_target();
-        return ensureJarIsBuilt(version, target_api);
-    }).then(function() {
-        copyJsAndJar(projectPath, version);
+        copyJsAndLibrary(projectPath, false, projectName);
         copyScripts(projectPath);
         copyAntRules(projectPath);
         removeDebuggableFromManifest(projectPath);


Mime
View raw message