Skip to content

Commit 8e69822

Browse files
author
Gornicki, Lukasz
committed
initial script
1 parent 8cb72dc commit 8e69822

1 file changed

Lines changed: 74 additions & 2 deletions

File tree

README.md

Lines changed: 74 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,74 @@
1-
# Documenting-REST-API---Workshop-Script
2-
This is a script for a workshop about documenting REST APIs
1+
This is a script for a workshop about documenting REST APIs.
2+
This is a technical script that will be just a part of the workshop. It covers the setup of documentation portal but not the part where we learn about REST API
3+
4+
## Prerequisites
5+
6+
You need to have the following software/modules/applications installed on your computer to be able to complete all the steps of the workshop.
7+
8+
- Install Node.js and NPM: https://nodejs.org/en/download/ (both in one package) and then install:
9+
- [DocPad](http://docpad.org/) by calling in the terminal: `npm install -g npm`
10+
- [Gulp](http://gulpjs.com/) by calling in the terminal: `npm install -g gulp-cli`
11+
- Get GitHub account: https://github.com/
12+
- Install GitHub Desktop: https://desktop.github.com/
13+
- Install some nice text editor like [Atom](https://atom.io/) or [Sublime Text](https://www.sublimetext.com/)
14+
15+
## Configuring documentation publishing pipeline
16+
17+
First you need to fork some projects and configure them correctly to set up the documentation independent generation pipeline.
18+
19+
1. Fork the following repos (it means open the links and click on Fork button in the top right corner of the page):
20+
- API Doc portal template: https://github.com/hybris/docpad-skeleton-apidocs
21+
- Sample REST API microservice that we will be documenting: https://github.com/derberg/minerva
22+
- Sample registry that integrates the template and docu sources: https://github.com/derberg/apidoc-workshop-docu_registry
23+
24+
2. Configuration
25+
- Modify `chewieConfig.js` file in forked `docpad-skeleton-apidocs` repository. Change the `path` attribute:
26+
```
27+
path: process.env.REGISTRY_PATH || 'https://github.com/derberg/apidoc-workshop-docu_registry.git'
28+
```
29+
The git url must point to your forked `apidoc-workshop-docu_registry` repository.
30+
31+
- Modify `minerva.json` file in forked `apidoc-workshop-docu_registry` repository. Change the `location` attribute:
32+
```
33+
"location": "https://github.com/derberg/minerva"
34+
```
35+
The git url must point to your forked `minerva` repository.
36+
37+
## Start the API Doc portal locally
38+
39+
If configuration is completed you have to:
40+
41+
1. Clone your forked `docpad-skeleton-apidocs` repository
42+
2. Navigate to its local clone in the terminal
43+
3. Call the following command: `npm start`
44+
4. Once the start is completed, open in the browser the following link: http://localhost:9778/
45+
46+
## Publishing to GitHub Pages
47+
48+
The easiest solution is to publish the API Doc portal on GitHub pages. Of course the generated API Doc portal files can be hosted on any other server as it is pure static content.
49+
50+
1. Create new repository with the following name: `your_github_username.github.io`. It must be public and initialized (You do it in UI during creation).
51+
2. Modify `chewieConfig.js` file in forked `docpad-skeleton-apidocs` repository.
52+
- Change the `srcLocation` attribute:
53+
```
54+
srcLocation: 'https://github.com/derberg/derberg.github.io.git',
55+
```
56+
The git url must point to your newly created `your_github_username.github.io` repository.
57+
- Change the `docuUrl` attribute:
58+
```
59+
docuUrl: process.env.docuURL || 'http://derberg.github.io',
60+
```
61+
The page url must be the same as the name of your newly created `your_github_username.github.io` repository.
62+
3. Modify `docpad.coffee` file in forked `docpad-skeleton-apidocs` repository. Change the `url` attribute:
63+
```
64+
environments:
65+
prod:
66+
templateData:
67+
site:
68+
url: "http://derberg.github.io"
69+
```
70+
It should point to the following url: `http://your_github_username.github.io`
71+
4. Navigate to the local clone of `docpad-skeleton-apidocs` repository in the terminal
72+
5. Call the following command: `npm run production`
73+
6. Call the following command: `gulp pushResult`
74+
7. Once the push is completed, open in the browser the following link: http://your_github_username.github.io

0 commit comments

Comments
 (0)