Skip to content

Commit

Permalink
Add apibot for API docs using phpDocumentor
Browse files Browse the repository at this point in the history
  • Loading branch information
jim-parry committed Mar 12, 2019
1 parent 895ae04 commit 1a558a9
Show file tree
Hide file tree
Showing 6 changed files with 93 additions and 2 deletions.
7 changes: 7 additions & 0 deletions admin/alldocs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

# Rebuild and deploy all CodeIgniter4 docs
#

. admin/docbot $1
. admin/apibot $1
42 changes: 42 additions & 0 deletions admin/apibot
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/bash

# Rebuild and deploy CodeIgniter4 under-development user guide
#
# This is a quick way to test user guide changes, and if they
# look good, to push them to the gh-pages branch of the
# development repository.
#
# This is not meant for updating the "stable" user guide.

UPSTREAM=https://github.com/codeigniter4/api.git

# Prepare the nested repo clone folder
rm -rf build/api*
mkdir -p build/api/docs

# Get ready for git
cd build/api
git init
git remote add origin $UPSTREAM
git fetch
git checkout master
git reset --hard origin/master
rm -r docs/*

# Make the new user guide
cd ../..
phpdoc
cp -R api/build/* build/api/docs

# All done?
if [ $# -lt 1 ]; then
exit 0
fi

# Optionally update the remote repo
if [ $1 = "deploy" ]; then
cd build/api
git add .
git commit -S -m "APIbot synching"
git push -f origin master
fi
36 changes: 36 additions & 0 deletions admin/apibot.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# apibot

Builds & deploys API docs.

The in-progress CI4 API docs, warts & all, are rebuilt and
then copied to a nested
repository clone (`build/api`), with the result
optionally pushed to the `master` branch of the `api` repo.
That would then be publically visible as the in-progress
version of the [API](https://codeigniter4.github.io/api/).

## Requirements

You must have phpDocumentor installed, with a `phpdoc` alias installed globally.

## Audience

This script is intended for use by framework maintainers,
i.e. someone with commit rights on the CI4 repository.

You will be prompted for your github credentials and
GPG-signing key as appropriate.

## Usage

Inside a shell prompt, in the project root:

`admin/apibot [deploy]`

If "deploy" is not added, the script execution is considered
a trial run, and nothing is pushed to the repo.

Whether or not deployed, the results are left inside
`build/api` (which is git ignored).

Generate these and the userguide together with the 'alldocs' script.
2 changes: 1 addition & 1 deletion admin/docbot
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#
# This is not meant for updating the "stable" user guide.

UPSTREAM=https://github.com/bcit-ci/CodeIgniter4.git
UPSTREAM=https://github.com/codeigniter4/CodeIgniter4.git

# Prepare the nested repo clone folder
cd user_guide_src
Expand Down
6 changes: 6 additions & 0 deletions admin/docbot.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ optionally pushed to the `gh-pages` branch of the repo.
That would then be publically visible as the in-progress
version of the [User Guide](https://codeigniter4.github.io/CodeIgniter4/).

## Requirements

You must have python & sphinx installed.

## Audience

This script is intended for use by framework maintainers,
Expand All @@ -31,3 +35,5 @@ a trial run, and nothing is pushed to the repo.

Whether or not deployed, the results are left inside
user_guide_src/build (which is git ignored).

Generate these and the API docs together with the 'alldocs' script.
2 changes: 1 addition & 1 deletion phpdoc.dist.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?>
<phpdoc>
<title>CodeIgniter v4.0.0 API</title>
<title>CodeIgniter v4.0 API</title>
<parser>
<target>api/data/</target>
</parser>
Expand Down

0 comments on commit 1a558a9

Please sign in to comment.