Skip to content

Commit e56ed81

Browse files
authored
Merge pull request #11 from skerschb/DOCSP-4830
docstools-enabled repo tutorial
2 parents 12fbae8 + 1ba4e7f commit e56ed81

File tree

3 files changed

+240
-0
lines changed

3 files changed

+240
-0
lines changed

source/includes/steps-repo.yaml

Lines changed: 216 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,216 @@
1+
title: "Clone a repo similar to the repository you wish to create."
2+
ref: clone-repo
3+
content: |
4+
5+
First, clone a repository that is similar to the repository you wish to create.
6+
7+
For this example, we will clone the docs-meta repository. Clone the repo to the name you wish to give your new repo.
8+
9+
.. code-block:: sh
10+
11+
git clone [email protected]:mongodb/docs-meta.git <docs-yourrepo>
12+
13+
14+
Run:
15+
16+
.. code-block:: sh
17+
18+
cd <docs-yourrepo>
19+
20+
---
21+
title: Delete the .git directory
22+
ref: delete-git
23+
content: |
24+
25+
26+
27+
Delete the .git directory in your local, cloned version of the repository so that you can begin with your own repository.
28+
29+
.. code-block:: sh
30+
31+
rm -rf .git
32+
33+
Check to make sure you have deleted the .git file:
34+
35+
.. code-block:: sh
36+
37+
git branch
38+
39+
You should see the following error:
40+
41+
.. code-block:: sh
42+
:copyable: false
43+
44+
fatal: Not a git repository (or any of the parent directories): .git
45+
46+
47+
---
48+
title: Check to make sure you have removed the .git directory
49+
ref: check-rm
50+
content: |
51+
Before you proceed, check to make sure that .git directory is gone by running ls:
52+
53+
.. code-block:: sh
54+
55+
ls -al
56+
57+
Your output should be something like:
58+
59+
.. code-block:: sh
60+
:copyable: false
61+
62+
total 32
63+
drwxr-xr-x 7 you staff 238 Mar 11 05:05 .
64+
drwxr-xr-x 85 you staff 2890 Mar 11 05:02 ..
65+
-rw-r--r-- 1 you staff 2424 Mar 11 05:02 .gitignore
66+
-rw-r--r-- 1 you staff 2243 Mar 11 05:02 Makefile
67+
-rw-r--r-- 1 you staff 7087 Mar 11 05:02 conf.py
68+
drwxr-xr-x 8 you staff 272 Mar 11 05:02 config
69+
drwxr-xr-x 17 you staff 578 Mar 11 05:02 source
70+
71+
---
72+
title: Reinitialize the repo
73+
ref: git-reinit
74+
content: |
75+
Run git init to reinitialize the repo:
76+
77+
.. code-block:: sh
78+
79+
git init
80+
81+
You will see the following output:
82+
83+
.. code-block:: sh
84+
:copyable: false
85+
86+
Initialized empty Git repository in <yourdirectorystructure>/docs-yourrepo/.git/
87+
88+
Check your work:
89+
90+
.. code-block:: sh
91+
92+
ls -al
93+
94+
The new .git directory should now appear.
95+
96+
---
97+
title: Create the repository on GitHub
98+
ref: create-repo
99+
content: |
100+
101+
Create the repo you would like to use on GitHub.
102+
103+
You will then need to commit some files and add your local repository to github. If you add all of the files, you will
104+
nned to remove the ones that are not relevant to your repository later, but this is a perfectly acceptable way to start your repository.
105+
106+
Make sure you add a README.md file to your repo. Add a sentence to the file to describe your project. Then save the file and run:
107+
108+
.. code-block:: sh
109+
110+
git add README.md
111+
git commit -m "first commit"
112+
git remote add origin [email protected]:mongodb/docs-yourrepo.git
113+
git push -u origin master
114+
115+
---
116+
117+
title: Fork the repo
118+
ref: fork-repo
119+
content: |
120+
121+
Go ahead and fork the repo on github if you wish to follow the docs model of github usage. `Fork a repo <https://help.github.com/en/articles/fork-a-repo>`_.
122+
123+
This is not a requirement if your team follows a different workflow. If you wish to branch off the root repository, skip this step entirely.
124+
125+
Add the origin remote for your forked repo:
126+
127+
.. code-block:: sh
128+
129+
git remote add origin https://github.com/<fork>/docs-yourrepo
130+
131+
Add the upstream remote:
132+
133+
.. code-block:: sh
134+
135+
git remote add upstream https://github.com/<repoOwner>/<remoteRepoRoot>.git
136+
137+
---
138+
title: Edit conf.py
139+
ref: edit-confpy
140+
content: |
141+
142+
Edit the conf.py as needed. ``conf.py`` is where you can add sphinx extensions and roles that you might require for your docs.
143+
144+
If you'd like to accept the default ``conf.py``, that's fine too.
145+
146+
---
147+
title: Edit config/sphinx_local.yaml
148+
ref: edit-local
149+
content: |
150+
151+
In this ``config/sphinx_local.yaml`` file, you will want to change the name of the project:
152+
153+
.. code-block:: sh
154+
155+
project: 'mongodb-<yoursitename>'
156+
157+
---
158+
159+
title: Edit config/build_conf.yaml
160+
ref: edit-buildconf
161+
content: |
162+
163+
In order to make sure that your builds go to the right location on staging and production, modify the ``config/build_conf.yaml`` file.
164+
165+
- Modify the git/remote section to reflect your repository.
166+
- Modify the project name to match the name of your project.
167+
- Modify the url and tag in the project section.
168+
169+
.. code-block:: sh
170+
:copyable: false
171+
172+
git:
173+
remote:
174+
upstream: 'mongodb/docs-yourrepo'
175+
tools: 'mongodb/docs-tools'
176+
project:
177+
name: 'yourprojectname'
178+
tag: 'ypt'
179+
url: 'https://docs.mongodb.com/projectname'
180+
title: 'MongoDB Project Documentation'
181+
branched: false
182+
183+
184+
---
185+
title: Install Build Tools
186+
ref: install-build
187+
content: |
188+
189+
You will need to `install the build tools <https://gist.github.com/atsansone/aa6b793da9ca30fe7d46#install-the-documentation-software>`_ in order to build your repository.
190+
191+
Once you have installed the build tools, you can attempt to build your repository.
192+
193+
---
194+
title: Running a Build Locally
195+
ref: run-build
196+
content: |
197+
198+
If you are simply planning to build locally, you can build your repository by running:
199+
200+
.. code-block:: sh
201+
202+
make html
203+
204+
You will see output pertaining to your build in the ``build/<branch>`` directory local to your repository.
205+
206+
---
207+
title: Deploying Your Site
208+
ref: edit-makefile
209+
content: |
210+
211+
If you wish to deploy your site to ``mongodb.com`` and leverage the existing staging servers. you will `need to request a token
212+
<https://gist.github.com/atsansone/aa6b793da9ca30fe7d46#systems-authentication-and-authorization>`_ to be able to publish to the S3 buckets.
213+
214+
Modify the fields in the Makefile that pertain to the location of your deployed site if you wish to do so.
215+
216+
...

source/tutorials.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ Tutorials
1111
/tutorials/version-bumping
1212
/tutorials/generating-a-browser-list
1313
/error-kb
14+
/tutorials/repo
1415
/tutorials/guide

source/tutorials/repo.txt

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
.. guide::
2+
title: How to Create a Docstools-Enabled Repository
3+
author: MongoDB Documentation Team
4+
type: Deep Dive
5+
level: intermediate
6+
product_version: 4.0
7+
result_description:
8+
In this guide you will learn how to create a docstools-enabled repository.
9+
time: 45
10+
prerequisites:
11+
- access to git
12+
check_your_environment:
13+
- check to make sure you have git installed
14+
procedure:
15+
.. include:: /includes/steps/repo.rst
16+
summary:
17+
If you have successfully completed this guide, you have
18+
created a MongoDB docstools-enabled repository.
19+
whats_next:
20+
Congratulations! Now that you've created your repository, you can create your docstools-enabled content.
21+
seealso:
22+
- `check out the guides site for examples <http://docs.mongodb.com/guides>`__.
23+
- :doc:`Tabbed Content Tutorial </tutorials/tabbed-content>`

0 commit comments

Comments
 (0)