Skip to content
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
1 change: 0 additions & 1 deletion lib/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ module.exports = {
STORAGE_FILE: getUserHome() + '/.gapps',
CONFIG_NAME: 'gapps.config.json',
WEBSERVER_PORT: 2386,
DOWNLOAD_URL: 'https://script.google.com/feeds/download/export?format=json&id='
};

function getUserHome() {
Expand Down
17 changes: 9 additions & 8 deletions lib/manifestor.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ var colors = require('colors');

var Promise = require('bluebird');
var fs = Promise.promisifyAll(require('fs'));
var request = Promise.promisifyAll(require('request'));
var google = require('googleapis');

var util = require('./util');
var defaults = require('./defaults');
Expand Down Expand Up @@ -67,17 +67,18 @@ function getExternalFiles(fileId) {


function getProjectFiles(fileId, auth) {
var drive = google.drive({ version: 'v3', auth });
var options = {
url: defaults.DOWNLOAD_URL + fileId,
qs : {
'access_token': auth.credentials.access_token
}
fileId,
mimeType: 'application/vnd.google-apps.script+json',
};

return request.getAsync(options)
.spread(function(res, body) {
return JSON.parse(body);
return new Promise(function(resolve, reject) {
drive.files.export(options, (err, res) => {
if (err) return reject(Error(err));
resolve(res);
})
})
.then(function(project) {
if (!project.files) {
throw 'Looks like there are no files associated with this project. Check the id and try again.';
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@
"googleapis": "^2.0.5",
"lodash": "^3.9.3",
"mkdirp": "^0.5.1",
"node-dir": "^0.1.6",
"request": "^2.54.0"
"node-dir": "^0.1.6"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
Expand Down