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

Added support to pass request options down to GRS #46

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions index.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ module.exports = electron = (options) ->
new Promise (resolve,reject) ->
Promise.resolve().then ->
# If not downloaded then download the special package.
download cacheFile, cachePath, options.version, cacheZip, options.token
download cacheFile, cachePath, options.version, cacheZip, options.token, options.requestOptions
.then ->
# If not unziped then unzip the zip file.
# Check if there already have an version file.
Expand Down Expand Up @@ -292,7 +292,7 @@ getApmPath = ->
apmPath = path.join 'apm', 'node_modules', 'atom-package-manager', 'bin', 'apm'
apmPath = 'apm' unless isFile apmPath

download = (cacheFile, cachePath, version, cacheZip, token) ->
download = (cacheFile, cachePath, version, cacheZip, token, requestOptions) ->
if isFile cacheFile
util.log PLUGIN_NAME, "download skip: already exists"
return Promise.resolve()
Expand All @@ -305,7 +305,8 @@ download = (cacheFile, cachePath, version, cacheZip, token) ->
repo: 'atom/electron'
tag: version
name: cacheZip
token: token
token: token,
requestOptions: requestOptions
.on 'error', (error) ->
throw new PluginError PLUGIN_NAME, error
.on 'size', (size) ->
Expand Down
7 changes: 4 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ module.exports = electron = function(options) {
};
return new Promise(function(resolve, reject) {
return Promise.resolve().then(function() {
return download(cacheFile, cachePath, options.version, cacheZip, options.token);
return download(cacheFile, cachePath, options.version, cacheZip, options.token, options.requestOptions);
}).then(function() {
return unzip(cacheFile, cacheedPath, unpackagingCmd[process.platform]);
}).then(function() {
Expand Down Expand Up @@ -357,7 +357,7 @@ getApmPath = function() {
}
};

download = function(cacheFile, cachePath, version, cacheZip, token) {
download = function(cacheFile, cachePath, version, cacheZip, token, requestOptions) {
if (isFile(cacheFile)) {
util.log(PLUGIN_NAME, "download skip: already exists");
return Promise.resolve();
Expand All @@ -371,7 +371,8 @@ download = function(cacheFile, cachePath, version, cacheZip, token) {
repo: 'atom/electron',
tag: version,
name: cacheZip,
token: token
token: token,
requestOptions: requestOptions
}).on('error', function(error) {
throw new PluginError(PLUGIN_NAME, error);
}).on('size', function(size) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"chalk": "^1.1.3",
"decompress-zip": "^0.3.0",
"fs-extra": "^0.26.7",
"grs": "^0.1.3",
"grs": "^0.2.0",
"gulp-coffeelint": "^0.6.0",
"gulp-util": "^3.0.7",
"mv": "^2.1.1",
Expand Down