Skip to content

Commit 95b23c2

Browse files
authored
Merge branch 'master' into search-reapply
2 parents 75445f1 + bc248aa commit 95b23c2

File tree

137 files changed

+2126
-1110
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

137 files changed

+2126
-1110
lines changed

.codecov.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
comment:
2+
layout: "diff, files"

.coveragerc

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
11
[run]
2+
branch = true
3+
source = .
24
omit =
35
*/**/migrations/*
6+
*/**/management/commands/*
7+
*/**/settings/*
8+
*/**/settings.py
9+
analytics/vendor/*
10+
rtd_tests/*
11+
*/**/tests/**
12+
wsgi.py
13+
14+
[report]
15+
exclude_lines =
16+
if self.debug:
17+
pragma: no cover
18+
raise NotImplementedError
19+
if __name__ == .__main__.:
20+
if getattr(settings, 'DEBUG'):

.travis.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,15 @@ matrix:
1616
script: tox
1717
- python: 3.6
1818
env: TOXENV=eslint
19+
- python: 3.6
20+
env: TOXENV=migrations
1921
cache:
2022
directories:
2123
- ~/.cache/pip
2224
- ~/.nvm/nvm.sh
2325
- ~/.npm
26+
before_install:
27+
- sudo apt-get install -y git
2428
install:
2529
- ./scripts/travis/install_elasticsearch.sh
2630
- pip install tox-travis
@@ -42,4 +46,6 @@ notifications:
4246

4347
branches:
4448
only:
45-
- master
49+
- master
50+
- rel # Community release branch
51+
- relcorp # Corporate release branch

CHANGELOG.rst

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,59 @@
1+
Version 2.8.0
2+
-------------
3+
4+
:Date: October 30, 2018
5+
6+
Major change is an upgrade to Django 1.11.
7+
8+
* `@humitos <http://github.com/humitos>`__: Cleanup old code (remove old_div) (`#4817 <https://github.com/rtfd/readthedocs.org/pull/4817>`__)
9+
* `@humitos <http://github.com/humitos>`__: Remove unnecessary migration (`#4806 <https://github.com/rtfd/readthedocs.org/pull/4806>`__)
10+
* `@humitos <http://github.com/humitos>`__: Feature flag to make `readthedocs` theme default on MkDocs docs (`#4802 <https://github.com/rtfd/readthedocs.org/pull/4802>`__)
11+
* `@stsewd <http://github.com/stsewd>`__: Add codecov badge (`#4799 <https://github.com/rtfd/readthedocs.org/pull/4799>`__)
12+
* `@humitos <http://github.com/humitos>`__: Pin missing dependency for the MkDocs guide compatibility (`#4798 <https://github.com/rtfd/readthedocs.org/pull/4798>`__)
13+
* `@ericholscher <http://github.com/ericholscher>`__: Release 2.7.2 (`#4796 <https://github.com/rtfd/readthedocs.org/pull/4796>`__)
14+
* `@humitos <http://github.com/humitos>`__: Do not log as error a webhook with an invalid branch name (`#4779 <https://github.com/rtfd/readthedocs.org/pull/4779>`__)
15+
* `@ericholscher <http://github.com/ericholscher>`__: Run travis on release branches (`#4763 <https://github.com/rtfd/readthedocs.org/pull/4763>`__)
16+
* `@ericholscher <http://github.com/ericholscher>`__: Remove Eric & Anthony from ADMINS & MANAGERS settings (`#4762 <https://github.com/rtfd/readthedocs.org/pull/4762>`__)
17+
* `@stsewd <http://github.com/stsewd>`__: Don't use RequestsContext (`#4759 <https://github.com/rtfd/readthedocs.org/pull/4759>`__)
18+
* `@davidfischer <http://github.com/davidfischer>`__: Django 1.11 upgrade (`#4750 <https://github.com/rtfd/readthedocs.org/pull/4750>`__)
19+
* `@stsewd <http://github.com/stsewd>`__: Dropdown to select Advanced Settings (`#4710 <https://github.com/rtfd/readthedocs.org/pull/4710>`__)
20+
* `@stsewd <http://github.com/stsewd>`__: Remove hardcoded constant from config module (`#4704 <https://github.com/rtfd/readthedocs.org/pull/4704>`__)
21+
* `@stsewd <http://github.com/stsewd>`__: Update tastypie (`#4325 <https://github.com/rtfd/readthedocs.org/pull/4325>`__)
22+
* `@stsewd <http://github.com/stsewd>`__: Update to Django 1.10 (`#4319 <https://github.com/rtfd/readthedocs.org/pull/4319>`__)
23+
24+
Version 2.7.2
25+
-------------
26+
27+
:Date: October 23, 2018
28+
29+
* `@humitos <http://github.com/humitos>`__: Validate the slug generated is valid before importing a project (`#4780 <https://github.com/rtfd/readthedocs.org/pull/4780>`__)
30+
* `@humitos <http://github.com/humitos>`__: Do not log as error a webhook with an invalid branch name (`#4779 <https://github.com/rtfd/readthedocs.org/pull/4779>`__)
31+
* `@ericholscher <http://github.com/ericholscher>`__: Add an index page to our design docs. (`#4775 <https://github.com/rtfd/readthedocs.org/pull/4775>`__)
32+
* `@dojutsu-user <http://github.com/dojutsu-user>`__: Remove /embed API endpoint (`#4771 <https://github.com/rtfd/readthedocs.org/pull/4771>`__)
33+
* `@stsewd <http://github.com/stsewd>`__: Upgrade logs from debug on middleware (`#4769 <https://github.com/rtfd/readthedocs.org/pull/4769>`__)
34+
* `@humitos <http://github.com/humitos>`__: Link to SSL for Custom Domains fixed (`#4766 <https://github.com/rtfd/readthedocs.org/pull/4766>`__)
35+
* `@ericholscher <http://github.com/ericholscher>`__: Remove Eric & Anthony from ADMINS & MANAGERS settings (`#4762 <https://github.com/rtfd/readthedocs.org/pull/4762>`__)
36+
* `@humitos <http://github.com/humitos>`__: Do not re-raise the exception if the one that we are checking (`#4761 <https://github.com/rtfd/readthedocs.org/pull/4761>`__)
37+
* `@humitos <http://github.com/humitos>`__: Do not fail when unlinking an non-existing path (`#4760 <https://github.com/rtfd/readthedocs.org/pull/4760>`__)
38+
* `@humitos <http://github.com/humitos>`__: Allow to extend the DomainForm from outside (`#4752 <https://github.com/rtfd/readthedocs.org/pull/4752>`__)
39+
* `@davidfischer <http://github.com/davidfischer>`__: Fixes an OSX issue with the test suite (`#4748 <https://github.com/rtfd/readthedocs.org/pull/4748>`__)
40+
* `@humitos <http://github.com/humitos>`__: Use Docker time limit for max lock age (`#4747 <https://github.com/rtfd/readthedocs.org/pull/4747>`__)
41+
* `@xyNNN <http://github.com/xyNNN>`__: Fixed link of PagerDuty (`#4744 <https://github.com/rtfd/readthedocs.org/pull/4744>`__)
42+
* `@davidfischer <http://github.com/davidfischer>`__: Make storage syncers extend from a base class (`#4742 <https://github.com/rtfd/readthedocs.org/pull/4742>`__)
43+
* `@ericholscher <http://github.com/ericholscher>`__: Revert "Upgrade theme media to 0.4.2" (`#4735 <https://github.com/rtfd/readthedocs.org/pull/4735>`__)
44+
* `@ericholscher <http://github.com/ericholscher>`__: Upgrade theme media to 0.4.2 (`#4734 <https://github.com/rtfd/readthedocs.org/pull/4734>`__)
45+
* `@stsewd <http://github.com/stsewd>`__: Extend install option from config file (v2, schema only) (`#4732 <https://github.com/rtfd/readthedocs.org/pull/4732>`__)
46+
* `@stsewd <http://github.com/stsewd>`__: Remove /cname endpoint (`#4731 <https://github.com/rtfd/readthedocs.org/pull/4731>`__)
47+
* `@ericholscher <http://github.com/ericholscher>`__: Fix get_vcs_repo by moving it to the Mixin (`#4727 <https://github.com/rtfd/readthedocs.org/pull/4727>`__)
48+
* `@humitos <http://github.com/humitos>`__: Guide explaining how to keep compatibility with mkdocs (`#4726 <https://github.com/rtfd/readthedocs.org/pull/4726>`__)
49+
* `@ericholscher <http://github.com/ericholscher>`__: Release 2.7.1 (`#4725 <https://github.com/rtfd/readthedocs.org/pull/4725>`__)
50+
* `@dojutsu-user <http://github.com/dojutsu-user>`__: Fix the form for adopting a project (`#4721 <https://github.com/rtfd/readthedocs.org/pull/4721>`__)
51+
* `@ericholscher <http://github.com/ericholscher>`__: Remove logging verbosity on syncer failure (`#4717 <https://github.com/rtfd/readthedocs.org/pull/4717>`__)
52+
* `@humitos <http://github.com/humitos>`__: Lint requirement file for py2 (`#4712 <https://github.com/rtfd/readthedocs.org/pull/4712>`__)
53+
* `@davidfischer <http://github.com/davidfischer>`__: Improve the getting started docs (`#4676 <https://github.com/rtfd/readthedocs.org/pull/4676>`__)
54+
* `@stsewd <http://github.com/stsewd>`__: Strict validation in configuration file (v2 only) (`#4607 <https://github.com/rtfd/readthedocs.org/pull/4607>`__)
55+
* `@stsewd <http://github.com/stsewd>`__: Run coverage on travis (`#4605 <https://github.com/rtfd/readthedocs.org/pull/4605>`__)
56+
157
Version 2.7.1
258
-------------
359

README.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Welcome to Read the Docs
22
========================
33

4-
|build-status| |docs|
4+
|build-status| |docs| |coverage|
55

66
Purpose
77
-------
@@ -70,6 +70,11 @@ when you push to GitHub.
7070
:scale: 100%
7171
:target: https://docs.readthedocs.io/en/latest/?badge=latest
7272

73+
.. |coverage| image:: https://codecov.io/gh/rtfd/readthedocs.org/branch/master/graph/badge.svg
74+
:alt: Test coverage
75+
:scale: 100%
76+
:target: https://codecov.io/gh/rtfd/readthedocs.org
77+
7378
License
7479
-------
7580

contrib/add-project.py

Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
"""
2+
Script to add a Git project as cloned from a Github repository
3+
to ReadTheDocs. Invoke from the checkout.
4+
"""
5+
6+
__requires__ = ['requests-toolbelt', 'autocommand', 'keyring']
7+
8+
9+
import os
10+
import getpass
11+
import re
12+
import urllib.parse
13+
import subprocess
14+
import pathlib
15+
16+
import autocommand
17+
import keyring
18+
from requests_toolbelt import sessions
19+
20+
21+
rtd = sessions.BaseUrlSession(
22+
os.environ.get('RTD_URL', 'https://readthedocs.org/api/v2/'))
23+
github = sessions.BaseUrlSession('https://api.github.com/')
24+
github.headers.update(Accept='application/vnd.github.v3+json')
25+
26+
27+
class User:
28+
"""
29+
A User (with a password) in RTD.
30+
31+
Resolves username using ``getpass.getuser()``. Override with
32+
RTD_USERNAME environment variable.
33+
34+
Resolves password using keyring. Install keyring and run
35+
``keyring set https://readthedocs.org/ $USER`` to set the pw.
36+
Override with RTD_PASSWORD environment variable.
37+
"""
38+
def __init__(self):
39+
self.name = os.environ.get('RTD_USERNAME') or getpass.getuser()
40+
system = rtd.create_url('/')
41+
self.password = (
42+
os.environ.get('RTD_PASSWORD')
43+
or keyring.get_password(system, self.name)
44+
)
45+
46+
@property
47+
def id(self):
48+
resp = rtd.get('../v1/user/', params=dict(username=self.name))
49+
resp.raise_for_status()
50+
ob, = resp.json()['objects']
51+
return ob['id']
52+
53+
@property
54+
def tuple(self):
55+
return self.name, self.password
56+
57+
58+
class Sluggable(str):
59+
"""
60+
A name for use in RTD with a 'slug' version.
61+
"""
62+
@property
63+
def slug(self):
64+
return self.replace('.', '')
65+
66+
67+
class Repo:
68+
"""
69+
A Git repo
70+
"""
71+
72+
def __init__(self, root):
73+
self.root = root
74+
cmd = ['git', '-C', root, 'remote', 'get-url', 'origin']
75+
proc = subprocess.run(
76+
cmd, check=True, text=True, stdout=subprocess.PIPE)
77+
self.url = proc.stdout.strip()
78+
79+
@property
80+
def name(self):
81+
return Sluggable(pathlib.Path(self.url).stem)
82+
83+
84+
def create_project(repo):
85+
"""
86+
Create the project from a Repo
87+
"""
88+
user = User()
89+
payload = dict(
90+
repo=repo.url,
91+
slug=repo.name.slug,
92+
name=repo.name,
93+
users=[user.id],
94+
)
95+
resp = rtd.post('project/', json=payload, auth=user.tuple)
96+
resp.raise_for_status()
97+
98+
99+
def configure_github(name, url):
100+
"""
101+
Given a project name and webhook URL, configure the webhook
102+
in GitHub.
103+
104+
Resolves username from ``getpass.getuser()``. Override with
105+
``GITHUB_USERNAME``.
106+
107+
Resolves access token from keyring for username and system
108+
'github.com'. Override with ``GITHUB_TOKEN`` environment
109+
variable.
110+
"""
111+
user = os.environ.get('GITHUB_USERNAME') or getpass.getuser()
112+
token = (
113+
keyring.get_password('github.com', user)
114+
or os.environ['GITHUB_TOKEN']
115+
)
116+
headers = dict(Authorization=f'token {token}')
117+
path = f'/repos/{user}/{name}/hooks'
118+
params = dict(
119+
name='web',
120+
config=dict(
121+
url=url,
122+
content_type='json',
123+
),
124+
)
125+
github.post(path, json=params, headers=headers)
126+
127+
128+
def configure_webhook(name):
129+
"""
130+
Identify the webhook URL for a RTD project named name.
131+
"""
132+
login_path = '/accounts/login/'
133+
resp = rtd.get(login_path)
134+
token = rtd.cookies.get('csrftoken') or rtd.cookies['csrf']
135+
user = User()
136+
params = dict(
137+
login=user.name,
138+
password=user.password,
139+
csrfmiddlewaretoken=token,
140+
next='/',
141+
)
142+
headers = dict(Referer=rtd.create_url(login_path))
143+
resp = rtd.post(login_path, data=params, headers=headers)
144+
token = rtd.cookies.get('csrftoken') or rtd.cookies['csrf']
145+
params = dict(
146+
integration_type='github_webhook',
147+
csrfmiddlewaretoken=token,
148+
next='/',
149+
)
150+
create_path = f'/dashboard/{name.slug}/integrations/create/'
151+
headers = dict(
152+
Referer=rtd.create_url(create_path),
153+
)
154+
resp = rtd.post(
155+
create_path,
156+
data=params,
157+
headers=headers,
158+
)
159+
resp.raise_for_status()
160+
ref = re.search(f'<a href="(.*?)">.*?webhook.*?</a>', resp.text).group(1)
161+
return urllib.parse.urljoin(resp.url, ref)
162+
163+
164+
@autocommand.autocommand(__name__)
165+
def main(repo: Repo = Repo('.')):
166+
create_project(repo)
167+
url = configure_webhook(repo.name)
168+
configure_github(repo.name, url)

docs/.rstcheck.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[rstcheck]
2-
ignore_directives=automodule,http:get
2+
ignore_directives=automodule,http:get,tabs,tab
33
ignore_roles=djangosetting,setting
44
ignore_messages=(Duplicate implicit target name: ".*")|(Hyperlink target ".*" is not referenced)

docs/api/v2.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,7 @@ Build list
253253
:>json array results: Array of ``Build`` objects.
254254

255255
:query string project__slug: Narrow to builds for a specific ``Project``
256+
:query string commit: Narrow to builds for a specific ``commit``
256257

257258
Build detail
258259
++++++++++++

docs/builds.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,12 @@ and MkDocs will build the ``.md`` files in that directory.
5656
As MkDocs doesn't support automatic PDF generation,
5757
Read the Docs cannot create a PDF version of your documentation with the *Mkdocs* option.
5858

59+
.. warning::
60+
61+
We strongly recommend to :ref:`pin the MkDocs version <guides/specifying-dependencies:Specifying Dependencies>`
62+
used for your project to build the docs to avoid potential future incompatibilities.
63+
64+
5965
Understanding what's going on
6066
-----------------------------
6167

File renamed without changes.

docs/commercial/custom_domains.rst

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
Custom Domains
2+
==============
3+
4+
Subdomain support
5+
-----------------
6+
7+
Once a project is imported under Read the Docs,
8+
by default it's hosted under a subdomain on one of our domains.
9+
If you need a custom domain, continue on custom domain setup.
10+
11+
Custom domains
12+
--------------
13+
14+
Projects can also be hosted under a custom domain.
15+
If you'd prefer to use your own domain name instead of our default hosting domain,
16+
you can still host with us.
17+
18+
19+
We require two steps from your side:
20+
21+
* Add a CNAME record in your DNS that points to our servers ``<organization-slug>.users.readthedocs.com``
22+
* Set your project's Privacy Level to *Public* from **Project Admin > Advance Settings**.
23+
* Add a Domain in the **Project Admin > Domains** page for your project.
24+
25+
.. note:: The domain that should be used is the actual subdomain that you want your docs served on.
26+
Generally it will be ``docs.projectname.com``.
27+
28+
29+
Custom domain SSL
30+
-----------------
31+
32+
We do support SSL for CNAMEs on our side.
33+
Please, `contact our support team`_ to setup it.
34+
35+
.. note:: SSL is required for *private* projects.
36+
37+
.. _contact our support team: mailto:[email protected]
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
Read the Docs Business Features
2-
-------------------------------
1+
Read the Docs Commercial Features
2+
---------------------------------
33

4-
.. note:: These features are for our new business offering, `readthedocs.com`_.
4+
.. note:: These features are for our new commercial offering, `readthedocs.com`_.
55

66

77
All of the other features outlined in these docs work on both sites.
8-
Things inside this section are specific to our business offering.
8+
Things inside this section are specific to our commercial offering.
99

1010
The largest feature that is different is that documentation on `readthedocs.com`_ is **private**.
1111
If you have private code that you want documentation for,
@@ -15,6 +15,7 @@ this is our solution.
1515

1616
.. toctree::
1717

18+
custom_domains
1819
organizations
1920
sharing
2021
analytics
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)