You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ag...@apache.org on 2014/06/06 22:24:38 UTC

[1/2] git commit: CB-6698 Resolve android relative to plugin_dir when custom=true

Repository: cordova-lib
Updated Branches:
  refs/heads/master 69f001768 -> 04588a420


CB-6698 Resolve android <framework> relative to plugin_dir when custom=true


Project: http://git-wip-us.apache.org/repos/asf/cordova-lib/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-lib/commit/04588a42
Tree: http://git-wip-us.apache.org/repos/asf/cordova-lib/tree/04588a42
Diff: http://git-wip-us.apache.org/repos/asf/cordova-lib/diff/04588a42

Branch: refs/heads/master
Commit: 04588a42067a5ba0d303f4b69f99f44640c3b9e0
Parents: d2d11a6
Author: Andrew Grieve <ag...@chromium.org>
Authored: Fri Jun 6 16:23:47 2014 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Fri Jun 6 16:24:21 2014 -0400

----------------------------------------------------------------------
 cordova-lib/spec-plugman/platforms/android.spec.js | 13 +++++++------
 cordova-lib/src/plugman/platforms/android.js       |  2 +-
 2 files changed, 8 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/04588a42/cordova-lib/spec-plugman/platforms/android.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/platforms/android.spec.js b/cordova-lib/spec-plugman/platforms/android.spec.js
index cee301b..a083535 100644
--- a/cordova-lib/spec-plugman/platforms/android.spec.js
+++ b/cordova-lib/spec-plugman/platforms/android.spec.js
@@ -119,21 +119,22 @@ describe('android project handler', function() {
             afterEach(function() {
                 android.purgeProjectFileCache(temp);
             });
-            it('should update the main and library projects', function() {
+            it('with custom=true should update the main and library projects', function() {
                 var frameworkElement = { attrib: { src: "LibraryPath", custom: true } };
-                var subDir = path.resolve(temp, frameworkElement.attrib.src);
+                var subDir = path.resolve(dummyplugin, frameworkElement.attrib.src);
                 var mainProjectPropsFile = path.resolve(temp, "project.properties");
                 var subProjectPropsFile = path.resolve(subDir, "project.properties");
 
                 var existsSync = spyOn( fs, 'existsSync').andReturn(true);
                 var writeFileSync = spyOn(fs, 'writeFileSync');
                 var readFileSync = spyOn(fs, 'readFileSync').andCallFake(function (file) {
-                    if (path.normalize(file) === mainProjectPropsFile) {
+                    file = path.normalize(file);
+                    if (file === mainProjectPropsFile) {
                         return '#Some comment\ntarget=android-19\nandroid.library.reference.1=ExistingLibRef1\nandroid.library.reference.2=ExistingLibRef2';
-                    } else if (path.normalize(file) === subProjectPropsFile) {
+                    } else if (file === subProjectPropsFile) {
                         return '#Some comment\ntarget=android-17\nandroid.library=true';
                     } else {
-                        throw new Error("Trying to read from an unexpected file " + file);
+                        throw new Error("Trying to read from an unexpected file " + file + '\n expected: ' + mainProjectPropsFile + '\n' + subProjectPropsFile);
                     }
                 })
                 var exec = spyOn(shell, 'exec');
@@ -142,7 +143,7 @@ describe('android project handler', function() {
                 android.parseProjectFile(temp).write();
 
                 expect(_.any(writeFileSync.argsForCall, function (callArgs) {
-                    return callArgs[0] === mainProjectPropsFile && callArgs[1].indexOf('\nandroid.library.reference.3=LibraryPath') > -1;
+                    return callArgs[0] === mainProjectPropsFile && !!/\nandroid.library.reference.3=.*?LibraryPath/.exec(callArgs[1]);
                 })).toBe(true, 'Reference to library not added');
                 expect(_.any(writeFileSync.argsForCall, function (callArgs) {
                     return callArgs[0] === subProjectPropsFile && callArgs[1].indexOf('\ntarget=android-19') > -1;

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/04588a42/cordova-lib/src/plugman/platforms/android.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/platforms/android.js b/cordova-lib/src/plugman/platforms/android.js
index 06aee30..349b818 100644
--- a/cordova-lib/src/plugman/platforms/android.js
+++ b/cordova-lib/src/plugman/platforms/android.js
@@ -93,7 +93,7 @@ module.exports = {
             var parentDir = parent ? path.resolve(project_dir, parent) : project_dir;
             var subDir;
             if (custom) {
-                subDir = path.resolve(project_dir, src);
+                subDir = path.resolve(plugin_dir, src);
             } else {
                 var localProperties = properties_parser.createEditor(path.resolve(project_dir, "local.properties"));
                 subDir = path.resolve(localProperties.get("sdk.dir"), src);


[2/2] git commit: Fix tests on node 0.11.x

Posted by ag...@apache.org.
Fix tests on node 0.11.x


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

Branch: refs/heads/master
Commit: d2d11a6be625e4ed92ef0a17ca78541fe1f42365
Parents: 69f0017
Author: Andrew Grieve <ag...@chromium.org>
Authored: Fri Jun 6 16:00:59 2014 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Fri Jun 6 16:24:21 2014 -0400

----------------------------------------------------------------------
 cordova-lib/spec-cordova/restore.spec.js | 2 +-
 cordova-lib/spec-cordova/save.spec.js    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/d2d11a6b/cordova-lib/spec-cordova/restore.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/restore.spec.js b/cordova-lib/spec-cordova/restore.spec.js
index 745e78e..d32784e 100644
--- a/cordova-lib/spec-cordova/restore.spec.js
+++ b/cordova-lib/spec-cordova/restore.spec.js
@@ -42,7 +42,7 @@ describe('restore command', function(){
   it('should not run outside of a Cordova-based project by calling util.isCordova', function() {
      is_cordova.andReturn(false);
      wrapper(cordova.raw.restore, function() {
-        expect(result).toEqual(new Error('Current working directory is not a Cordova-based project.'));
+        expect(result.message).toMatch('Current working directory is not a Cordova-based project.');
      });
   });
 

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/d2d11a6b/cordova-lib/spec-cordova/save.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-cordova/save.spec.js b/cordova-lib/spec-cordova/save.spec.js
index c5ddcf2..6c76dd9 100644
--- a/cordova-lib/spec-cordova/save.spec.js
+++ b/cordova-lib/spec-cordova/save.spec.js
@@ -42,7 +42,7 @@ describe('save command', function(){
   it('should not run outside of a Cordova-based project by calling util.isCordova', function() {
      is_cordova.andReturn(false);
      wrapper(cordova.raw.save, function() {
-        expect(result).toEqual(new Error('Current working directory is not a Cordova-based project.'));
+        expect('' + result).toMatch('Current working directory is not a Cordova-based project.');
      });
   });