Skip to content

Commit 8f5fbcb

Browse files
committed
Merge pull request #220 from silvolu/versioned-docs
feat(docs): versioned docs
2 parents 44c9088 + 99b71f8 commit 8f5fbcb

File tree

11 files changed

+207
-121
lines changed

11 files changed

+207
-121
lines changed

docs/components/docs/docs.html

Lines changed: 120 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,19 @@ <h1 class="logo">
99

1010
<article class="main lang-page" role="main">
1111
<header class="docs-header">
12-
<h1 class="page-title">Node.js</h1>
12+
<h1 class="page-title">{{pageTitle}}</h1>
13+
14+
<div class="versions" ng-show="showReference">
15+
<span class="v-current">{{version}} <i ng-if="isLatestVersion">(Latest version)</i></span>
16+
<a href="#/docs/history" class="v-btn">
17+
<img src="img/icon-arrow-bullet.svg" />
18+
See version History
19+
</a>
20+
</div><!-- end of .versions -->
1321
</header>
1422

1523
<section class="content">
24+
<article ng-show="showReference">
1625
<h1>{{module[0].toUpperCase() + module.substr(1)}}</h1>
1726
<h3 class="sub-heading">
1827
<div class="toggler" ng-click="showGcloudDocs = !showGcloudDocs">
@@ -21,107 +30,130 @@ <h3 class="sub-heading">
2130
</div>
2231
Getting Started with <code>gcloud</code>
2332
</h3>
24-
<article ng-if="showGcloudDocs">
25-
<p>
26-
First, install <code>gcloud</code> with npm and require it into your project:
27-
</p>
28-
<div hljs>$ npm install --save gcloud</div>
29-
<div hljs>var gcloud = require('gcloud');</div>
30-
<p>
31-
There are a couple of ways to use the <code>gcloud</code> module.
32-
</p>
33-
<p>
34-
If you are running your app on Google App Engine or Google Compute Engine, you won't need to worry about supplying connection configuration options to <code>gcloud</code>&mdash; we figure that out for you.
35-
</p>
36-
<p>
37-
However, if you're running your app elsewhere, you will need to provide this information.
38-
</p>
39-
<div hljs>
40-
// App Engine and Compute Engine
41-
var gcloud = require('gcloud');
33+
<article ng-if="showGcloudDocs">
34+
<h1>{{module[0].toUpperCase() + module.substr(1)}}</h1>
35+
<p>
36+
First, install <code>gcloud</code> with npm and require it into your project:
37+
</p>
38+
<div hljs>$ npm install --save gcloud</div>
39+
<div hljs>var gcloud = require('gcloud');</div>
40+
<p>
41+
There are a couple of ways to use the <code>gcloud</code> module.
42+
</p>
43+
<p>
44+
If you are running your app on Google App Engine or Google Compute Engine, you won't need to worry about supplying connection configuration options to <code>gcloud</code>&mdash; we figure that out for you.
45+
</p>
46+
<p>
47+
However, if you're running your app elsewhere, you will need to provide this information.
48+
</p>
49+
<div hljs>
50+
// App Engine and Compute Engine
51+
var gcloud = require('gcloud');
4252

