Repository: donejs/donejs
Pull request #614 (2016-04-06 23:26:10)

Use the current branch or master as the global donejs binary
That way we will catch problems with the global DoneJS before it is published to npm.

coveralls: 
[![Coverage Status](https://coveralls.io/builds/5702340/badge)](https://coveralls.io/builds/5702340)

Coverage remained the same at 96.226% when pulling **2b828adadb34fb989ed8433c7040d8e4bf5a86c0 on guide-test-branch** into **de0bc2edb6b662a0452f59d8bd0cba37bce2082b on master**.

coveralls: 
[![Coverage Status](https://coveralls.io/builds/5702645/badge)](https://coveralls.io/builds/5702645)

Coverage remained the same at 96.226% when pulling **2dd6935ddddbb4b582a860fd4a0a285ea9baf373 on guide-test-branch** into **de0bc2edb6b662a0452f59d8bd0cba37bce2082b on master**.


Patch:
diff --git a/lib/utils.js b/lib/utils.js
index 0b0b543..5d2fd3d 100644
--- a/lib/utils.js
+++ b/lib/utils.js
@@ -90,6 +90,7 @@ exports.log = function(promise) {
 };
 
 // Takes an exact version like 0.5.7 and turns into a range like ^0.5.0
-exports.versionRange = function(exactVersion){
-  return "^" + exactVersion.substr(0, exactVersion.lastIndexOf(".")) + ".0";
+exports.versionRange = function(exactVersion) {
+  var lastDotPos = exactVersion.lastIndexOf(".");
+  return exactVersion.substr(0, lastDotPos) + ".x";
 };


Test patch:
diff --git a/guides/guide/test.js b/guides/guide/test.js
index efabbc8..a1cc04e 100644
--- a/guides/guide/test.js
+++ b/guides/guide/test.js
@@ -25,7 +25,9 @@ guide.step("Remove existing dependencies", function(){
 });
 
 guide.step("Install donejs", function(){
-	return guide.executeCommand("npm", ["install", "donejs", "-g"]);
+  var branch = process.env.TRAVIS_BRANCH || process.env.APPVEYOR_REPO_BRANCH || 'master';
+
+	return guide.executeCommand("npm", ["install", "donejs/donejs#" + branch, "-g"]);
 });
 
 // Move to a temp folder for the rest of the guide
diff --git a/guides/place-my-order/test.js b/guides/place-my-order/test.js
index af12d73..d721e77 100644
--- a/guides/place-my-order/test.js
+++ b/guides/place-my-order/test.js
@@ -38,7 +38,9 @@ guide.step("Remove existing dependencies", function(){
 });
 
 guide.step("Install donejs", function(){
-	return guide.executeCommand("npm", ["install", "donejs", "-g"]);
+	var branch = process.env.TRAVIS_BRANCH || process.env.APPVEYOR_REPO_BRANCH || 'master';
+
+  return guide.executeCommand("npm", ["install", "donejs/donejs#" + branch, "-g"]);
 });
 
 // Move to a temp folder for the rest of the guide
diff --git a/test/utils-test.js b/test/utils-test.js
index c248b43..fc437aa 100644
--- a/test/utils-test.js
+++ b/test/utils-test.js
@@ -109,12 +109,10 @@ describe('utils tests', function() {
   });
 
   describe('versionRange', function() {
-    it('gives a semver range compatible with the latest of a given version', function(){
-      assert.equal(
-        "^0.5.0",
-        utils.versionRange("0.5.12"),
-        "^0.5.0 is what you want if the current version of 0.5.12"
-      );
+    it('gives a semver range compatible with given version', function(){
+      assert.equal(utils.versionRange("0.5"), "0.x");
+      assert.equal(utils.versionRange("0.5.1"), "0.5.x");
+      assert.equal(utils.versionRange("0.5.1-beta.1"), "0.5.1-beta.x");
     });
   });
 });