Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow @ to be used as a divider with cli: install and info. #2322

Merged
merged 5 commits into from Jul 4, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/commands/info.js
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
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
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
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'});
});
});
});