43-
// Elsewhere
44-
var gcloud = require('gcloud')({
45-
keyFilename: '/path/to/keyfile.json'
46-
});</div>
47-
<p>
48-
In any environment, you are free to provide these and other default properties, which eventually will be passed to the <code>gcloud</code> sub-modules (Datastore, Storage, etc.).
49-
</p>
50-
</article>
51-
<hr>
52-
<article ng-if="isActiveDoc('datastore')">
53-
<h2>Overview</h2>
54-
<p>
55-
The <code>gcloud.datastore</code> object gives you some convenience methods, as well as exposes a <code>dataset</code> function. This will allow you to create a <code>dataset</code>, which is the object from which you will interact with the Google Cloud Datastore.
56-
</p>
57-
<div hljs>
58-
var datastore = gcloud.datastore;
59-
var dataset = datastore.dataset({
60-
projectId: 'myProject',
61-
keyFilename: '/path/to/keyfile.json'
62-
});</div>
63-
<p ng-if="!isActiveUrl('/docs/datastore/dataset')">
64-
See <a href="#/docs/datastore/dataset">the Dataset documentation</a> for examples of how to query the datastore, save entities, run a transaction, and others.
65-
</p>
66-
</article>
67-
<article ng-if="isActiveDoc('storage')">
68-
<h2>Overview</h2>
69-
<p>
70-
The <code>gcloud.storage</code> object contains a <code>bucket</code> object, which is how you will interact with your Google Cloud Storage bucket. See the guide on <a href="https://developers.google.com/storage">Google Cloud Storage</a> to create a bucket.
71-
</p>
72-
<p>
73-
See examples below for more on how to access your bucket to upload a file, read its files, create signed URLs, and more.
74-
</p>
75-
</article>
53+
// Elsewhere
54+
var gcloud = require('gcloud')({
55+
keyFilename: '/path/to/keyfile.json'
56+
});</div>
57+
<p>
58+
In any environment, you are free to provide these and other default properties, which eventually will be passed to the <code>gcloud</code> sub-modules (Datastore, Storage, etc.).
59+
</p>
60+
</article>
61+
<hr>
62+
<article ng-if="isActiveDoc('datastore')">
63+
<h2>Overview</h2>
64+
<p>
65+
The <code>gcloud.datastore</code> object gives you some convenience methods, as well as exposes a <code>dataset</code> function. This will allow you to create a <code>dataset</code>, which is the object from which you will interact with the Google Cloud Datastore.
66+
</p>
67+
<div hljs>
68+
var datastore = gcloud.datastore;
69+
var dataset = datastore.dataset({
70+
projectId: 'myProject',
71+
keyFilename: '/path/to/keyfile.json'
72+
</div>
73+
<p ng-if="!isActiveUrl('/docs/datastore/dataset')">
74+
See <a href="#/docs/{{version}}/datastore/dataset">the Dataset documentation</a> for examples of how to query the datastore, save entities, run a transaction, and others.
75+
</p>
76+
</article>
7677

77-
<article
78-
ng-repeat="method in methods"
79-
ng-hide="singleMethod && method.name !== singleMethod">
80-
<h2 ng-if="method.name[0].toUpperCase() === method.name[0]">
81-
{{method.name}}
82-
</h2>
83-
<h3
84-
class="method-heading"
85-
ng-if="method.name[0].toUpperCase() !== method.name[0]">
86-
<a
87-
class="permalink"
88-
ng-if="!noPermalink"
89-
ng-href="{{activeUrl + '/' + method.name}}">#</a>
90-
{{method.name}}
91-
</h3>
92-
<p ng-if="method.description" ng-bind-html="method.description"></p>
93-
<h4 ng-show="method.params">Parameters</h4>
94-
<table class="table" ng-show="method.params">
95-
<tbody>
96-
<tr ng-repeat="param in method.params">
97-
<th scope="row">{{param.name}}</th>
98-
<td ng-bind-html="param.types"></td>
99-
<td ng-bind-html="param.description"></td>
100-
</tr>
101-
</tbody>
102-
</table>
103-
<h4 ng-show="method.returns">Returns</h4>
104-
<p ng-show="method.returns" ng-bind-html="method.returns"></p>
105-
<h4 ng-show="method.example">Example</h4>
106-
<div ng-repeat-end
107-
ng-show="method.example"
108-
hljs source="method.example" language="js"></div>
109-
<hr ng-if="$index < methods.length - 1">
78+
<article ng-if="isActiveDoc('storage')">
79+
<p>
80+
The <code>gcloud.storage</code> object contains a <code>Bucket</code> object, which is how you will interact with your Google Cloud Storage bucket.
81+
</p>
82+
<div hljs>
83+
var storage = gcloud.storage;
84+
var bucket = new storage.Bucket({
85+
bucketName: 'MyBucket'
86+
});</div>
87+
<p ng-if="!isActiveUrl('/docs/datastore/dataset')">
88+
See <a href="#/docs/datastore/dataset">the Dataset documentation</a> for examples of how to query the datastore, save entities, run a transaction, and others.
89+
</p>
90+
</article>
91+
<article ng-if="isActiveDoc('storage')">
92+
<h2>Overview</h2>
93+
<p>
94+
The <code>gcloud.storage</code> object contains a <code>bucket</code> object, which is how you will interact with your Google Cloud Storage bucket. See the guide on <a href="https://developers.google.com/storage">Google Cloud Storage</a> to create a bucket.
95+
</p>
96+
<p>
97+
See examples below for more on how to access your bucket to upload a file, read its files, create signed URLs, and more.
98+
</p>
99+
</article>
100+
101+
<article
102+
ng-repeat="method in methods"
103+
ng-hide="singleMethod && method.name !== singleMethod">
104+
<h2 ng-if="method.name[0].toUpperCase() === method.name[0]">
105+
{{method.name}}
106+
</h2>
107+
<h3
108+
class="method-heading"
109+
ng-if="method.name[0].toUpperCase() !== method.name[0]">
110+
<a
111+
class="permalink"
112+
ng-if="!noPermalink"
113+
ng-href="{{activeUrl + '/' + method.name}}">#</a>
114+
{{method.name}}
115+
</h3>
116+
<p ng-if="method.description" ng-bind-html="method.description"></p>
117+
<h4 ng-show="method.params">Parameters</h4>
118+
<table class="table" ng-show="method.params">
119+
<tbody>
120+
<tr ng-repeat="param in method.params">
121+
<th scope="row">{{param.name}}</th>
122+
<td ng-bind-html="param.types"></td>
123+
<td ng-bind-html="param.description"></td>
124+
</tr>
125+
</tbody>
126+
</table>
127+
<h4 ng-show="method.returns">Returns</h4>
128+
<p ng-show="method.returns" ng-bind-html="method.returns"></p>
129+
<h4 ng-show="method.example">Example</h4>
130+
<div ng-repeat-end
131+
ng-show="method.example"
132+
hljs source="method.example" language="js"></div>
133+
<hr ng-if="$index < methods.length - 1">
134+
</article>
135+
</article>
136+
<article ng-show="showHistory">
137+
<ul class="v-list">
138+
<li ng-repeat="version in versions">
139+
<a ng-href="#/docs/{{version}}">{{version}}</a>
140+
</li>
141+
</ul>
110142
</article>
111143
</section><!-- end of .content -->
112144

113145
<nav class="side-nav">
114-
<ul class="page-sections">
146+
<ul class="page-sections" ng-show="showReference">
115147
<li ng-repeat="page in pages">
116148
<a
117-
ng-class="{ current: isActiveUrl(page.url) }"
149+
ng-class="{ current: docs.isActiveUrl(page.url) }"
118150
ng-href="{{page.url}}">
119151
{{page.title}}
120152
</a>
121153
<ul class="sub-sections" ng-if="page.pages">
122154
<li ng-repeat="innerPage in page.pages">
123155
<a
124-
ng-class="{ current: isActiveUrl(page.url + innerPage.url) }"
156+
ng-class="{ current: docs.isActiveUrl(page.url + innerPage.url) }"
125157
ng-href="{{page.url + innerPage.url}}">
126158
{{innerPage.title}}
127159
</a>

0 commit comments

Comments
 (0)