Redesign Status
Latest (Aug 23)
- copied all code to
code-old
so I can just mess with thecode/
folder as much as i like.
I just want to propose a new way to design this. I won't necessarily go with it, but I just ... want to propose something new.
I will copy a lot of code from my old base to the new one. This is purely to define a new structure. Once I have the new structure, then I can work in the relevant code.
Requirements
- Handle all requests to
baseUrl/*
. - allow the following to be specified in Url:
- Repo
- required, unless "default" is set via code
- Branch
- default is determined from webhooks
- to view Documentation or view Source Code
- default is view documentation. view src can be specified
- Repo
- Receive webhook notifications from git repos
- Pull repo updates (after webhook notification)
- Run from cli to view documentation or source for current working directory
Architecture
- Router component has Url methods & does the routing
- Webhook base class provides API for receiving webhook notifications
- Handles webhook routing (instead of the Router component, I think)
- Webhook subclass for Gitlab to specifically handle Gitlab webhooks
- Might make one for Github too (convert the current Github webhook handling class)
- Call the Git class to pull updates
- Git class handles:
- Setup initial repos (git init bare??)
- Pull repo updates
- A DirectoryViewer class
- Inputs
- Root directory
- relative path to view
- Outputs
- A file list
- multi-dim array with all files that should be listed.
- File content, maybe? Just the raw output? I don't know.
- A file list
- Inputs
- Views for:
- General layout
- File tree
- Content area
- Directory listing
- Projects Page
- Configs:
- Order to display projects in
- base url
- Other stuff? Probably
I think this next bullet point is basically settled & can be deleted.
- a class for loading the correct content from disk. The router breaks the url into the relevant components, but calls THIS class to actually load the correct content. I don't really need a Repo class & Branch class. Basically there are two steps: Find the project folder on disk. Find the branch folder on disk. if its a documentation request, find the documentation folder.
- So there are two ways to route this:
- Documentation
- Source Code
- There are times I will need to know things like:
- Project details (name, url, description)
- Whether Documentation request or Source Code request
- source path
- documentation path
- So there are two ways to route this:
Okay, so I need a class that represents the root folder being displayed. This class doesn't care if we're looking at one repo, or documentation, or 15 different repos. It simply handles viewing folders/files within a directory. I think another piece of code (the router) determines that root directory & creates this class.