Skip to content

Commit c635c29

Browse files
committed
Package docs files for simple deployment.
1 parent c0e4e37 commit c635c29

File tree

7 files changed

+303
-11
lines changed

7 files changed

+303
-11
lines changed

docs/json/json/home.html

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
<section class="hero-banner">
2+
<div class="container clearfix">
3+
<div class="quote-box">
4+
<h1>gcloud-python</h1>
5+
<p>Google Cloud Client Library for Python
6+
- an idiomatic, intuitive, and natural way for Python developers to
7+
integrate with Google Cloud Platform services, like Cloud Datastore
8+
and Cloud Storage.</p>
9+
</div>
10+
11+
<div class="quote-box--supplementary">
12+
<pre class="skip-highlight"><code class="subtle--blue">$</code> pip install <code class="subtle--blue">--upgrade</code> <strong>gcloud</strong></pre>
13+
<h4 class="latest-release subtle" ng-if="home.latestRelease">
14+
Latest Release <a ng-href="{{home.latestRelease.link}}" class="latest-release--link white">{{home.latestRelease.name}}</a>
15+
{{home.latestRelease.date|date}}
16+
</h4>
17+
</div>
18+
</div><!-- end of .container -->
19+
</section><!-- end of .hero-banner -->
20+
21+
<section class="block featuring">
22+
<div class="container">
23+
<ul class="featuring-links">
24+
<li>
25+
<a href="#/docs/{{home.latestRelease.name}}/gcloud" title="gcloud-python docs" class="btn btn-docs">
26+
<img src="src/images/icon-lang-python-gray.svg" alt="Python icon" />
27+
Read the Docs
28+
</a>
29+
</li>
30+
<li>
31+
<a href="https://github.com/GoogleCloudPlatform/gcloud-python" title="gcloud-python on GitHub" class="ext-link">
32+
<img src="src/images/icon-link-github.svg" alt="GitHub icon" />
33+
GitHub
34+
</a>
35+
</li>
36+
<li>
37+
<a href="https://github.com/GoogleCloudPlatform/gcloud-python/issues" title="gcloud-python issues on Github" class="ext-link">
38+
<img src="src/images/icon-link-github.svg" alt="GitHub icon" />
39+
Issues
40+
</a>
41+
</li>
42+
<li>
43+
<a href="http://stackoverflow.com/questions/tagged/gcloud-python" title="gcloud-python on StackOverflow" class="ext-link">
44+
<img src="src/images/icon-link-stackoverflow.svg" alt="StackOverflow icon" />
45+
StackOverflow
46+
</a>
47+
</li>
48+
<li>
49+
<a href="https://pypi.python.org/pypi/gcloud" title="gcloud-python on pypi" class="ext-link">
50+
<img src="src/images/icon-link-package-manager.svg" alt="pypi icon" />
51+
PyPI
52+
</a>
53+
</li>
54+
</ul>
55+
</div><!-- end of .container -->
56+
</section><!-- end of .featuring -->
57+
58+
<section class="block about">
59+
<div class="container clearfix">
60+
<div class="quote-box">
61+
<h3 class="block-title">What is it?</h3>
62+
63+
<p><code>gcloud-python</code> is a client library for accessing Google
64+
Cloud Platform services that significantly reduces the boilerplate
65+
code you have to write. The library provides high-level API
66+
abstractions so they're easier to understand. It embraces
67+
idioms of Python, works well with the standard library, and
68+
integrates better with your codebase.
69+
All this means you spend more time creating code that matters
70+
to you.</p>
71+
72+
<p><code>gcloud-python</code> is configured to access Google Cloud Platform
73+
services and authorize (OAuth 2.0) automatically on your behalf.
74+
With a one-line install and a private key, you are up and ready
75+
to go. Better yet, if you are running on a Google Compute Engine
76+
instance, the one-line install is enough!</p>
77+
78+
</div>
79+
80+
<div class="quote-box--supplementary">
81+
<h4>Retrieve Datastore Entities</h4>
82+
83+
<div hljs hlsj-language="python">
84+
from gcloud import datastore
85+
86+
client = datastore.Client()
87+
product_key = client.key('Product', 123)
88+
print(client.get(product_key))
89+
</div>
90+
</div>
91+
</div><!-- end of .container -->
92+
</section><!-- end of .featuring -->
93+
94+
<section class="block examples">
95+
<div class="container clearfix">
96+
<h3 class="block-title">Examples</h3>
97+
98+
<ul>
99+
<li>
100+
<a href="https://github.com/GoogleCloudPlatform/gcloud-python-expenses-demo"><code>gcloud-python-expenses-demo</code></a> - Use gcloud-python with the Datastore and Cloud Storage to manage expenses
101+
</li>
102+
</ul>
103+
</div>
104+
</section>
105+
106+
<section class="block">
107+
<div class="container clearfix">
108+
<h3 class="block-title">FAQ</h3>
109+
110+
<h4>What is the relationship between the <code>gcloud-python</code> package
111+
and the <code>gcloud</code> command-line tool?</h4>
112+
<p>Both the <code>gcloud</code> command-line tool and
113+
<code>gcloud-python</code> package are a part of the Google Cloud SDK: a collection
114+
of tools and libraries that enable you to easily create and manage
115+
resources on the Google Cloud Platform. The <code>gcloud</code> command-line
116+
tool can be used to manage both your development workflow and your
117+
Google Cloud Platform resources while the <code>gcloud-python</code> package is the
118+
Google Cloud Client Library for Python.</p>
119+
120+
<h4>What is the relationship between <code>gcloud-python</code>
121+
and the Google APIs Python Client?</h4>
122+
<p>The <a href="https://github.com/google/google-api-python-client">
123+
Google APIs Python Client</a> is a client library for
124+
using the broad set of Google APIs.
125+
<code>gcloud-python</code> is built specifically for the Google Cloud Platform
126+
and is the recommended way to integrate Google Cloud APIs into your
127+
Python applications. If your application requires both Google Cloud Platform and
128+
other Google APIs, the 2 libraries may be used by your application.</p>
129+
</div>
130+
</section> <!-- end of FAQ -->

docs/json/json/master/home.html

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
<section class="hero-banner">
2+
<div class="container clearfix">
3+
<div class="quote-box">
4+
<h1>gcloud-python</h1>
5+
<p>Google Cloud Client Library for Python
6+
- an idiomatic, intuitive, and natural way for Python developers to
7+
integrate with Google Cloud Platform services, like Cloud Datastore
8+
and Cloud Storage.</p>
9+
</div>
10+
11+
<div class="quote-box--supplementary">
12+
<pre class="skip-highlight"><code class="subtle--blue">$</code> pip install <code class="subtle--blue">--upgrade</code> <strong>gcloud</strong></pre>
13+
<h4 class="latest-release subtle" ng-if="home.latestRelease">
14+
Latest Release <a ng-href="{{home.latestRelease.link}}" class="latest-release--link white">{{home.latestRelease.name}}</a>
15+
{{home.latestRelease.date|date}}
16+
</h4>
17+
</div>
18+
</div><!-- end of .container -->
19+
</section><!-- end of .hero-banner -->
20+
21+
<section class="block featuring">
22+
<div class="container">
23+
<ul class="featuring-links">
24+
<li>
25+
<a href="#/docs/{{home.latestRelease.name}}/gcloud" title="gcloud-python docs" class="btn btn-docs">
26+
<img src="src/images/icon-lang-python-gray.svg" alt="Python icon" />
27+
Read the Docs
28+
</a>
29+
</li>
30+
<li>
31+
<a href="https://github.com/GoogleCloudPlatform/gcloud-python" title="gcloud-python on GitHub" class="ext-link">
32+
<img src="src/images/icon-link-github.svg" alt="GitHub icon" />
33+
GitHub
34+
</a>
35+
</li>
36+
<li>
37+
<a href="https://github.com/GoogleCloudPlatform/gcloud-python/issues" title="gcloud-python issues on Github" class="ext-link">
38+
<img src="src/images/icon-link-github.svg" alt="GitHub icon" />
39+
Issues
40+
</a>
41+
</li>
42+
<li>
43+
<a href="http://stackoverflow.com/questions/tagged/gcloud-python" title="gcloud-python on StackOverflow" class="ext-link">
44+
<img src="src/images/icon-link-stackoverflow.svg" alt="StackOverflow icon" />
45+
StackOverflow
46+
</a>
47+
</li>
48+
<li>
49+
<a href="https://pypi.python.org/pypi/gcloud" title="gcloud-python on pypi" class="ext-link">
50+
<img src="src/images/icon-link-package-manager.svg" alt="pypi icon" />
51+
PyPI
52+
</a>
53+
</li>
54+
</ul>
55+
</div><!-- end of .container -->
56+
</section><!-- end of .featuring -->
57+
58+
<section class="block about">
59+
<div class="container clearfix">
60+
<div class="quote-box">
61+
<h3 class="block-title">What is it?</h3>
62+
63+
<p><code>gcloud-python</code> is a client library for accessing Google
64+
Cloud Platform services that significantly reduces the boilerplate
65+
code you have to write. The library provides high-level API
66+
abstractions so they're easier to understand. It embraces
67+
idioms of Python, works well with the standard library, and
68+
integrates better with your codebase.
69+
All this means you spend more time creating code that matters
70+
to you.</p>
71+
72+
<p><code>gcloud-python</code> is configured to access Google Cloud Platform
73+
services and authorize (OAuth 2.0) automatically on your behalf.
74+
With a one-line install and a private key, you are up and ready
75+
to go. Better yet, if you are running on a Google Compute Engine
76+
instance, the one-line install is enough!</p>
77+
78+
</div>
79+
80+
<div class="quote-box--supplementary">
81+
<h4>Retrieve Datastore Entities</h4>
82+
83+
<div hljs hlsj-language="python">
84+
from gcloud import datastore
85+
86+
client = datastore.Client()
87+
product_key = client.key('Product', 123)
88+
print(client.get(product_key))
89+
</div>
90+
</div>
91+
</div><!-- end of .container -->
92+
</section><!-- end of .featuring -->
93+
94+
<section class="block examples">
95+
<div class="container clearfix">
96+
<h3 class="block-title">Examples</h3>
97+
98+
<ul>
99+
<li>
100+
<a href="https://github.com/GoogleCloudPlatform/gcloud-python-expenses-demo"><code>gcloud-python-expenses-demo</code></a> - Use gcloud-python with the Datastore and Cloud Storage to manage expenses
101+
</li>
102+
</ul>
103+
</div>
104+
</section>
105+
106+
<section class="block">
107+
<div class="container clearfix">
108+
<h3 class="block-title">FAQ</h3>
109+
110+
<h4>What is the relationship between the <code>gcloud-python</code> package
111+
and the <code>gcloud</code> command-line tool?</h4>
112+
<p>Both the <code>gcloud</code> command-line tool and
113+
<code>gcloud-python</code> package are a part of the Google Cloud SDK: a collection
114+
of tools and libraries that enable you to easily create and manage
115+
resources on the Google Cloud Platform. The <code>gcloud</code> command-line
116+
tool can be used to manage both your development workflow and your
117+
Google Cloud Platform resources while the <code>gcloud-python</code> package is the
118+
Google Cloud Client Library for Python.</p>
119+
120+
<h4>What is the relationship between <code>gcloud-python</code>
121+
and the Google APIs Python Client?</h4>
122+
<p>The <a href="https://github.com/google/google-api-python-client">
123+
Google APIs Python Client</a> is a client library for
124+
using the broad set of Google APIs.
125+
<code>gcloud-python</code> is built specifically for the Google Cloud Platform
126+
and is the recommended way to integrate Google Cloud APIs into your
127+
Python applications. If your application requires both Google Cloud Platform and
128+
other Google APIs, the 2 libraries may be used by your application.</p>
129+
</div>
130+
</section> <!-- end of FAQ -->
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
"title": "Dataset"
5858
},
5959
{
60-
"type": "gcloud/bigquery/job/job",
60+
"type": "gcloud/bigquery/job",
6161
"title": "Jobs"
6262
},
6363
{

scripts/generate_json_docs.py

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import inspect
1717
import json
1818
import os
19+
import shutil
1920
import types
2021

2122
import pdoc
@@ -536,6 +537,40 @@ def get_snippet_examples(module, json_docs_dir):
536537
return snippets
537538

538539

540+
def package_files(generated_json_dir, docs_build_dir, static_json_dir,
541+
tag='master'):
542+
"""Copy app and JSON files into a convenient place to deploy from.
543+
544+
Structure needs to be...
545+
root
546+
- src/
547+
- images/
548+
- app.js
549+
- app.css
550+
- vendor.js
551+
- vendor.css
552+
- json/
553+
- master/
554+
- toc.json
555+
- types.json
556+
- home.html
557+
- index.json
558+
- overview.html
559+
- home.html
560+
- home.html
561+
- index.html
562+
- manifest.json
563+
"""
564+
package_path = os.path.join(docs_build_dir, 'json_build')
565+
shutil.rmtree(package_path, ignore_errors=True)
566+
567+
shutil.copytree(static_json_dir, package_path)
568+
shutil.copytree(os.path.join(generated_json_dir, 'gcloud'),
569+
os.path.join(package_path, 'json', tag, 'gcloud'))
570+
shutil.copyfile(os.path.join(generated_json_dir, 'types.json'),
571+
os.path.join(package_path, 'json', tag, 'types.json'))
572+
573+
539574
def main():
540575
parser = argparse.ArgumentParser(description='Document Python modules.')
541576
parser.add_argument('--tag', help='The version of the documentation.',
@@ -559,6 +594,7 @@ def main():
559594
'dns': [],
560595
'error_reporting': [],
561596
'environment_vars': [],
597+
'error_reporting': [],
562598
'exceptions': [],
563599
'iterator': [],
564600
'logging': [],
@@ -572,7 +608,10 @@ def main():
572608
}
573609

574610
BASE_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
575-
JSON_DOCS_DIR = os.path.join(BASE_DIR, 'docs', '_build', 'json', args.tag)
611+
BASE_JSON_DOCS_DIR = os.path.join(BASE_DIR, 'docs', 'json')
612+
613+
DOCS_BUILD_DIR = os.path.join(BASE_DIR, 'docs', '_build')
614+
JSON_DOCS_DIR = os.path.join(DOCS_BUILD_DIR, 'json', args.tag)
576615
LIB_DIR = os.path.abspath(args.basepath)
577616

578617
library_dir = os.path.join(LIB_DIR, 'gcloud')
@@ -581,7 +620,7 @@ def main():
581620
generate_module_docs(public_mods, JSON_DOCS_DIR, BASE_DIR, toc)
582621
generate_doc_types_json(public_mods,
583622
os.path.join(JSON_DOCS_DIR, 'types.json'))
584-
623+
package_files(JSON_DOCS_DIR, DOCS_BUILD_DIR, BASE_JSON_DOCS_DIR)
585624
if args.show_toc:
586625
print json.dumps(toc, indent=4)
587626

scripts/update_json_docs.sh

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,7 @@ function pushDocs () {
1010
git submodule add -f -b gh-pages https://${GH_OAUTH_TOKEN}@github.com/${GH_OWNER}/${GH_PROJECT_NAME} ghpages
1111
fi
1212
mkdir -p ghpages/json/${1}
13-
cp -R docs/_build/json/${1}/* ghpages/json/${1}
14-
cp docs/json/toc.json ghpages/json/${1}
15-
cp docs/json/index.json ghpages/json/${1}
16-
cp docs/json/overview.html ghpages/json/${1}
17-
cp docs/json/home.html ghpages/json/
18-
cp -R docs/json/src ghpages
19-
cp docs/json/manifest.json ghpages
20-
cp docs/json/index.html ghpages
13+
cp -R docs/_build/json_build/* ghpages/
2114
cd ghpages
2215
git add .
2316
if [[ -n "$(git status --porcelain)" ]]; then

0 commit comments

Comments
 (0)