From c635c29bd2ef74ceb17eb8e782eaf84c746de4ad Mon Sep 17 00:00:00 2001 From: Thomas Schultz Date: Thu, 28 Jul 2016 12:57:46 -0400 Subject: [PATCH] Package docs files for simple deployment. --- docs/json/json/home.html | 130 ++++++++++++++++++++++ docs/json/json/master/home.html | 130 ++++++++++++++++++++++ docs/json/{ => json/master}/index.json | 0 docs/json/{ => json/master}/overview.html | 0 docs/json/{ => json/master}/toc.json | 2 +- scripts/generate_json_docs.py | 43 ++++++- scripts/update_json_docs.sh | 9 +- 7 files changed, 303 insertions(+), 11 deletions(-) create mode 100644 docs/json/json/home.html create mode 100644 docs/json/json/master/home.html rename docs/json/{ => json/master}/index.json (100%) rename docs/json/{ => json/master}/overview.html (100%) rename docs/json/{ => json/master}/toc.json (99%) diff --git a/docs/json/json/home.html b/docs/json/json/home.html new file mode 100644 index 0000000000000..737848b44868a --- /dev/null +++ b/docs/json/json/home.html @@ -0,0 +1,130 @@ +
+
+
+

gcloud-python

+

Google Cloud Client Library for Python + - an idiomatic, intuitive, and natural way for Python developers to + integrate with Google Cloud Platform services, like Cloud Datastore + and Cloud Storage.

+
+ +
+
$ pip install --upgrade gcloud
+

+ Latest Release {{home.latestRelease.name}} + {{home.latestRelease.date|date}} +

+
+
+
+ +
+ +
+ +
+
+
+

What is it?

+ +

gcloud-python is a client library for accessing Google + Cloud Platform services that significantly reduces the boilerplate + code you have to write. The library provides high-level API + abstractions so they're easier to understand. It embraces + idioms of Python, works well with the standard library, and + integrates better with your codebase. + All this means you spend more time creating code that matters + to you.

+ +

gcloud-python is configured to access Google Cloud Platform + services and authorize (OAuth 2.0) automatically on your behalf. + With a one-line install and a private key, you are up and ready + to go. Better yet, if you are running on a Google Compute Engine + instance, the one-line install is enough!

+ +
+ +
+

Retrieve Datastore Entities

+ +
+ from gcloud import datastore + + client = datastore.Client() + product_key = client.key('Product', 123) + print(client.get(product_key)) +
+
+
+
+ +
+
+

Examples

+ + +
+
+ +
+
+

FAQ

+ +

What is the relationship between the gcloud-python package + and the gcloud command-line tool?

+

Both the gcloud command-line tool and + gcloud-python package are a part of the Google Cloud SDK: a collection + of tools and libraries that enable you to easily create and manage + resources on the Google Cloud Platform. The gcloud command-line + tool can be used to manage both your development workflow and your + Google Cloud Platform resources while the gcloud-python package is the + Google Cloud Client Library for Python.

+ +

What is the relationship between gcloud-python + and the Google APIs Python Client?

+

The + Google APIs Python Client is a client library for + using the broad set of Google APIs. + gcloud-python is built specifically for the Google Cloud Platform + and is the recommended way to integrate Google Cloud APIs into your + Python applications. If your application requires both Google Cloud Platform and + other Google APIs, the 2 libraries may be used by your application.

+
+
diff --git a/docs/json/json/master/home.html b/docs/json/json/master/home.html new file mode 100644 index 0000000000000..737848b44868a --- /dev/null +++ b/docs/json/json/master/home.html @@ -0,0 +1,130 @@ +
+
+
+

gcloud-python

+

Google Cloud Client Library for Python + - an idiomatic, intuitive, and natural way for Python developers to + integrate with Google Cloud Platform services, like Cloud Datastore + and Cloud Storage.

+
+ +
+
$ pip install --upgrade gcloud
+

+ Latest Release {{home.latestRelease.name}} + {{home.latestRelease.date|date}} +

+
+
+
+ +
+ +
+ +
+
+
+

What is it?

+ +

gcloud-python is a client library for accessing Google + Cloud Platform services that significantly reduces the boilerplate + code you have to write. The library provides high-level API + abstractions so they're easier to understand. It embraces + idioms of Python, works well with the standard library, and + integrates better with your codebase. + All this means you spend more time creating code that matters + to you.

+ +

gcloud-python is configured to access Google Cloud Platform + services and authorize (OAuth 2.0) automatically on your behalf. + With a one-line install and a private key, you are up and ready + to go. Better yet, if you are running on a Google Compute Engine + instance, the one-line install is enough!

+ +
+ +
+

Retrieve Datastore Entities

+ +
+ from gcloud import datastore + + client = datastore.Client() + product_key = client.key('Product', 123) + print(client.get(product_key)) +
+
+
+
+ +
+
+

Examples

+ + +
+
+ +
+
+

FAQ

+ +

What is the relationship between the gcloud-python package + and the gcloud command-line tool?

+

