Do not translate urls for custom registry servers.

This commit is contained in:
André Cruz
2013-08-29 19:56:29 +01:00
parent 5e1971a951
commit 491027b048
2 changed files with 9 additions and 6 deletions

View File

@@ -3,6 +3,7 @@ var Q = require('q');
var chalk = require('chalk');
var PackageRepository = require('../core/PackageRepository');
var Logger = require('bower-logger');
var Config = require('bower-config');
var cli = require('../util/cli');
var createError = require('../util/createError');
var defaultConfig = require('../config');
@@ -31,12 +32,14 @@ function register(name, url, config) {
return logger.emit('error', createError('Please type a name', 'EINVNAME'));
}
// Convert URLs
url = convertUrl(url, logger);
// The public registry only allows git:// endpoints
// As such, we attempt to convert URLs as necessary
if (config.registry.register === Config.DEFAULT_REGISTRY) {
url = convertUrl(url, logger);
// Ensure the URL starts with git://
if (!mout.string.startsWith(url, 'git://')) {
return logger.emit('error', createError('The registry only accepts URLs starting with git://', 'EINVFORMAT'));
if (!mout.string.startsWith(url, 'git://')) {
return logger.emit('error', createError('The registry only accepts URLs starting with git://', 'EINVFORMAT'));
}
}
// Attempt to resolve the package referenced by the URL to ensure

View File

@@ -21,7 +21,7 @@
"dependencies": {
"abbrev": "~1.0.4",
"archy": "0.0.2",
"bower-config": "~0.4.3",
"bower-config": "~0.5.0",
"bower-endpoint-parser": "~0.2.0",
"bower-json": "~0.4.0",
"bower-logger": "~0.2.1",