grunt-cloudfile-to-vocab
Advanced tools
Comparing version 1.0.1 to 1.0.2
{ | ||
"name": "grunt-cloudfile-to-vocab", | ||
"description": "Takes vocab data from cloud spreadsheets and renders it into local json files.", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"homepage": "http://github.com/BBCVisualJournalism/grunt-cloudfile-to-vocab.git", | ||
@@ -6,0 +6,0 @@ "contributors": [{ |
@@ -1,2 +0,2 @@ | ||
[![Build Status](https://travis-ci.org/BBCVisualJournalism/grunt-cloudfile-to-vocab.svg?branch=fix_tests)](https://travis-ci.org/BBCVisualJournalism/grunt-cloudfile-to-vocab) | ||
[![NPM](https://nodei.co/npm/grunt-cloudfile-to-vocab.png?compact=true)](https://www.npmjs.com/package/grunt-cloudfile-to-vocab) [![Build Status](https://travis-ci.org/BBCVisualJournalism/grunt-cloudfile-to-vocab.svg?branch=fix_tests)](https://travis-ci.org/BBCVisualJournalism/grunt-cloudfile-to-vocab) | ||
@@ -3,0 +3,0 @@ cloudfile_to_vocab |
@@ -178,6 +178,7 @@ 'use strict'; | ||
if (!opts.username || !opts.password) { | ||
this.throwError('Google spreadsheets require username and password values in the options'); | ||
} | ||
else if (!opts.worksheets || opts.worksheets.length === 0) { | ||
if (opts.username || opts.password) { | ||
this.throwError('Google has made changes to their API, and plain text passwords are no longer accepted. Please use a certificate instead.'); | ||
} else if (!opts.serviceEmail || !opts.certLocation) { | ||
this.throwError('You must provide a certificate location (certLocation) and service email address (serviceEmail).'); | ||
} else if (!opts.worksheets || opts.worksheets.length === 0) { | ||
this.throwError('You must specify at least one worksheet ID to process'); | ||
@@ -214,6 +215,7 @@ } | ||
processGoogleSpreadsheet: function (opts) { | ||
var id = opts.google_spreadsheet_id; | ||
var username = opts.username; | ||
var password = opts.password; | ||
this.worksheets = opts.worksheets; | ||
var id = opts.google_spreadsheet_id; | ||
var serviceEmail = opts.serviceEmail; | ||
var certLocation = opts.certLocation; | ||
this.worksheets = opts.worksheets; | ||
this.setupGoogleSpreadsheetService(opts); | ||
@@ -223,3 +225,3 @@ | ||
this.forEachWorksheet(function (worksheet) { | ||
this.getFileFromGoogle(id, worksheet, username, password); | ||
this.getFileFromGoogle(id, worksheet, serviceEmail, certLocation); | ||
}.bind(this)); | ||
@@ -252,8 +254,10 @@ | ||
getFileFromGoogle: function (id, worksheet, username, password) { | ||
getFileFromGoogle: function (id, worksheet, serviceEmail, certFile) { | ||
var that = this; | ||
this.googleSpreadsheetService.create({ | ||
debug: true, | ||
username: username, | ||
password: password, | ||
oauth : { | ||
email: serviceEmail, | ||
keyFile: certFile | ||
}, | ||
spreadsheetName: 'node-edit-spreadsheet', | ||
@@ -461,2 +465,2 @@ worksheetName: worksheet, | ||
}; | ||
}; |
@@ -236,4 +236,4 @@ 'use strict'; | ||
message, | ||
'Google spreadsheets require username and password values in the options', | ||
'should warn if a google URL is used without a username and password' | ||
'You must provide a certificate location (certLocation) and service email address (serviceEmail).', | ||
'should warn if a google URL is used without a certLocation and serviceEmail' | ||
); | ||
@@ -249,3 +249,3 @@ }; | ||
Error, | ||
'should error if a google URL is used without a username and password' | ||
'should error if a google URL is used with a username and password' | ||
); | ||
@@ -259,9 +259,9 @@ test.done(); | ||
var spreadsheet_id = '123456789', | ||
username = 'tom', | ||
password = 'super secret', | ||
serviceEmail = 'awesome-email@lycos.com', | ||
certLocation = '/some/secret/path', | ||
fake_service = { | ||
create: function(opts) { | ||
test.equal(opts.spreadsheetId, spreadsheet_id, 'should pass through the correct spreadsheet ID'); | ||
test.equal(opts.username, username, 'should pass through the correct username'); | ||
test.equal(opts.password, password, 'should pass through the correct password'); | ||
test.equal(opts.oauth.email, serviceEmail, 'should pass through the correct serviceEmail'); | ||
test.equal(opts.oauth.keyFile, certLocation, 'should pass through the correct certLocation'); | ||
test.done(); | ||
@@ -273,4 +273,4 @@ } | ||
google_spreadsheet_id: spreadsheet_id, | ||
username: username, | ||
password: password, | ||
serviceEmail: serviceEmail, | ||
certLocation: certLocation, | ||
fake_google_spreadsheet_service: fake_service | ||
@@ -368,2 +368,2 @@ }); | ||
} | ||
}; | ||
}; |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
84050
802
3