cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject cordova-lib git commit: enhanced cordova-fetch to better handle multiple fetches via git urls
Date Wed, 15 Jun 2016 00:51:32 GMT
Repository: cordova-lib
Updated Branches:
  refs/heads/master d28eed638 -> 569983e41


enhanced cordova-fetch to better handle multiple fetches via git urls


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

Branch: refs/heads/master
Commit: 569983e413868f4170c1d6ccb5ca90d708740fa1
Parents: d28eed6
Author: Steve Gill <stevengill97@gmail.com>
Authored: Tue Jun 14 17:50:29 2016 -0700
Committer: Steve Gill <stevengill97@gmail.com>
Committed: Tue Jun 14 17:51:25 2016 -0700

----------------------------------------------------------------------
 cordova-fetch/index.js           |  7 +++++--
 cordova-fetch/spec/fetch.spec.js | 12 +++++++++++-
 2 files changed, 16 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/569983e4/cordova-fetch/index.js
----------------------------------------------------------------------
diff --git a/cordova-fetch/index.js b/cordova-fetch/index.js
index 51d6c42..560f36b 100644
--- a/cordova-fetch/index.js
+++ b/cordova-fetch/index.js
@@ -143,9 +143,12 @@ function trimID(target) {
 
     //If GITURL, set target to repo name
     if (isUrl(target)) {
-        var re = /.*\/(.*).git/;
+        var re = /.*\/(.*)/;
+        //Grabs everything in url after last `/`
         parts = target.match(re);
-        target = parts[1];
+        //strip away .git and everything that follows
+        var strippedTarget = parts[1].split('.git');
+        target = strippedTarget[0];
     }
     
     //strip away everything after '@'

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/569983e4/cordova-fetch/spec/fetch.spec.js
----------------------------------------------------------------------
diff --git a/cordova-fetch/spec/fetch.spec.js b/cordova-fetch/spec/fetch.spec.js
index 32fdb98..1407752 100644
--- a/cordova-fetch/spec/fetch.spec.js
+++ b/cordova-fetch/spec/fetch.spec.js
@@ -229,6 +229,7 @@ describe('test trimID method for npm and git', function () {
         .then(function(result) {
             expect(result).toBeDefined();
             expect(fs.existsSync(result)).toBe(true);
+            expect(result).toMatch('cordova-plugin-device');
 
             //refetch to trigger trimID
             return fetch('https://github.com/apache/cordova-plugin-media.git', tmpDir, opts);
@@ -236,13 +237,22 @@ describe('test trimID method for npm and git', function () {
         .then(function(result) {
             expect(result).toBeDefined();
             expect(fs.existsSync(result)).toBe(true);
+            expect(result).toMatch('cordova-plugin-media');
+
+            //refetch to trigger trimID, this time no .git
+            return fetch('https://github.com/apache/cordova-plugin-media', tmpDir, opts);
+        })
+        .then(function(result) {
+            expect(result).toBeDefined();
+            expect(fs.existsSync(result)).toBe(true);
+            expect(result).toMatch('cordova-plugin-media');
         })
         .fail(function(err) {
             console.error(err);
             expect(err).toBeUndefined();
         })
         .fin(done);
-    }, 30000);
+    }, 40000);
 });
 
 describe('fetch failure with unknown module', function () {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


Mime
View raw message