diff --git a/.env.example b/.env.example index 585bb93..8174cfc 100644 --- a/.env.example +++ b/.env.example @@ -1,2 +1,2 @@ USERORORG=Denperidge-Redpencil -REPOS=Denperidge-Redpencil/mu-project,Denperidge-Redpencil/mu-cl-resources@master,doctest \ No newline at end of file +REPOS=Denperidge-Redpencil/mu-project@master,Denperidge-Redpencil/mu-cl-resources,denperidge-redpencil/doctest@main,divio-docs-gen \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..f70fec1 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 Denperidge + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index ae5f0b3..c13474d 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,31 @@ -conflicting repo names: merge +# Divio Docs Generator -We could make the dedicated repo be partially auto-generated into the following structure +Automatically collect, aggregate and structure all your [divio-style documentation](https://documentation.divio.com/) into a tree of .md files. +``` /{reponame} /tutorials /how-tos /explanations /references +``` -(I will be referring to [tutorials, how-tos, explanations, references] as sections) +- Any input structure: this script will scan your entire repository for .md files + - If you have a how-to section in your README, that'll get extracted and put in the right spot + - Or, if you have an how-to.md file, it'll get added in its entirety! +- Any output structure: this script generates a simple markdown tree. Nothing proprietary, no vendor-lockin. It can be generated from GitHub Actions and put into a Jekyll pages site just as easily as it is run from a Raspberry Pi and used to render the contents of an Ember application. -This would make things as simple as programatically looping over the repos and importing the markdown files. -Programming it right would allow complete freedom in how this is implemented in the repo. -- Check the README.md section headers. Import contents until the next header of the equivalent -- Otherwise, traverse the git repo for **/*.md, repeating the import from above on every file \ No newline at end of file +All you have to do is simply name your headers and/or files after the divio sections (`tutorial`, `how-to`, `explanation`, `reference`). (Oh, don't worry, the search is done through a case insensitive regex. Add more words as you please) + +## Getting-Started / tutorial +- Clone the repository using `git clone https://github.com/Denperidge-Redpencil/divio-docs-gen.git && cd divio-docs-gen` +- Install the pre-requirements using `python3 -m pip install -r requirements.txt` +- Setup the .env file (also see the [.env.example](.env.example) file) + | name | value | + | --------- | ------------------------- | + | repos | a list of repositories you want to generate docs for, split by `,`. Format: `owner/reponame`, `owner/reponame@branch` or (when userOrOrg is defined) `reponame`/`reponame@branch` | + | userOrOrg | username or organisation name. Setting this allows you to omit the owner whilst defining repos | +- And finally, run using `python3 app/index.py`! + + +## Reference +If you want to know more about the design principles of this project, feel free to check out my writeup [here](https://github.com/Denperidge-Redpencil/Learning.md/blob/main/Notes/docs.md#design-principles)!