Skip to content

Commit

Permalink
Merge 902526f into 520dd86
Browse files Browse the repository at this point in the history
  • Loading branch information
am11 committed Jan 8, 2015
2 parents 520dd86 + 902526f commit 2f7a972
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions scripts/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,11 @@ function download(url, dest, cb) {
*/

function getProxy() {
var result;

['https-proxy', 'proxy', 'http-proxy'].map(function(config) {
var result = ['https-proxy', 'proxy', 'http-proxy'].filter(function(config) {
var proxy = exec('npm config get ' + config, {silent: true});
var output = proxy.output.trim();

if (proxy.code === 0 && output !== 'undefined' && output !== 'null') {
result = proxy.output;
return;
}
return proxy.code === 0 && validateProxy(output);
});

if (result) {
Expand All @@ -63,6 +58,19 @@ function getProxy() {
return env.HTTPS_PROXY || env.https_proxy || env.HTTP_PROXY || env.http_proxy;
}

/**
* Validates Proxy URL
*
* @param {String} url
* @api private
*/

function getProxy(url) {
return output !== 'undefined' &&
output !== 'null' &&
url === require('url').parse(url);
}

/**
* Check if binaries exists
*
Expand Down

0 comments on commit 2f7a972

Please sign in to comment.