djcev.com

//

Git Repos / blogofile_gitview / README.md

Last update to this file was on 2021-07-31 at 13:07.

Show README.md

### blogofile_gitview

This is a git repository viewer that generates static HTML pages
(like [stagit][st] or [git-arr][ga]) implemented as a controller for
blogofile_blog.

This is really only a program fragment; it may be most useful as an
example.

This script and all files in this repository are provided under the
MIT License, please see the file LICENSE for more information.

### Requirements

In short: you need blogofile, blogofile_blog, pygit2, and pygments.

To run this you'll need a working installation of blogofile and
blogofile_blog, at least version 0.8.3, with all its dependencies,
configured to work with Python 3. You'll also need pygit2, at least
version 1.5.0.

### Installation

First copy "\_controllers/gitview.py" to your
"blogofile_blog/site_src/\_controllers" directory, then copy the
"\_templates/gitview" directory into "blogofile_blog/site_src/\_templates".
Then add the lines in sample_config.py to your \_config.py changing
the values as necessary.

### Usage and Configuration

Create a directory in your blogofile_blog site_src with the same name
as the value of gitview.reporoot (default "repos") and copy any
git repositories you want to display into it. Re-build your site
to run the gitview controller and check your site output dir (default
"\_site") for a directory named after gitview.path (default "code") for
the script's output.

This script has only been tested with bare repos (and pretty simple ones
at that - no submodules or anything fancy).

You'll want to edit the templates, I think. A bit of sample CSS to go
with the template is available in css/style.css . The default repo list
function reads the files "description" and "owner" in the git repo (the
same way stagit does). If those files aren't found then "Empty description"
and "Undefined" will appear as the description and owner.

### Future Improvements

Further commit statistics could be added. Submodule handling and other
features found in more complex repos could also be implemented.

This script could be expanded into a full blogofile plugin. I doubt I'll
ever have need to do that myself, but it's an option.

There are a number of output-caching strategies that could be implemented
for this script, to avoid building static files for a repo that hasn't
changed. I'll look into it when it eventually becomes a problem for me.

Lastly I am not at all convinced I did any of this right, as I know very
little about the workings of git. So that's something to double-check.

### Contact

If you find this useful, or want to report bugs, or send patches, or
have any questions or comments, I can be reached at <cvanderz@gmail.com>.

[st]: https://git.codemadness.org/stagit/
[ga]: https://blitiri.com.ar/git/r/git-arr/

Return to the top of this page or return to the overview of this repo.

Log README.md

Date Commit Message Author + -
2021-07-31 Update README re: branches, tags cev +2 -4
2021-07-25 README typo, git_repo.mako limit to 80 char width cev +1 -1
2021-07-25 Initial commit cev +72  

Return to the top of this page or return to the overview of this repo.