Skip to content

Commit

Permalink
Merge 2af8242 into a7b8265
Browse files Browse the repository at this point in the history
  • Loading branch information
daffl committed Apr 8, 2016
2 parents a7b8265 + 2af8242 commit c8ad52a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
4 changes: 3 additions & 1 deletion guides/guide/test.js
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion guides/place-my-order/test.js
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions lib/utils.js
Expand Up @@ -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";
};
10 changes: 4 additions & 6 deletions test/utils-test.js
Expand Up @@ -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");
});
});
});

0 comments on commit c8ad52a

Please sign in to comment.