Skip to content

Commit

Permalink
Update libraries + make images public (GoogleCloudPlatform#109)
Browse files Browse the repository at this point in the history
* Add missing scripts

* Update renamed dependencies

* Update storage to use public links
  • Loading branch information
Ace Nassri authored Apr 28, 2017
1 parent 2e717eb commit 9c3eb49
Show file tree
Hide file tree
Showing 17 changed files with 48 additions and 34 deletions.
6 changes: 4 additions & 2 deletions 3-binary-data/lib/images.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,10 @@ function sendUploadToGCS (req, res, next) {

stream.on('finish', () => {
req.file.cloudStorageObject = gcsname;
req.file.cloudStoragePublicUrl = getPublicUrl(gcsname);
next();
file.makePublic().then(() => {
req.file.cloudStoragePublicUrl = getPublicUrl(gcsname);
next();
});
});

stream.end(req.file.buffer);
Expand Down
6 changes: 4 additions & 2 deletions 4-auth/lib/images.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,10 @@ function sendUploadToGCS (req, res, next) {

stream.on('finish', () => {
req.file.cloudStorageObject = gcsname;
req.file.cloudStoragePublicUrl = getPublicUrl(gcsname);
next();
file.makePublic().then(() => {
req.file.cloudStoragePublicUrl = getPublicUrl(gcsname);
next();
});
});

stream.end(req.file.buffer);
Expand Down
4 changes: 2 additions & 2 deletions 5-logging/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
// [START debug]
// Activate Google Cloud Trace and Debug when in production
if (process.env.NODE_ENV === 'production') {
require('@google/cloud-trace').start();
require('@google/cloud-debug').start();
require('@google-cloud/trace-agent').start();
require('@google-cloud/debug-agent').start();
}
// [END debug]

Expand Down
6 changes: 4 additions & 2 deletions 5-logging/lib/images.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,10 @@ function sendUploadToGCS (req, res, next) {

stream.on('finish', () => {
req.file.cloudStorageObject = gcsname;
req.file.cloudStoragePublicUrl = getPublicUrl(gcsname);
next();
file.makePublic().then(() => {
req.file.cloudStoragePublicUrl = getPublicUrl(gcsname);
next();
});
});

stream.end(req.file.buffer);
Expand Down
4 changes: 2 additions & 2 deletions 6-pubsub/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@

// Activate Google Cloud Trace and Debug when in production
if (process.env.NODE_ENV === 'production') {
require('@google/cloud-trace').start();
require('@google/cloud-debug').start();
require('@google-cloud/trace-agent').start();
require('@google-cloud/debug-agent').start();
}

const path = require('path');
Expand Down
6 changes: 4 additions & 2 deletions 6-pubsub/lib/images.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,10 @@ function sendUploadToGCS (req, res, next) {

stream.on('finish', () => {
req.file.cloudStorageObject = gcsname;
req.file.cloudStoragePublicUrl = getPublicUrl(gcsname);
next();
file.makePublic().then(() => {
req.file.cloudStoragePublicUrl = getPublicUrl(gcsname);
next();
});
});

stream.end(req.file.buffer);
Expand Down
4 changes: 2 additions & 2 deletions 6-pubsub/test/worker.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ test.serial.cb(`should process a book`, (t) => {
};
const stubs = {
'./lib/logging': loggingStub,
'@google/cloud-trace': {
'@google-cloud/trace-agent': {
start: sinon.stub(),
'@noCallThru': true
},
'@google/cloud-debug': {
'@google-cloud/debug-agent': {
'@noCallThru': true
}
};
Expand Down
4 changes: 2 additions & 2 deletions 6-pubsub/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@

// Activate Google Cloud Trace and Debug when in production
if (process.env.NODE_ENV === 'production') {
require('@google/cloud-trace').start();
require('@google/cloud-debug').start();
require('@google-cloud/trace-agent').start();
require('@google-cloud/debug-agent').start();
}

const request = require('request');
Expand Down
4 changes: 2 additions & 2 deletions 7-gce/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@

// Activate Google Cloud Trace and Debug when in production
if (process.env.NODE_ENV === 'production') {
require('@google/cloud-trace').start();
require('@google/cloud-debug').start();
require('@google-cloud/trace-agent').start();
require('@google-cloud/debug-agent').start();
}

const path = require('path');
Expand Down
6 changes: 4 additions & 2 deletions 7-gce/lib/images.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,10 @@ function sendUploadToGCS (req, res, next) {

stream.on('finish', () => {
req.file.cloudStorageObject = gcsname;
req.file.cloudStoragePublicUrl = getPublicUrl(gcsname);
next();
file.makePublic().then(() => {
req.file.cloudStoragePublicUrl = getPublicUrl(gcsname);
next();
});
});

stream.end(req.file.buffer);
Expand Down
4 changes: 2 additions & 2 deletions 7-gce/test/worker.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ test.serial.cb(`should process a book`, (t) => {
};
const stubs = {
'./lib/logging': loggingStub,
'@google/cloud-trace': {
'@google-cloud/trace-agent': {
start: sinon.stub(),
'@noCallThru': true
},
'@google/cloud-debug': {
'@google-cloud/debug-agent': {
'@noCallThru': true
}
};
Expand Down
4 changes: 2 additions & 2 deletions 7-gce/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@

// Activate Google Cloud Trace and Debug when in production
if (process.env.NODE_ENV === 'production') {
require('@google/cloud-trace').start();
require('@google/cloud-debug').start();
require('@google-cloud/trace-agent').start();
require('@google-cloud/debug-agent').start();
}

const request = require('request');
Expand Down
4 changes: 2 additions & 2 deletions optional-container-engine/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@

// Activate Google Cloud Trace and Debug when in production
if (process.env.NODE_ENV === 'production') {
require('@google/cloud-trace').start();
require('@google/cloud-debug').start();
require('@google-cloud/trace-agent').start();
require('@google-cloud/debug-agent').start();
}

const path = require('path');
Expand Down
6 changes: 4 additions & 2 deletions optional-container-engine/lib/images.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,10 @@ function sendUploadToGCS (req, res, next) {

stream.on('finish', () => {
req.file.cloudStorageObject = gcsname;
req.file.cloudStoragePublicUrl = getPublicUrl(gcsname);
next();
file.makePublic().then(() => {
req.file.cloudStoragePublicUrl = getPublicUrl(gcsname);
next();
});
});

stream.end(req.file.buffer);
Expand Down
4 changes: 2 additions & 2 deletions optional-container-engine/test/worker.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ test.serial.cb(`should process a book`, (t) => {
};
const stubs = {
'./lib/logging': loggingStub,
'@google/cloud-trace': {
'@google-cloud/trace-agent': {
start: sinon.stub(),
'@noCallThru': true
},
'@google/cloud-debug': {
'@google-cloud/debug-agent': {
'@noCallThru': true
}
};
Expand Down
4 changes: 2 additions & 2 deletions optional-container-engine/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@

// Activate Google Cloud Trace and Debug when in production
if (process.env.NODE_ENV === 'production') {
require('@google/cloud-trace').start();
require('@google/cloud-debug');
require('@google-cloud/trace-agent').start();
require('@google-cloud/debug-agent');
}

const request = require('request');
Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@
"private": true,
"scripts": {
"lint": "semistandard \"**/*.js\"",
"test": "ava -s -t 30s --tap **/*.test.js | tap-dot",
"ava": "ava -s -t 30s --tap **/*.test.js | tap-dot",
"test": "npm run lint && npm run ava",
"cover": "nyc --cache npm test; nyc report --reporter=html",
"e2e": "mocha test/e2e.js -t 1800000"
"e2e": "mocha test/e2e.js -t 1800000",
"unify": "node scripts/unify"
},
"author": "Google Inc.",
"contributors": [
Expand Down

0 comments on commit 9c3eb49

Please sign in to comment.