1<!DOCTYPE html>
2<html lang="en">
3<head>
4 <meta charset="UTF-8">
5 <meta name="viewport" content="width=device-width, initial-scale=1.0">
6 <title></title>
7 <link rel="stylesheet" href="sgw.css">
8</head>
9<body>
10
11 <header>
12 <div class="container">
13 <nav>
14 <a href="#">◀ all repos</a> <br />
15 <a href="index.html">index</a> ❘
16 <a href="files.html">files</a> ❘
17 <a href="commits.html">commits</a>
18 </nav>
19 </div>
20 </header>
21
22 <section class="container">
23 <h3>foocrypt/README.md</h3>
24 <div class="source-file">
25<a id="L1" href="#L1"> 1 </a><img src="raw/reporat.png" alt="RepoRat with a wizard hat (and wand)" style="float: right;">
26<a id="L2" href="#L2"> 2 </a>
27<a id="L3" href="#L3"> 3 </a># RepoRat
28<a id="L4" href="#L4"> 4 </a>
29<a id="L5" href="#L5"> 5 </a>A static website generator for Git repos written in Ruby.
30<a id="L6" href="#L6"> 6 </a>
31<a id="L7" href="#L7"> 7 </a>* Runs in milliseconds for small repos
32<a id="L8" href="#L8"> 8 </a>* 'About' page displays truncated file list followed by formatted README
33<a id="L9" href="#L9"> 9 </a>* 'Files' page lists all files with links to file pages
34<a id="L10" href="#L10"> 10 </a>* 'Commits' page contains simple Git commit log
35<a id="L11" href="#L11"> 11 </a>* Each human-readable source file has a viewing pages with linkable line numbers
36<a id="L12" href="#L12"> 12 </a>* Displays common image formats inline
37<a id="L13" href="#L13"> 13 </a>* Creates bare repo and link for "dumb http" Git cloning
38<a id="L14" href="#L14"> 14 </a>* Does **not** create pages for individual commit changes, branches, etc.
39<a id="L15" href="#L15"> 15 </a>
40<a id="L16" href="#L16"> 16 </a>## Usage
41<a id="L17" href="#L17"> 17 </a>
42<a id="L18" href="#L18"> 18 </a>Run RepoRat from the root directory of a Git repo.
43<a id="L19" href="#L19"> 19 </a>
44<a id="L20" href="#L20"> 20 </a>Example:
45<a id="L21" href="#L21"> 21 </a>
46<a id="L22" href="#L22"> 22 </a> $ cd my_stuff/cool_repo
47<a id="L23" href="#L23"> 23 </a> $ reporat.rb
48<a id="L24" href="#L24"> 24 </a> RepoRat generating site for:
49<a id="L25" href="#L25"> 25 </a> cool_repo
50<a id="L26" href="#L26"> 26 </a> A really neat program.
51<a id="L27" href="#L27"> 27 </a> Output complete at '/home/dave/my_repos/cool_repo'
52<a id="L28" href="#L28"> 28 </a>
53<a id="L29" href="#L29"> 29 </a>## Configuration
54<a id="L30" href="#L30"> 30 </a>
55<a id="L31" href="#L31"> 31 </a>There are enough parameters that taking them at the command line is unweildy.
56<a id="L32" href="#L32"> 32 </a>
57<a id="L33" href="#L33"> 33 </a>Therefore, you are **required** to create a config at `~/.config/reporat.conf.rb`.
58<a id="L34" href="#L34"> 34 </a>
59<a id="L35" href="#L35"> 35 </a>This is a pure Ruby source file with methods you define.
60<a id="L36" href="#L36"> 36 </a>
61<a id="L37" href="#L37"> 37 </a>See the example file in this repo (which happens to be a copy of _my_ current
62<a id="L38" href="#L38"> 38 </a>configuration):
63<a id="L39" href="#L39"> 39 </a>
64<a id="L40" href="#L40"> 40 </a><a href="html/reporat.conf.rb.html">reporat.conf.rb</a>
65<a id="L41" href="#L41"> 41 </a>
66<a id="L42" href="#L42"> 42 </a>Note: Please allow RepoRat to create the individual repo directories underneath
67<a id="L43" href="#L43"> 43 </a>the root output directory so it can determine if the repo is new or if it has
68<a id="L44" href="#L44"> 44 </a>been processed before.
69<a id="L45" href="#L45"> 45 </a>
70<a id="L46" href="#L46"> 46 </a>## Bare repos and "dumb http" cloning
71<a id="L47" href="#L47"> 47 </a>
72<a id="L48" href="#L48"> 48 </a>I've taken the unusual tactic of generating a new bare repo inside
73<a id="L49" href="#L49"> 49 </a>the output directory when it is first created. Each time RepoRat
74<a id="L50" href="#L50"> 50 </a>is re-run, the bare repo is re-synced with the latest changes and
75<a id="L51" href="#L51"> 51 </a>the internals are updated to make it work as a clone source.
76<a id="L52" href="#L52"> 52 </a>
77<a id="L53" href="#L53"> 53 </a>The bare repo is given the same name with `.git` appended as per convention:
78<a id="L54" href="#L54"> 54 </a>
79<a id="L55" href="#L55"> 55 </a> cool_repo/cool_repo.git
80<a id="L56" href="#L56"> 56 </a>
81<a id="L57" href="#L57"> 57 </a>Now the output directory is completely ready to be served as
82<a id="L58" href="#L58"> 58 </a>static content over a Web server as-is. Git can clone your repo
83<a id="L59" href="#L59"> 59 </a>from the bare repo path, discovering which files it needs to
84<a id="L60" href="#L60"> 60 </a>create the clone. No server setup of any kind is needed!
85<a id="L61" href="#L61"> 61 </a>
86<a id="L62" href="#L62"> 62 </a>## Requirements
87<a id="L63" href="#L63"> 63 </a>
88<a id="L64" href="#L64"> 64 </a>* Ruby 3.0 or higher
89<a id="L65" href="#L65"> 65 </a>* Git (obviously?)
90<a id="L66" href="#L66"> 66 </a>* <a href="https://www.pell.portland.or.us/~orc/Code/discount/">Discount</a>, a Markdown implementation in C by David Parsons.
91<a id="L67" href="#L67"> 67 </a>
92<a id="L68" href="#L68"> 68 </a>**No gems** are used! Just the standard library that comes with Ruby.
93<a id="L69" href="#L69"> 69 </a>
94<a id="L70" href="#L70"> 70 </a>## Fast and personal software development
95<a id="L71" href="#L71"> 71 </a>
96<a id="L72" href="#L72"> 72 </a>I've been keeping track of _exactly_ how long it takes me to work on this
97<a id="L73" href="#L73"> 73 </a>program. I'm doing this because I've always been curious and also because it's
98<a id="L74" href="#L74"> 74 </a>helping me stay focused and not waste my time on a lot of tangents.
99<a id="L75" href="#L75"> 75 </a>
100<a id="L76" href="#L76"> 76 </a>I've got times in minutes here:
101<a id="L77" href="#L77"> 77 </a>
102<a id="L78" href="#L78"> 78 </a><a href="html/devlog.txt.html">devlog.txt</a>
103<a id="L79" href="#L79"> 79 </a>
104<a id="L80" href="#L80"> 80 </a>Okay, this thing works pretty well and has all of the features I
105<a id="L81" href="#L81"> 81 </a>need to begin with. Let's see how I've done:
106<a id="L82" href="#L82"> 82 </a>
107<a id="L83" href="#L83"> 83 </a> $ ./time.rb
108<a id="L84" href="#L84"> 84 </a> I've been at this for 614 minutes (about 10.2 hours).
109<a id="L85" href="#L85"> 85 </a>
110<a id="L86" href="#L86"> 86 </a>And how big is it?
111<a id="L87" href="#L87"> 87 </a>
112<a id="L88" href="#L88"> 88 </a> $ wc -l reporat.rb
113<a id="L89" href="#L89"> 89 </a> 317 reporat.rb
114<a id="L90" href="#L90"> 90 </a>
115<a id="L91" href="#L91"> 91 </a>Seven days, mostly in the quiet morning time. Grand total of just
116<a id="L92" href="#L92"> 92 </a>over **ten hours and 300 lines of Ruby**. Not bad!
117<a id="L93" href="#L93"> 93 </a>
118<a id="L94" href="#L94"> 94 </a>This is currently specific to creating pages for my website, ratfactor.com, but
119<a id="L95" href="#L95"> 95 </a>it should be trivial to change a couple paths and make it work for you! If you
120<a id="L96" href="#L96"> 96 </a>have suggestions for generalizing this program, let me know.
121<a id="L97" href="#L97"> 97 </a>
122<a id="L98" href="#L98"> 98 </a>## Other static Git repo site generators
123<a id="L99" href="#L99"> 99 </a>
124<a id="L100" href="#L100"> 100 </a>RepoRat was written for me. If it doesn't suit you, maybe one of these will:
125<a id="L101" href="#L101"> 101 </a>
126<a id="L102" href="#L102"> 102 </a>* <a href="https://git.m455.casa/repo2html/">repo2html</a> by m455. RepoRat was directly inspired by this one. Written in Chicken Scheme (which generates C for compiling).
127<a id="L103" href="#L103"> 103 </a>* <a href="https://codemadness.org/git/stagit/file/README.html">stagit</a> by Hiltjo Posthuma. Another direct inspiration for RepoRat. Written in C.
128<a id="L104" href="#L104"> 104 </a>* <a href="https://git.8pit.net/depp/">depp</a> by Sören Tempel. The Motivation section of depp's readme nicely describes my own with RepoRat! Written in Go.
129<a id="L105" href="#L105"> 105 </a>* <a href="https://blitiri.com.ar/p/git-arr/">git-arr</a> by Alberto Bertogli. Generates an entire site with all of your repos at once. Written in Python.
130<a id="L106" href="#L106"> 106 </a>* <a href="https://git.mcksp.com/gituwa/">gituwa</a> by mcksp. Very nice-looking minimal static generator. Written in C.
131<a id="L107" href="#L107"> 107 </a>
132<a id="L108" href="#L108"> 108 </a>## License and what you can do with it
133<a id="L109" href="#L109"> 109 </a>
134<a id="L110" href="#L110"> 110 </a>I'm releasing this under the GNU GPLv3 license. Please see the
135<a id="L111" href="#L111"> 111 </a><a href="html/LICENSE.html">LICENSE</a> text file in this repo.
136<a id="L112" href="#L112"> 112 </a>
137<a id="L113" href="#L113"> 113 </a>In short, you can download, modify, and distribute this program.
138<a id="L114" href="#L114"> 114 </a>
139<a id="L115" href="#L115"> 115 </a>In particular, it might be useful for generating custom pages for your website.
140<a id="L116" href="#L116"> 116 </a>I'd love to hear about it if you do.
141 </div>
142 </section>
143
144 <footer>
145 <div class="container right">
146 <small>sgw | 2026-05-08T20:31:36.568Z</small>
147 </div>
148 </footer>
149
150</body>
151</html>