Skip to content

Commit

Permalink
Normalize github urls to https:// instead of git://
Browse files Browse the repository at this point in the history
  • Loading branch information
sheerun committed Apr 5, 2016
1 parent 92476d0 commit 8235550
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion lib/normalizeURL.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ module.exports = function(suppliedUrl) {
pathname = pathname.replace(/\/?$/,'');
ext = pathname.match(/\.git$/) ? '' : '.git';

url = 'git://github.com' + pathname + ext;
url = 'https://github.com' + pathname + ext;
}

return url;
Expand Down
14 changes: 7 additions & 7 deletions test/integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ describe('registry server', function(){

describe('/packages', function() {
beforeEach(function (done) {
database.insertPackage('jquery', 'git://github.com/jquery/jquery', done);
database.insertPackage('jquery', 'https://github.com/jquery/jquery', done);
});

it('shound properly setup database so status is 200', function (done) {
Expand All @@ -79,7 +79,7 @@ describe('registry server', function(){
request.get(bowerServerUrl + '/packages', function (err, res, body){
expect(JSON.parse(body)).to.eql([{
'name': 'jquery',
'url': 'git://github.com/jquery/jquery'
'url': 'https://github.com/jquery/jquery'
}]);

done();
Expand All @@ -90,7 +90,7 @@ describe('registry server', function(){
request.get(bowerServerUrl + '/packages/jquery', function (err, res, body){
expect(JSON.parse(body)).to.eql({
'name': 'jquery',
'url': 'git://github.com/jquery/jquery',
'url': 'https://github.com/jquery/jquery',
});

done();
Expand All @@ -102,7 +102,7 @@ describe('registry server', function(){
request.get(bowerServerUrl + '/packages/jquery', function (err, res, body){
expect(JSON.parse(body)).to.eql({
'name': 'jquery',
'url': 'git://github.com/jquery/jquery'
'url': 'https://github.com/jquery/jquery'
});

done();
Expand All @@ -116,7 +116,7 @@ describe('registry server', function(){
request.get(url, function (err, res, body) {
expect(res.statusCode).to.eq(200);
expect(JSON.parse(res.body)).to.eql(
[{'name':'jquery','url':'git://github.com/jquery/jquery'}]
[{'name':'jquery','url':'https://github.com/jquery/jquery'}]
)
done();
});
Expand All @@ -133,7 +133,7 @@ describe('registry server', function(){

it('should create a package when POSTing to /packages', function (done) {
request.post(bowerServerUrl + '/packages', {
form: { 'name': 'loom', 'url': 'git://github.com/rpflorence/loom.git' }
form: { 'name': 'loom', 'url': 'https://github.com/rpflorence/loom.git' }
}, function (err, res, body){
expect(res.statusCode).to.eq(201);
done();
Expand All @@ -142,7 +142,7 @@ describe('registry server', function(){

it('should error when a package has already been registered', function (done) {
request.post(bowerServerUrl + '/packages', {
form: { 'name': 'jquery', 'url': 'git://github.com/jquery/jquery.git' }
form: { 'name': 'jquery', 'url': 'https://github.com/jquery/jquery.git' }
}, function (err, res, body) {
expect(res.statusCode).to.eq(403);
done();
Expand Down
4 changes: 2 additions & 2 deletions test/normalizeGithubURLs.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var assert = require('chai').assert;
var normalizeURL = require('../lib/normalizeURL');
var normalizedURL = 'git://github.com/bower/Bower.git';
var normalizedURL = 'https://github.com/bower/Bower.git';


describe('package names', function(){
Expand Down Expand Up @@ -50,7 +50,7 @@ describe('package names', function(){
});

it('should support urls with dots in the name and an extension', function () {
return assert.equal(normalizeURL('https://github.com/bower/Bower.js.git'), 'git://github.com/bower/Bower.js.git');
return assert.equal(normalizeURL('https://github.com/bower/Bower.js.git'), 'https://github.com/bower/Bower.js.git');
});

it('should not work on gists', function () {
Expand Down

0 comments on commit 8235550

Please sign in to comment.