Skip to content

Commit

Permalink
Adds documentation in ReadTheDocs platform (#196)
Browse files Browse the repository at this point in the history
* Adds initial documentation files

* Adds remaining documentation files

* Updates requirements dependencies

* Adds the readthedocs.yml

* Updates the documentation

* Adds document for APIs

* Adds ignores

* Adds copy instructions for static files

* Adds static files

* Adds documentation checks

* Adds compilation steps in contributing file
  • Loading branch information
gurkanindibay authored May 27, 2023
1 parent 99b5af2 commit 2588c0e
Show file tree
Hide file tree
Showing 71 changed files with 13,926 additions and 2 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/active-record-multi-tenant-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,20 @@ jobs:
run: |
gem install rubocop
rubocop
doc_checks:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v4
with:
python-version: 3.9
- uses: actions/checkout@v3
- name: Install python dependencies
run: |
pip install -r docs/requirements.txt
- name: Documentation Checks
run: |
cd docs
sphinx-build -W -b html source builds
build:
runs-on: ubuntu-latest
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ Gemfile.lock
.vagrant/
Vagrantfile
coverage/
docs/build/
.yardoc/
15 changes: 15 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: 2

build:
os: "ubuntu-22.04"
tools:
python: "3.11"

# Build from the docs/ directory with Sphinx
sphinx:
configuration: docs/source/conf.py

# Explicitly set the version of Python and its requirements
python:
install:
- requirements: docs/requirements.txt
3 changes: 3 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Ignore everything in this directory
.yardoc/*

28 changes: 28 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = source
BUILDDIR = build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# New target that executes the bash script before calling the original target
build-docs: pre-build # Change 'html' to the target you want to execute

pre-build:
# Execute your bash script here
bash api-reference.sh

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
html:
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

10 changes: 10 additions & 0 deletions docs/api-reference.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

# This script is used to generate the API reference documentation for the
# project. It is intended to be run from the root of the project directory.
# It requires the following tools to be installed:
# - yard (gem install yard)
echo "Generating API reference documentation..."
echo "Pwd: $(pwd)"
cd ..
yard doc --output-dir docs/source/_static/api-reference
4 changes: 4 additions & 0 deletions docs/requirements.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
sphinxnotes-strike
sphinx
sphinx_rtd_theme
readthedocs-sphinx-search
62 changes: 62 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
# pip-compile requirements.in
#
alabaster==0.7.13
# via sphinx
babel==2.12.1
# via sphinx
certifi==2023.5.7
# via requests
charset-normalizer==3.1.0
# via requests
docutils==0.18.1
# via
# sphinx
# sphinx-rtd-theme
idna==3.4
# via requests
imagesize==1.4.1
# via sphinx
jinja2==3.1.2
# via sphinx
markupsafe==2.1.2
# via jinja2
packaging==23.1
# via sphinx
pygments==2.15.1
# via sphinx
readthedocs-sphinx-search==0.3.1
# via -r requirements.in
requests==2.31.0
# via sphinx
snowballstemmer==2.2.0
# via sphinx
sphinx==6.2.1
# via
# -r requirements.in
# sphinx-rtd-theme
# sphinxcontrib-jquery
# sphinxnotes-strike
sphinx-rtd-theme==1.2.1
# via -r requirements.in
sphinxcontrib-applehelp==1.0.4
# via sphinx
sphinxcontrib-devhelp==1.0.2
# via sphinx
sphinxcontrib-htmlhelp==2.0.1
# via sphinx
sphinxcontrib-jquery==4.1
# via sphinx-rtd-theme
sphinxcontrib-jsmath==1.0.1
# via sphinx
sphinxcontrib-qthelp==1.0.3
# via sphinx
sphinxcontrib-serializinghtml==1.1.5
# via sphinx
sphinxnotes-strike==1.2
# via -r requirements.in
urllib3==2.0.2
# via requests
130 changes: 130 additions & 0 deletions docs/source/_static/api-reference/ActiveRecord.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>
Module: ActiveRecord

&mdash; Documentation by YARD 0.9.34

</title>

<link rel="stylesheet" href="css/style.css" type="text/css" />

<link rel="stylesheet" href="css/common.css" type="text/css" />

<script type="text/javascript">
pathId = "ActiveRecord";
relpath = '';
</script>


<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>

<script type="text/javascript" charset="utf-8" src="js/app.js"></script>


</head>
<body>
<div class="nav_wrap">
<iframe id="nav" src="class_list.html?1"></iframe>
<div id="resizer"></div>
</div>

<div id="main" tabindex="-1">
<div id="header">
<div id="menu">

<a href="_index.html">Index (A)</a> &raquo;


<span class="title">ActiveRecord</span>

</div>

<div id="search">

<a class="full_list_link" id="class_list_link"
href="class_list.html">

<svg width="24" height="24">
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
</svg>
</a>

</div>
<div class="clear"></div>
</div>

<div id="content"><h1>Module: ActiveRecord



</h1>
<div class="box_info">











<dl>
<dt>Defined in:</dt>
<dd>lib/activerecord-multi-tenant/habtm.rb<span class="defines">,<br />
lib/activerecord-multi-tenant/query_rewriter.rb,<br /> lib/activerecord-multi-tenant/migrations.rb,<br /> lib/activerecord-multi-tenant/migrations.rb</span>
</dd>
</dl>

</div>

<h2>Overview</h2><div class="docstring">
<div class="discussion">

<p>This module extension is a monkey patch to the ActiveRecord::Associations::ClassMethods module. It overrides the has_and_belongs_to_many method to add the tenant_id to the join table if the tenant_enabled option is set to true.</p>


</div>
</div>
<div class="tags">


</div><h2>Defined Under Namespace</h2>
<p class="children">


<strong class="modules">Modules:</strong> <span class='object_link'><a href="ActiveRecord/Associations.html" title="ActiveRecord::Associations (module)">Associations</a></span>, <span class='object_link'><a href="ActiveRecord/ConnectionAdapters.html" title="ActiveRecord::ConnectionAdapters (module)">ConnectionAdapters</a></span>, <span class='object_link'><a href="ActiveRecord/QueryMethods.html" title="ActiveRecord::QueryMethods (module)">QueryMethods</a></span>



<strong class="classes">Classes:</strong> <span class='object_link'><a href="ActiveRecord/SchemaDumper.html" title="ActiveRecord::SchemaDumper (class)">SchemaDumper</a></span>


</p>









</div>

<div id="footer">
Generated on Sat May 27 10:16:23 2023 by
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.34 (ruby-3.2.2).
</div>

</div>
</body>
</html>
Loading

0 comments on commit 2588c0e

Please sign in to comment.