Skip to content

Commit

Permalink
Allow @ to be used as a divider with cli: install and info. (#2322)
Browse files Browse the repository at this point in the history
  • Loading branch information
doomedramen authored and sheerun committed Jul 4, 2016
1 parent 8b6c8ee commit 22bbb3f
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/commands/info.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ function info(logger, endpoint, property, config) {
return;
}

// handle @ as version divider
endpoint = endpoint.replace('@', '#');

var repository;
var decEndpoint;

Expand Down
2 changes: 2 additions & 0 deletions lib/commands/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ function install(logger, endpoints, options, config) {
// Convert endpoints to decomposed endpoints
endpoints = endpoints || [];
decEndpoints = endpoints.map(function (endpoint) {
// handle @ as version divider
endpoint = endpoint.replace('@', '#');
return endpointParser.decompose(endpoint);
});

Expand Down
13 changes: 13 additions & 0 deletions test/commands/info.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,17 @@ describe('bower info', function () {
});
});
});
it('should handle @ as a divider', function () {
return helpers.run(info, [mainPackage.path + '@0.1.3']).spread(function (results) {
expect(results).to.eql(
{
name: 'package',
version: '0.1.3',
homepage: 'http://bower.io',
description: 'Hello world! Hello!'
}
);
});

});
});
9 changes: 9 additions & 0 deletions test/commands/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -726,4 +726,13 @@ describe('bower install', function () {
expect(tempDir.read(path.join('bower_components', 'package', 'package.tar'))).to.contain('test');
});
});
it('should handle @ as a divider', function () {
return helpers.run(install, [
['empty@1.0.1'], {
save: true
}
]).then(function () {
expect(tempDir.readJson('bower.json').dependencies).to.eql({empty: '1.0.1'});
});
});
});

0 comments on commit 22bbb3f

Please sign in to comment.