Skip to content

Commit

Permalink
Merge pull request #617 from stephenplusplus/spp--docs-fix-auth-example
Browse files Browse the repository at this point in the history
docs: switch homepage example to GCS
  • Loading branch information
ryanseys committed May 20, 2015
2 parents 5dbb86a + e5e8934 commit 5071ea4
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 24 deletions.
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) {
// 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();

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

0 comments on commit 5071ea4

Please sign in to comment.