Skip to content

Commit a3a1dbb

Browse files
committed
Merge pull request GoogleCloudPlatform#46 from GoogleCloudPlatform/upgrade
Upgraded all dependencies
2 parents a1d3ffa + 8f81f43 commit a3a1dbb

37 files changed

+258
-288
lines changed

1-hello-world/app.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ var app = express();
2020

2121
// [START hello_world]
2222
// Say hello!
23-
app.get('/', function(req, res) {
23+
app.get('/', function (req, res) {
2424
res.status(200).send('Hello, world!');
2525
});
2626
// [END hello_world]

2-structured-data/books/model-cloudsql.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
var extend = require('lodash').assign;
1717
var mysql = require('mysql');
1818

19-
module.exports = function(config) {
19+
module.exports = function (config) {
2020

2121
function getConnection() {
2222
return mysql.createConnection(extend({
@@ -30,7 +30,7 @@ module.exports = function(config) {
3030
var connection = getConnection();
3131
connection.query(
3232
'SELECT * FROM `books` LIMIT ? OFFSET ?', [limit, token],
33-
function(err, results) {
33+
function (err, results) {
3434
if (err) { return cb(err); }
3535
var hasMore = results.length === limit ? token + results.length : false;
3636
cb(null, results, hasMore);
@@ -43,7 +43,7 @@ module.exports = function(config) {
4343
// [START create]
4444
function create(data, cb) {
4545
var connection = getConnection();
46-
connection.query('INSERT INTO `books` SET ?', data, function(err, res) {
46+
connection.query('INSERT INTO `books` SET ?', data, function (err, res) {
4747
if (err) { return cb(err); }
4848
read(res.insertId, cb);
4949
});
@@ -54,7 +54,7 @@ module.exports = function(config) {
5454
function read(id, cb) {
5555
var connection = getConnection();
5656
connection.query(
57-
'SELECT * FROM `books` WHERE `id` = ?', id, function(err, results) {
57+
'SELECT * FROM `books` WHERE `id` = ?', id, function (err, results) {
5858
if (err) { return cb(err); }
5959
if (!results.length) {
6060
return cb({
@@ -71,7 +71,7 @@ module.exports = function(config) {
7171
function update(id, data, cb) {
7272
var connection = getConnection();
7373
connection.query(
74-
'UPDATE `books` SET ? WHERE `id` = ?', [data, id], function(err) {
74+
'UPDATE `books` SET ? WHERE `id` = ?', [data, id], function (err) {
7575
if (err) { return cb(err); }
7676
read(id, cb);
7777
});
@@ -95,7 +95,6 @@ module.exports = function(config) {
9595
};
9696
};
9797

98-
9998
if (!module.parent) {
10099
var prompt = require('prompt');
101100
prompt.start();
@@ -104,7 +103,7 @@ if (!module.parent) {
104103
'Running this script directly will allow you to initialize your mysql ' +
105104
'database.\n This script will not modify any existing tables.\n');
106105

107-
prompt.get(['host', 'user', 'password'], function(err, result) {
106+
prompt.get(['host', 'user', 'password'], function (err, result) {
108107
if (err) { return; }
109108
createSchema(result);
110109
});
@@ -129,7 +128,7 @@ function createSchema(config) {
129128
'`createdBy` VARCHAR(255) NULL, ' +
130129
'`createdById` VARCHAR(255) NULL, ' +
131130
'PRIMARY KEY (`id`));',
132-
function(err) {
131+
function (err) {
133132
if (err) { throw err; }
134133
console.log('Successfully created schema');
135134
connection.end();

2-structured-data/books/model-datastore.js

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,13 @@
1515

1616
var gcloud = require('gcloud');
1717

18-
19-
module.exports = function(config) {
18+
module.exports = function (config) {
2019

2120
// [START config]
22-
var ds = gcloud.datastore.dataset(config.gcloud);
21+
var ds = gcloud.datastore(config.gcloud);
2322
var kind = 'Book';
2423
// [END config]
2524

26-
2725
// Translates from Datastore's entity format to
2826
// the format expected by the application.
2927
//
@@ -45,7 +43,6 @@ module.exports = function(config) {
4543
return obj.data;
4644
}
4745

48-
4946
// Translates from the application's format to the datastore's
5047
// extended entity property format. It also handles marking any
5148
// specified properties as non-indexed. Does not translate the key.
@@ -72,7 +69,7 @@ module.exports = function(config) {
7269
function toDatastore(obj, nonIndexed) {
7370
nonIndexed = nonIndexed || [];
7471
var results = [];
75-
Object.keys(obj).forEach(function(k) {
72+
Object.keys(obj).forEach(function (k) {
7673
if (obj[k] === undefined) { return; }
7774
results.push({
7875
name: k,
@@ -83,7 +80,6 @@ module.exports = function(config) {
8380
return results;
8481
}
8582

86-
8783
// Lists all books in the Datastore sorted alphabetically by title.
8884
// The ``limit`` argument determines the maximum amount of results to
8985
// return per page. The ``token`` argument allows requesting additional
@@ -95,15 +91,14 @@ module.exports = function(config) {
9591
.order('title')
9692
.start(token);
9793

98-
ds.runQuery(q, function(err, entities, nextQuery) {
94+
ds.runQuery(q, function (err, entities, nextQuery) {
9995
if (err) { return cb(err); }
10096
var hasMore = entities.length === limit ? nextQuery.startVal : false;
10197
cb(null, entities.map(fromDatastore), hasMore);
10298
});
10399
}
104100
// [END list]
105101

106-
107102
// Creates a new book or updates an existing book with new data. The provided
108103
// data is automatically translated into Datastore format. The book will be
109104
// queued for background processing.
@@ -123,18 +118,17 @@ module.exports = function(config) {
123118

124119
ds.save(
125120
entity,
126-
function(err) {
121+
function (err) {
127122
data.id = entity.key.id;
128123
cb(err, err ? null : data);
129124
}
130125
);
131126
}
132127
// [END update]
133128

134-
135129
function read(id, cb) {
136130
var key = ds.key([kind, parseInt(id, 10)]);
137-
ds.get(key, function(err, entity) {
131+
ds.get(key, function (err, entity) {
138132
if (err) { return cb(err); }
139133
if (!entity) {
140134
return cb({
@@ -146,16 +140,14 @@ module.exports = function(config) {
146140
});
147141
}
148142

149-
150143
function _delete(id, cb) {
151144
var key = ds.key([kind, parseInt(id, 10)]);
152145
ds.delete(key, cb);
153146
}
154147

155-
156148
// [START exports]
157149
return {
158-
create: function(data, cb) {
150+
create: function (data, cb) {
159151
update(null, data, cb);
160152
},
161153
read: read,
@@ -164,5 +156,4 @@ module.exports = function(config) {
164156
list: list
165157
};
166158
// [END exports]
167-
168159
};

2-structured-data/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@
3232
"dependencies": {
3333
"body-parser": "^1.15.0",
3434
"express": "^4.13.4",
35-
"gcloud": "^0.28.0",
35+
"gcloud": "^0.30.2",
3636
"jade": "^1.11.0",
37-
"kerberos": "^0.0.18",
38-
"lodash": "^4.5.1",
39-
"mongodb": "^2.1.7",
37+
"kerberos": "^0.0.19",
38+
"lodash": "^4.8.2",
39+
"mongodb": "^2.1.15",
4040
"mysql": "^2.10.2",
4141
"prompt": "^1.0.0"
4242
},

3-binary-data/books/model-cloudsql.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ var extend = require('lodash').assign;
1717
var mysql = require('mysql');
1818

1919

20-
module.exports = function(config) {
20+
module.exports = function (config) {
2121

2222
function getConnection() {
2323
return mysql.createConnection(extend({
@@ -31,7 +31,7 @@ module.exports = function(config) {
3131
var connection = getConnection();
3232
connection.query(
3333
'SELECT * FROM `books` LIMIT ? OFFSET ?', [limit, token],
34-
function(err, results) {
34+
function (err, results) {
3535
if (err) { return cb(err); }
3636
var hasMore = results.length === limit ? token + results.length : false;
3737
cb(null, results, hasMore);
@@ -43,7 +43,7 @@ module.exports = function(config) {
4343

4444
function create(data, cb) {
4545
var connection = getConnection();
46-
connection.query('INSERT INTO `books` SET ?', data, function(err, res) {
46+
connection.query('INSERT INTO `books` SET ?', data, function (err, res) {
4747
if (err) { return cb(err); }
4848
read(res.insertId, cb);
4949
});
@@ -54,7 +54,7 @@ module.exports = function(config) {
5454
function read(id, cb) {
5555
var connection = getConnection();
5656
connection.query(
57-
'SELECT * FROM `books` WHERE `id` = ?', id, function(err, results) {
57+
'SELECT * FROM `books` WHERE `id` = ?', id, function (err, results) {
5858
if (err) { return cb(err); }
5959
if (!results.length) {
6060
return cb({
@@ -71,7 +71,7 @@ module.exports = function(config) {
7171
function update(id, data, cb) {
7272
var connection = getConnection();
7373
connection.query(
74-
'UPDATE `books` SET ? WHERE `id` = ?', [data, id], function(err) {
74+
'UPDATE `books` SET ? WHERE `id` = ?', [data, id], function (err) {
7575
if (err) { return cb(err); }
7676
read(id, cb);
7777
});
@@ -106,7 +106,7 @@ if (!module.parent) {
106106
'Running this script directly will allow you to initialize your mysql ' +
107107
'database.\n This script will not modify any existing tables.\n');
108108

109-
prompt.get(['host', 'user', 'password'], function(err, result) {
109+
prompt.get(['host', 'user', 'password'], function (err, result) {
110110
if (err) { return; }
111111
createSchema(result);
112112
});
@@ -132,7 +132,7 @@ function createSchema(config) {
132132
'`createdBy` VARCHAR(255) NULL, ' +
133133
'`createdById` VARCHAR(255) NULL, ' +
134134
'PRIMARY KEY (`id`));',
135-
function(err) {
135+
function (err) {
136136
if (err) { throw err; }
137137
console.log('Successfully created schema');
138138
connection.end();

3-binary-data/books/model-datastore.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
var gcloud = require('gcloud');
1717

1818

19-
module.exports = function(config) {
19+
module.exports = function (config) {
2020

21-
var ds = gcloud.datastore.dataset(config.gcloud);
21+
var ds = gcloud.datastore(config.gcloud);
2222
var kind = 'Book';
2323

2424

@@ -70,7 +70,7 @@ module.exports = function(config) {
7070
function toDatastore(obj, nonIndexed) {
7171
nonIndexed = nonIndexed || [];
7272
var results = [];
73-
Object.keys(obj).forEach(function(k) {
73+
Object.keys(obj).forEach(function (k) {
7474
if (obj[k] === undefined) { return; }
7575
results.push({
7676
name: k,
@@ -92,7 +92,7 @@ module.exports = function(config) {
9292
.order('title')
9393
.start(token);
9494

95-
ds.runQuery(q, function(err, entities, nextQuery) {
95+
ds.runQuery(q, function (err, entities, nextQuery) {
9696
if (err) { return cb(err); }
9797
var hasMore = entities.length === limit ? nextQuery.startVal : false;
9898
cb(null, entities.map(fromDatastore), hasMore);
@@ -118,7 +118,7 @@ module.exports = function(config) {
118118

119119
ds.save(
120120
entity,
121-
function(err) {
121+
function (err) {
122122
data.id = entity.key.id;
123123
cb(err, err ? null : data);
124124
}
@@ -128,7 +128,7 @@ module.exports = function(config) {
128128

129129
function read(id, cb) {
130130
var key = ds.key([kind, parseInt(id, 10)]);
131-
ds.get(key, function(err, entity) {
131+
ds.get(key, function (err, entity) {
132132
if (err) { return cb(err); }
133133
if (!entity) {
134134
return cb({
@@ -148,7 +148,7 @@ module.exports = function(config) {
148148

149149

150150
return {
151-
create: function(data, cb) {
151+
create: function (data, cb) {
152152
update(null, data, cb);
153153
},
154154
read: read,

3-binary-data/lib/images.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
var gcloud = require('gcloud');
1717

1818

19-
module.exports = function(gcloudConfig, cloudStorageBucket) {
19+
module.exports = function (gcloudConfig, cloudStorageBucket) {
2020

2121
var storage = gcloud.storage(gcloudConfig);
2222
var bucket = storage.bucket(cloudStorageBucket);
@@ -46,12 +46,12 @@ module.exports = function(gcloudConfig, cloudStorageBucket) {
4646
var file = bucket.file(gcsname);
4747
var stream = file.createWriteStream();
4848

49-
stream.on('error', function(err) {
49+
stream.on('error', function (err) {
5050
req.file.cloudStorageError = err;
5151
next(err);
5252
});
5353

54-
stream.on('finish', function() {
54+
stream.on('finish', function () {
5555
req.file.cloudStorageObject = gcsname;
5656
req.file.cloudStoragePublicUrl = getPublicUrl(gcsname);
5757
next();
@@ -71,7 +71,7 @@ module.exports = function(gcloudConfig, cloudStorageBucket) {
7171
var multer = require('multer')({
7272
inMemory: true,
7373
fileSize: 5 * 1024 * 1024, // no larger than 5mb
74-
rename: function(fieldname, filename) {
74+
rename: function (fieldname, filename) {
7575
// generate a unique filename
7676
return filename.replace(/\W+/g, '-').toLowerCase() + Date.now();
7777
}

3-binary-data/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@
3232
"dependencies": {
3333
"body-parser": "^1.15.0",
3434
"express": "^4.13.4",
35-
"gcloud": "^0.28.0",
35+
"gcloud": "^0.30.2",
3636
"jade": "^1.11.0",
37-
"kerberos": "^0.0.18",
38-
"lodash": "^4.5.1",
39-
"mongodb": "^2.1.7",
37+
"kerberos": "^0.0.19",
38+
"lodash": "^4.8.2",
39+
"mongodb": "^2.1.15",
4040
"multer": "^1.1.0",
4141
"mysql": "^2.10.2",
4242
"prompt": "^1.0.0"

4-auth/books/crud.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
var express = require('express');
1717

18-
module.exports = function(model, images, oauth2) {
18+
module.exports = function (model, images, oauth2) {
1919

2020
var router = express.Router();
2121

0 commit comments

Comments
 (0)