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 2015/09/09 13:10:04 UTC

cordova-lib git commit: CB-9601 Fix .versions support on Windows after semver update

Repository: cordova-lib
Updated Branches:
  refs/heads/master 14675051c -> 04310fb70


CB-9601 Fix <framework>.versions support on Windows after semver update


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

Branch: refs/heads/master
Commit: 04310fb70e953be48b9123697b54d661c81cca8e
Parents: 1467505
Author: sgrebnov <v-...@microsoft.com>
Authored: Thu Sep 3 19:10:13 2015 +0300
Committer: sgrebnov <v-...@microsoft.com>
Committed: Tue Sep 8 14:44:08 2015 +0300

----------------------------------------------------------------------
 cordova-lib/src/util/windows/jsprojManager.js | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/04310fb7/cordova-lib/src/util/windows/jsprojManager.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/util/windows/jsprojManager.js b/cordova-lib/src/util/windows/jsprojManager.js
index f1260f3..eda78a2 100644
--- a/cordova-lib/src/util/windows/jsprojManager.js
+++ b/cordova-lib/src/util/windows/jsprojManager.js
@@ -264,7 +264,8 @@ jsprojManager.prototype = {
 
         if (target || versions) {
             var matchingProjects = this.projects.filter(function (project) {
-                return (!target || target === project.target) && (!versions || semver.satisfies(project.version, versions, /* loose */ true));
+                return (!target || target === project.target) &&
+                    (!versions || semver.satisfies(project.getSemVersion(), versions, /* loose */ true));
             });
 
             if (matchingProjects.length < this.projects.length) {
@@ -529,6 +530,21 @@ util.inherits(jsproj, proj);
 jsproj.prototype.target = null;
 jsproj.prototype.version = null;
 
+// Returns valid semantic version (http://semver.org/).
+jsproj.prototype.getSemVersion = function () {
+    // For example, for version 10.0.10240.0 we will return 10.0.10240 (first three components)
+    var semVersion = this.version;
+    var splittedVersion = semVersion.split('.');
+    if (splittedVersion.length > 3) {
+        semVersion = splittedVersion.splice(0, 3).join('.');
+    }
+
+    return semVersion;
+	// Alternative approach could be replacing last dot with plus sign to
+	// be complaint w/ semver specification, for example
+	// 10.0.10240.0 -> 10.0.10240+0
+};
+
 /* Common support functions */
 
 function createConditionAttrib(targetConditions) {


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