diff --git a/docs/components/docs/docs-services.js b/docs/components/docs/docs-services.js new file mode 100644 index 000000000000..6df728e744e0 --- /dev/null +++ b/docs/components/docs/docs-services.js @@ -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]; + }); + }; + }); diff --git a/docs/components/docs/docs-values.js b/docs/components/docs/docs-values.js new file mode 100644 index 000000000000..8eda76b49ba3 --- /dev/null +++ b/docs/components/docs/docs-values.js @@ -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'] + } + }); diff --git a/docs/components/docs/docs.html b/docs/components/docs/docs.html index be0e1e0d3f5a..7cd950d59738 100644 --- a/docs/components/docs/docs.html +++ b/docs/components/docs/docs.html @@ -73,6 +73,21 @@

Datastore Overview

+
+

Pub/Sub Overview

+

+ The gcloud.pubsub method will return a pubsub object, allowing you to create topics, publish messages, subscribe to topics, and more. See the Google Cloud Pub/Sub overview for more information. +

+
+var pubsub = gcloud.pubsub({ + projectId: 'myProject', + keyFilename: '/path/to/keyfile.json' +});
+

+ See the examples below, which demonstrate everything from creating a topic to subscribing to messages on a topic. +

+
+

Storage Overview

@@ -98,8 +113,7 @@

ng-if="method.name[0].toUpperCase() !== method.name[0]"> + ng-href="{{activeUrl + '?method=' + method.name}}"># {{method.name}}

@@ -118,9 +132,8 @@

Parameters

Returns

Example

-
+

@@ -135,7 +148,7 @@

Example