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 the info command to accept @ as a divider #2320

Closed
wants to merge 2 commits into from
Closed
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!'
}
);
});

});
});
17 changes: 17 additions & 0 deletions test/commands/install.js
Expand Up @@ -726,4 +726,21 @@ describe('bower install', function () {
expect(tempDir.read(path.join('bower_components', 'package', 'package.tar'))).to.contain('test');
});
});
it('should handle @ as a divider', function (done) {
// Run `bower install package@1.0.1`
var binRunner = helpers.runBin(['install', gitPackage.path + '@' + gitPackage.latestGitTag()]);

// There should be no error output
expect(binRunner.stderr.toString()).to.be('');
// A checkout response should be given
expect(binRunner.stdout.toString()).to.contain('checkout ' + gitPackage.latestGitTag());

//clean up temp files
return rimraf(path.join(__dirname, '../../bower_components'), function (err) {
if (err) {
console.warn('failed to delete temporary `bower_components`');
}
done();
});
});
});