Both the gcloud command-line tool and + gcloud-python package are a part of the Google Cloud SDK: a collection + of tools and libraries that enable you to easily create and manage + resources on the Google Cloud Platform. The gcloud command-line + tool can be used to manage both your development workflow and your + Google Cloud Platform resources while the gcloud-python package is the + Google Cloud Client Library for Python.

+ +

What is the relationship between gcloud-python + and the Google APIs Python Client?

+

The + Google APIs Python Client is a client library for + using the broad set of Google APIs. + gcloud-python is built specifically for the Google Cloud Platform + and is the recommended way to integrate Google Cloud APIs into your + Python applications. If your application requires both Google Cloud Platform and + other Google APIs, the 2 libraries may be used by your application.

+
+
diff --git a/docs/json/index.json b/docs/json/json/master/index.json similarity index 100% rename from docs/json/index.json rename to docs/json/json/master/index.json diff --git a/docs/json/overview.html b/docs/json/json/master/overview.html similarity index 100% rename from docs/json/overview.html rename to docs/json/json/master/overview.html diff --git a/docs/json/toc.json b/docs/json/json/master/toc.json similarity index 99% rename from docs/json/toc.json rename to docs/json/json/master/toc.json index f78facd7bf5e7..7380831168956 100644 --- a/docs/json/toc.json +++ b/docs/json/json/master/toc.json @@ -57,7 +57,7 @@ "title": "Dataset" }, { - "type": "gcloud/bigquery/job/job", + "type": "gcloud/bigquery/job", "title": "Jobs" }, { diff --git a/scripts/generate_json_docs.py b/scripts/generate_json_docs.py index 3485ee55198cf..f0e9c83790a32 100644 --- a/scripts/generate_json_docs.py +++ b/scripts/generate_json_docs.py @@ -16,6 +16,7 @@ import inspect import json import os +import shutil import types import pdoc @@ -536,6 +537,40 @@ def get_snippet_examples(module, json_docs_dir): return snippets +def package_files(generated_json_dir, docs_build_dir, static_json_dir, + tag='master'): + """Copy app and JSON files into a convenient place to deploy from. + + Structure needs to be... + root + - src/ + - images/ + - app.js + - app.css + - vendor.js + - vendor.css + - json/ + - master/ + - toc.json + - types.json + - home.html + - index.json + - overview.html + - home.html + - home.html + - index.html + - manifest.json + """ + package_path = os.path.join(docs_build_dir, 'json_build') + shutil.rmtree(package_path, ignore_errors=True) + + shutil.copytree(static_json_dir, package_path) + shutil.copytree(os.path.join(generated_json_dir, 'gcloud'), + os.path.join(package_path, 'json', tag, 'gcloud')) + shutil.copyfile(os.path.join(generated_json_dir, 'types.json'), + os.path.join(package_path, 'json', tag, 'types.json')) + + def main(): parser = argparse.ArgumentParser(description='Document Python modules.') parser.add_argument('--tag', help='The version of the documentation.', @@ -559,6 +594,7 @@ def main(): 'dns': [], 'error_reporting': [], 'environment_vars': [], + 'error_reporting': [], 'exceptions': [], 'iterator': [], 'logging': [], @@ -572,7 +608,10 @@ def main(): } BASE_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) - JSON_DOCS_DIR = os.path.join(BASE_DIR, 'docs', '_build', 'json', args.tag) + BASE_JSON_DOCS_DIR = os.path.join(BASE_DIR, 'docs', 'json') + + DOCS_BUILD_DIR = os.path.join(BASE_DIR, 'docs', '_build') + JSON_DOCS_DIR = os.path.join(DOCS_BUILD_DIR, 'json', args.tag) LIB_DIR = os.path.abspath(args.basepath) library_dir = os.path.join(LIB_DIR, 'gcloud') @@ -581,7 +620,7 @@ def main(): generate_module_docs(public_mods, JSON_DOCS_DIR, BASE_DIR, toc) generate_doc_types_json(public_mods, os.path.join(JSON_DOCS_DIR, 'types.json')) - + package_files(JSON_DOCS_DIR, DOCS_BUILD_DIR, BASE_JSON_DOCS_DIR) if args.show_toc: print json.dumps(toc, indent=4) diff --git a/scripts/update_json_docs.sh b/scripts/update_json_docs.sh index 61556a03b3345..c4f889337a91c 100755 --- a/scripts/update_json_docs.sh +++ b/scripts/update_json_docs.sh @@ -10,14 +10,7 @@ function pushDocs () { git submodule add -f -b gh-pages https://${GH_OAUTH_TOKEN}@github.com/${GH_OWNER}/${GH_PROJECT_NAME} ghpages fi mkdir -p ghpages/json/${1} - cp -R docs/_build/json/${1}/* ghpages/json/${1} - cp docs/json/toc.json ghpages/json/${1} - cp docs/json/index.json ghpages/json/${1} - cp docs/json/overview.html ghpages/json/${1} - cp docs/json/home.html ghpages/json/ - cp -R docs/json/src ghpages - cp docs/json/manifest.json ghpages - cp docs/json/index.html ghpages + cp -R docs/_build/json_build/* ghpages/ cd ghpages git add . if [[ -n "$(git status --porcelain)" ]]; then