Skip to content

Commit 481497d

Browse files
authored
Merge pull request #5043 from dojutsu-user/docs-for-feature-flags
Docs for feature flag
2 parents e33c433 + 5d5c2ff commit 481497d

File tree

4 files changed

+63
-2
lines changed

4 files changed

+63
-2
lines changed

docs/.rstcheck.cfg

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

docs/doc_extensions.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212

1313
from django.conf import settings
1414

15+
from readthedocs.projects.models import Feature
16+
1517

1618
def django_setting_role(typ, rawtext, text, lineno, inliner, options=None,
1719
content=None):
@@ -21,9 +23,27 @@ def django_setting_role(typ, rawtext, text, lineno, inliner, options=None,
2123
return [node], []
2224

2325

26+
def feature_flags_role(typ, rawtext, text, lineno, inliner, options=None,
27+
content=None):
28+
"""Up to date feature flags from the application."""
29+
all_features = Feature.FEATURES
30+
requested_feature = utils.unescape(text)
31+
for feature in all_features:
32+
if requested_feature.lower() == feature[0].lower():
33+
desc = nodes.Text(feature[1], feature[1])
34+
return [desc], []
35+
36+
2437
def setup(_):
2538
from docutils.parsers.rst import roles
26-
roles.register_local_role('djangosetting', django_setting_role)
39+
roles.register_local_role(
40+
'djangosetting',
41+
django_setting_role
42+
)
43+
roles.register_local_role(
44+
'featureflags',
45+
feature_flags_role
46+
)
2747

2848
return {
2949
'version': 'builtin',

docs/faq.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,16 @@ environment, and will be set to ``True`` when building on RTD::
6464
Woo
6565
{% endif %}
6666

67+
My project requires different settings than those available under Admin
68+
-----------------------------------------------------------------------
69+
70+
Read the Docs offers some settings which can be used for a variety of purposes,
71+
such as to use the latest version of sphinx or pip. To enable these settings,
72+
please open a request issue on our `github`_ and we will change the settings for the project.
73+
Read more about these settings :doc:`here <guides/feature-flags>`.
74+
75+
.. _github: https://github.com/rtfd/readthedocs.org
76+
6777
I get import errors on libraries that depend on C modules
6878
---------------------------------------------------------
6979

docs/guides/feature-flags.rst

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
Feature Flags
2+
=============
3+
4+
Read the Docs offers some additional flag settings which can be only be configured by the site admin.
5+
These are optional settings and you might not need it for every project.
6+
By default, these flags are disabled for every project.
7+
A seperate request can be made by opening an issue on our `github`_ to enable
8+
or disable one or more of these featured flags for a particular project.
9+
10+
.. _github: https://github.com/rtfd/readthedocs.org
11+
12+
Available Flags
13+
---------------
14+
15+
``USE_SPHINX_LATEST``: :featureflags:`USE_SPHINX_LATEST`
16+
17+
``USE_SETUPTOOLS_LATEST``: :featureflags:`USE_SETUPTOOLS_LATEST`
18+
19+
``ALLOW_DEPRECATED_WEBHOOKS``: :featureflags:`ALLOW_DEPRECATED_WEBHOOKS`
20+
21+
``PIP_ALWAYS_UPGRADE``: :featureflags:`PIP_ALWAYS_UPGRADE`
22+
23+
``SKIP_SUBMODULES``: :featureflags:`SKIP_SUBMODULES`
24+
25+
``DONT_OVERWRITE_SPHINX_CONTEXT``: :featureflags:`DONT_OVERWRITE_SPHINX_CONTEXT`
26+
27+
``ALLOW_V2_CONFIG_FILE``: :featureflags:`ALLOW_V2_CONFIG_FILE`
28+
29+
``MKDOCS_THEME_RTD``: :featureflags:`MKDOCS_THEME_RTD`
30+
31+
``DONT_SHALLOW_CLONE``: :featureflags:`DONT_SHALLOW_CLONE`

0 commit comments

Comments
 (0)