[edited with feedback from @indigo423 and @Fryguy]
Background
Structurally, the _topic_map.yml
file is a YAML stream (i.e. multiple records). The records are each either topic groups or individual topics. All are assumed to be present in the docs repo that AsciiBinder is processing.
Proposal
I would like to extend AsciiBinder to support the inclusion of remote AsciiBinder-compliant docs repos as build-time topic groups within a local repo being processed.
In other words, given two repos:
- my_main_repo
- my_other_repo
There would be a way within _topic_map.yml
to use the contents of my_other_repo
as a topic group in my_main_repo
.
Invocation
In order for a user to specify that a remote repo should be included, they will create an entry in _topic_map.yml
that is similar to that of a topic group:
Name: Remote Group Name
Dir: remote_group
Distros: foo,bar<1>
URL: <see below>
RemoteDistro: baz<2>
<1> Optional
<2> Optional, but unlike the regular Distros key, this is not a list.
The URL value can follow one of two patterns:
http(s)://hostname(:port)/path/to/archive.[bz|tgz|zip]
for archive files or
http(s)://hostname(:port)/path/to/repo(.git)(@<branch_name>)
for git repos
AsciiBinder will sort out how to acquire and unpack the remote file based on the URL pattern per above.
Given an entry like this in the topic map, AsciiBinder will behave accordingly:
- If the remote file/repo is unreachable, AsciiBinder will raise a warning and skip this entry, proceeding through the rest of the topic map.
- If the specified landing directory already exists in the current branch of the main repo, AsciiBinder will raise a warning and replace the local contents. This is intended to enable repo maintainers to explicitly create the landing dir and put a 'DO_NOT_USE.txt' file in it so that contributors know this directory is reserved.
- AsciiBinder will check to ensure that the contents of the remote file/repo constitute a valid AsciiBinder repo.
Assuming we get to this point, the contents of the remote file/repo will be dropped into the current branch of the main repo in the specified landing directory. The topics and topic groups contained in the remote repo's _topic_map.yml
file will be treated as subtopics / subgroups of the landing directory.
Use cases
Here are some common use cases that this will support. For the sake of these examples, I am not mentioning distros. Per my proposed notation above, distro flags can be used to affect the inclusion of remote content (or even remote subcontent) but these examples are easier to follow without the added complication.
Include different versions of $remote with related versions of $local
I have two repos:
- local_repo
- remote_repo
- v3.6.8 branch
- v3.7 branch
And I want to include the remote_repo content in my main_repo docs. Specifically:
- local_repo v1.1 should include the remote_repo v3.6.8 content
- local_repo v1.2 should include the remote_repo v3.7 content
So the _topic_map.yml
file in the local_repo v1.1 branch will include a record like this:
Name: Remote Topic Group
Dir: remote_group
URL: https://remote_host/[email protected]
And the topic map in the local repo v1.2 branch will include a record like this:
Name: Remote Topic Group
Dir: remote_group
URL: https://remote_host/[email protected]
But the URLs could just as easily point to archives (tgz/zip/bz) as long as each archive URL corresponded to the right versions of the remote_repo content.
Include the same version of $remote with every version of $local
Slightly different scenario:
- local_repo
- remote_repo
- master branch (which is also the default branch)
And in this case, both branches would have an identical topic map entry:
Name: Remote Topic Group
Dir: remote_group
URL: https://remote_host/repo.git