diff --git a/docs/components/docs/docs-directives.js b/docs/components/docs/docs-directives.js new file mode 100644 index 00000000000..0295fb30f33 --- /dev/null +++ b/docs/components/docs/docs-directives.js @@ -0,0 +1,12 @@ +angular.module('gcloud.docs') + .directive('docsExample', function($compile) { + 'use strict'; + + return { + link: function(scope, element, attr) { + scope.$watch(attr.ngBindHtml, function() { + $compile(element.contents())(scope); + }, true); + } + }; + }); diff --git a/docs/components/docs/docs-services.js b/docs/components/docs/docs-services.js new file mode 100644 index 00000000000..e4dd9847722 --- /dev/null +++ b/docs/components/docs/docs-services.js @@ -0,0 +1,24 @@ +angular.module('gcloud.docs') + .factory('getLinks', function(pages) { + 'use strict'; + + return function(version) { + var baseUrl = '#/docs/' + version; + var VERSIONS = pages.VERSIONS; + var versions; + var match; + if (!version || version === 'master') { + 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 00000000000..fc3f9952daa --- /dev/null +++ b/docs/components/docs/docs-values.js @@ -0,0 +1,54 @@ +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' + } + ] + }, + + datastoreWithTransaction: { + title: 'Datastore', + _url: '{baseUrl}/datastore', + pages: [ + { + title: 'Dataset', + url: '/dataset' + }, + { + title: 'Transaction', + url: '/transaction' + }, + { + title: 'Query', + url: '/query' + } + ] + }, + + 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', 'datastoreWithTransaction', 'storage'] + } + }); diff --git a/docs/components/docs/docs.html b/docs/components/docs/docs.html index be0e1e0d3f5..eb6ead22cab 100644 --- a/docs/components/docs/docs.html +++ b/docs/components/docs/docs.html @@ -45,13 +45,13 @@

However, if you're running your app elsewhere, you will need to provide this information.

- // App Engine and Compute Engine - var gcloud = require('gcloud'); +// App Engine and Compute Engine +var gcloud = require('gcloud'); - // Elsewhere - var gcloud = require('gcloud')({ - keyFilename: '/path/to/keyfile.json' - });
+// Elsewhere +var gcloud = require('gcloud')({ + keyFilename: '/path/to/keyfile.json' +});

In any environment, you are free to provide these and other default properties, which eventually will be passed to the gcloud sub-modules (Datastore, Storage, etc.).

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

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

@@ -118,9 +117,8 @@

Parameters

Returns

Example

-
+

@@ -135,7 +133,7 @@

Example