Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
node-sass
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
楚学文
node-sass
Commits
04f87276
Commit
04f87276
authored
Jan 08, 2015
by
Adeel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Install: Improves code to get proxy.
* Credit: @xzyfer. * Addresses #588.
parent
520dd86a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
9 deletions
+21
-9
install.js
scripts/install.js
+21
-9
No files found.
scripts/install.js
View file @
04f87276
...
...
@@ -43,17 +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
&&
validateProxyUrl
(
proxy
.
output
.
trim
());
})[
0
];
if
(
result
)
{
return
result
;
...
...
@@ -64,6 +58,24 @@ function getProxy() {
}
/**
* Validates Proxy URL
*
* @param {String} url
* @api private
*/
function
validateProxyUrl
(
url
)
{
if
(
/
\n
/
.
test
(
url
))
{
url
=
url
.
replace
(
/
\r?\n
+/
,
'
\
n'
).
split
(
'
\
n'
);
url
=
url
[
url
.
length
-
3
].
trim
();
// get the second last element.
}
return
url
!==
'null'
&&
url
!==
'undefined'
&&
url
===
require
(
'url'
).
parse
(
url
);
}
/**
* Check if binaries exists
*
* @api private
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment