Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix sphinx docs title #134

Closed
jantman opened this issue Feb 21, 2016 · 2 comments
Closed

Fix sphinx docs title #134

jantman opened this issue Feb 21, 2016 · 2 comments
Labels
Milestone

Comments

@jantman
Copy link
Owner

jantman commented Feb 21, 2016

awslimitchecker shows up on the first page of Google results for "check aws service limits", but what's found is the RTD site which currently has a title of "awslimitchecker — awslimitchecker v0.2.3@4a08591*" with a description of "A script and python module to check your AWS service limits and usage using ... a small subset of AWS limits and only alerts weekly. awslimitchecker provides a ..."

  1. Fix the sphinx docs build to not show the git commit and dirty marker (*), and get RTD to do the same.
  2. Set the title - especially or at least of the index page - to something more meaningful, maybe a short summary too.
  3. See if there's a way to change the templates to get a better description showing up in search results.
@jantman jantman added the Docs label Feb 21, 2016
@jantman jantman added this to the 0.3.1 milestone Feb 21, 2016
@jantman
Copy link
Owner Author

jantman commented Feb 21, 2016

Ok, so I did some testing with f042b27 to interpolate some environment variables into a RST source file. It looks like docs/source/conf.py is showing as modified in git, and the environment includes:

  • READTHEDOCS_PROJECT=awslimitchecker
  • READTHEDOCS=True
  • PWD=/home/docs/checkouts/readthedocs.org/user_builds/awslimitchecker/checkouts/rtdtest/docs/source
  • READTHEDOCS_VERSION=rtdtest

READTHEDOCS_VERSION is what we're building, i.e. the branch or tag name.

diff --git a/docs/source/conf.py b/docs/source/conf.py
index 3f5d640..a41e4af 100644
--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -14,12 +14,40 @@

 import sys
 import os
+import subprocess
 # to let sphinx find the actual source...
 sys.path.insert(0, os.path.abspath("../.."))
 from awslimitchecker.version import _get_version_info
 import sphinx.environment
 from docutils.utils import get_source_line

+# RTD Test:
+with open(
+        os.path.join(
+            os.path.dirname(os.path.abspath('.')),
+            'source',
+            'rtdtest.rst'
+        ),
+    'a') as fh:
+    fh.write("Environment Variables\n")
+    fh.write("---------------------\n\n")
+    for key in os.environ:
+        fh.write("- ``%s`` = ``%s``\n" % (key, os.environ[key]))
+    fh.write("\nGit Status\n")
+    fh.write("----------\n\n")
+    try:
+        res = subprocess.check_output(['git', 'status'], stderr=subprocess.STDOUT)
+        fh.write(".. code-block:: console\n\n")
+        for line in res.split("\n"):
+            fh.write("   %s\n" % line)
+        fh.write("\n")
+    except subprocess.CalledProcessError as ex:
+        fh.write("Failed with status %s:\n" % ex.returncode)
+        fh.write(".. code-block:: console\n\n")
+        for line in ex.output.split("\n"):
+            fh.write("   %s\n" % line)
+        fh.write("\n")
+
 # If extensions (or modules to document with autodoc) are in another directory,
 # add these directories to sys.path here. If the directory is relative to the
 # documentation root, use os.path.abspath to make it absolute, like shown here.
diff --git a/docs/source/index.rst b/docs/source/index.rst
index fca5e85..2e23f9f 100644
--- a/docs/source/index.rst
+++ b/docs/source/index.rst
@@ -131,6 +131,7 @@ Contents
    Internals <internals>
    API <modules>
    Getting Help <getting_help>
+   RTD Test <rtdtest>


 Indices and tables
diff --git a/docs/source/rtdtest.rst b/docs/source/rtdtest.rst
new file mode 100644
index 0000000..08fd751
--- /dev/null
+++ b/docs/source/rtdtest.rst
@@ -0,0 +1,5 @@
+.. _rtdtest:
+
+RTD Test
+========
+

@jantman
Copy link
Owner Author

jantman commented Feb 21, 2016

merged to develop in #136

jantman added a commit that referenced this issue Feb 21, 2016
Issues/134 - doc fixes
@jantman jantman closed this as completed in 952a4a5 Mar 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant