Skip to content

Commit

Permalink
pubsub refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenplusplus committed Sep 30, 2014
1 parent 4e6f384 commit 905e1c0
Show file tree
Hide file tree
Showing 17 changed files with 3,128 additions and 626 deletions.
20 changes: 20 additions & 0 deletions docs/components/docs/docs-services.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
angular.module('gcloud.docs')
.factory('getLinks', function(pages, versions) {
return function(version) {
var baseUrl = '#/docs/' + version;
var VERSIONS = pages.VERSIONS;
if (!version || version === 'master') {
var versions = Object.keys(VERSIONS);
match = versions[versions.length - 1];
} else {
match = Object.keys(VERSIONS).filter(semver.satisfies.bind(null, version))[0];
}
return VERSIONS[match]
.map(function(module) {
if (pages[module]._url) {
pages[module].url = pages[module]._url.replace('{baseUrl}', baseUrl);
}
return pages[module];
});
};
});
50 changes: 50 additions & 0 deletions docs/components/docs/docs-values.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
angular.module('gcloud.docs')
.value('pages', {
gcloud: {
title: 'gcloud',
_url: '{baseUrl}'
},

datastore: {
title: 'Datastore',
_url: '{baseUrl}/datastore',
pages: [
{
title: 'Dataset',
url: '/dataset'
},
{
title: 'Query',
url: '/query'
}
]
},

pubsub: {
title: 'PubSub',
_url: '{baseUrl}/pubsub',
pages: [
{
title: 'Topic',
url: '/topic'
},
{
title: 'Subscription',
url: '/subscription'
}
]
},

storage: {
title: 'Storage',
_url: '{baseUrl}/storage'
},

VERSIONS: {
// Give a version with/without a comparator, anything semver:
// https://github.com/npm/node-semver#versions
// List should be in ascending order.
'<=0.7.1': ['gcloud', 'datastore', 'storage'],
'>0.7.1': ['gcloud', 'datastore', 'pubsub', 'storage']
}
});
25 changes: 19 additions & 6 deletions docs/components/docs/docs.html
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,21 @@ <h3>Datastore Overview</h3>
</p>
</article>

<article ng-if="isActiveDoc('pubsub')">
<h3>Pub/Sub Overview</h3>
<p>
The <code>gcloud.pubsub</code> method will return a <code>pubsub</code> object, allowing you to create topics, publish messages, subscribe to topics, and more. See the <a href="https://developers.google.com/pubsub/overview">Google Cloud Pub/Sub overview</a> for more information.
</p>
<div hljs>
var pubsub = gcloud.pubsub({
projectId: 'myProject',
keyFilename: '/path/to/keyfile.json'
});</div>
<p>
See the examples below, which demonstrate everything from creating a topic to subscribing to messages on a topic.
</p>
</article>

<article ng-if="isActiveDoc('storage')">
<h3>Storage Overview</h3>
<p>
Expand All @@ -98,8 +113,7 @@ <h2 ng-if="method.name[0].toUpperCase() === method.name[0]">
ng-if="method.name[0].toUpperCase() !== method.name[0]">
<a
class="permalink"
ng-if="!noPermalink"
ng-href="{{activeUrl + '/' + method.name}}">#</a>
ng-href="{{activeUrl + '?method=' + method.name}}">#</a>
{{method.name}}
</h3>
<p ng-if="method.description" ng-bind-html="method.description"></p>
Expand All @@ -118,9 +132,8 @@ <h4 ng-show="method.params">Parameters</h4>
<h4 ng-show="method.returns">Returns</h4>
<p ng-show="method.returns" ng-bind-html="method.returns"></p>
<h4 ng-show="method.example">Example</h4>
<div ng-repeat-end
ng-show="method.example"
hljs source="method.example" language="js"></div>
<div docs-example ng-repeat-end
ng-show="method.example" ng-bind-html="method.example"></div>
<hr ng-if="$index < methods.length - 1">
</article>
</article>
Expand All @@ -135,7 +148,7 @@ <h4 ng-show="method.example">Example</h4>

<nav class="side-nav">
<ul class="page-sections" ng-show="showReference">
<li ng-repeat="page in pages">
<li ng-repeat="page in links">
<a
ng-class="{ current: isActiveUrl(page.url) }"
ng-href="{{page.url}}">
Expand Down
Loading

0 comments on commit 905e1c0

Please sign in to comment.