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

docs: switch homepage example to GCS #617

Merged
Merged
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
22 changes: 10 additions & 12 deletions docs/site/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,6 @@ body {
========================================================================== */

pre {
border: 1px solid rgba(0,0,0,0.2);
/* Border Radius */
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
background: #fff;
font-size: 0.9em;
line-height: 1.6em;
Expand Down Expand Up @@ -645,7 +640,7 @@ ul {
}

.about h4 {
margin-bottom: 0;
margin: 0;
font-size: 1.2em;
font-weight: bold;
color: #4285f4;
Expand All @@ -659,22 +654,25 @@ ul {
.about .code-sample-tabs a {
display: inline-block;
padding: 2px 12px 0px 12px;
border: 1px solid rgba(0,0,0,0.2);
background-color: #fefefe;
margin-bottom: -3px;
background-color: #f8f8f8;
margin-right: 8px;
color: #333;
text-decoration: none;
}

.about .code-sample-tabs a.selected {
background-color: #f8f8f8;
background-color: #fff;
font-weight: bold;
border-bottom-color: #f8f8f8;
}

.about pre {
margin-top: 0;
padding: 8px;
margin-top: 0;
}

.about .hljs {
background-color: #fff;
font-size: .9em;
}

/*
Expand Down
33 changes: 21 additions & 12 deletions docs/site/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ <h3 class="block-title">What is it?</h3>
</div>

<div class="quote-box--supplementary">
<h4>Example: Retrieve an entity from Cloud Datastore</h4>
<h4>Example: Upload a file to Cloud Storage</h4>

<div class="code-sample-tabs" ng-init="selected = 'compute engine'">
<a ng-click="selected = 'compute engine'"
Expand All @@ -96,26 +96,35 @@ <h4>Example: Retrieve an entity from Cloud Datastore</h4>
</div>

<div hljs language="js" ng-show="selected == 'compute engine'">
// Auth is handled automatically inside GCE.
var gcloud = require('gcloud');
var dataset = gcloud.datastore.dataset();
var productKey = dataset.key(['Product', 123]);
// Authentication is automatic
// inside Google Compute Engine.
var gcloud = require('gcloud')({
projectId: 'grape-spaceship-123'
});

var gcs = gcloud.storage();

dataset.get(productKey, function(err, entity) {
console.log(err, entity);
var backups = gcs.bucket('backups');
backups.upload('db.zip', function(err, file) {

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

// file.createReadStream();
// file.getMetadata();
// ...
});</div>

<div hljs language="js" ng-show="selected == 'elsewhere'">
var gcloud = require('gcloud')({
projectId: 'my-project',
projectId: 'grape-spaceship-123',
// Specify a path to a keyfile.
keyFilename: '/path/to/keyfile.json'
});

var dataset = gcloud.datastore.dataset();
var productKey = dataset.key(['Product', 123]);
var gcs = gcloud.storage();

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.


dataset.get(productKey, function(err, entity) {
console.log(err, entity);
var backups = gcs.bucket('backups');
backups.upload('db.zip', function(err, file) {
// file.createReadStream();
// file.getMetadata();
// ...
});</div>

</div>
Expand Down