colorful rat Ratfactor.com > Dave's Repos

reporat

A static website generator for Git repos written in Ruby.
git clone http://ratfactor.com/repos/reporat/reporat.git

reporat/devlog.txt

Download raw file: devlog.txt

1 I thought it would be a neat idea to inspire myself to do this project by 2 keeping track of how long it actually takes me to accomplish each part of it. 3 4 I've chosen Ruby because I like the aesthetics of the language and, like the 5 Python motto, it comes with " batteries included." 6 7 2023-09-22: Started! 8 9 Take a repo as a path from input, error if not found or no .git dir: 10 11 0854 to 0903 = 9 min 12 13 cd to repo dir, get repo 'name' as basename via git 14 (proves viability of backticks to shell out to git) 15 16 0840 to 0855 = 15 min 17 18 list files in current repo, "parse" list into array 19 20 0900 to 0923 = 23 min 21 22 hard-code output dir, append repo name as repo output 23 prompt to create dir if it doesn't exist 24 25 0923 to 0935 = 12 min 26 27 write initial index file to repo output dir 28 (include repo name as page title and file list as html bullets) 29 30 0942 to 0955 = 13 min 31 32 make raw dir for copies of the raw repo files 33 and html dir for individual file html pages 34 35 0902 to 0903 = 1 min 36 37 for each file: 38 39 * link in index to fname.html 40 41 0856 to 0857 = 1 min 42 43 * make a .html page for each file 44 45 0904 to 0917 = 13 min 46 47 * copy source file to output 48 49 0858 to 0859 = 1 min 50 51 * link to raw source file in page 52 53 0918 to 0920 = 2 min 54 55 * if image, display in page 56 57 0921 to 1926 = 5 min 58 59 * detect binary files... 60 61 * "normal" method attempts 62 63 1450 to 1523 = 33 min 64 65 * new idea: look for control characters and also 66 count newlines to get a feel for the 'shape' of the 67 file, *if* it is readable characters. (Minified .js source 68 won't pass this readability test.) 69 70 1637 to 1650 = 13 min 71 72 * continuing above idea - writing is_readable.rb to test 73 various files quickly... 74 then adapt to become a function in the program 75 76 0816 to 0910 = 54 min 77 78 * if text source, display with line nums 79 80 1248 to 1254 = 6 min 81 82 * make line nums into anchor links 83 84 1441 to 1446 = 5 min 85 86 * correctly display source HTML with pre whitespace and 87 right-justified line numbers 88 89 0950 to 1019 = 29 min 90 91 * Process README with tools pre-installed on Slackware Linux 92 93 * detect readme file and its type (text or markdown) 94 95 0827 to 0911 = 44 min 96 97 * .txt verbatim in <pre> 98 99 0915 to 0921 = 6 min 100 101 * .md/.markdown via "rat-flavored markdown", whatever that ends up being 102 103 1256 to 1305 = 9 min (markdown_py - python, already installed) 104 1611 to 1631 = 20 min (RDoc and darkfish - ruby, core module) 105 0841 to 0847 = 6 min (discount - c) 106 1736 to 1741 = 5 min continued... 107 108 * asciidoc? (NOPE! I'm gonna convert those to md) 109 110 * index/landing page should contain file list (limit to first 20) 111 followed by readme 112 113 1824 to 1832 = 9 min 114 115 * Add LICENSE and update README 116 117 0740 to 0809 = 29 min 118 119 * Remove hard-coded output path, get it from command line args 120 121 0813 to 0819 = 6 min 122 123 * Common page header 124 125 * header function - just return string with html 126 127 1023 to 1035 = 12 min 128 129 * and take css link (optional) from 3rd cli arg 130 131 1410 to 1425 = 15 min 132 133 * get description from .git/description file 134 135 1442 to 1452 = 10 min 136 137 * make relative links to repo pages in header 138 (and spent some time making header prettier) 139 140 1520 to 1545 = 25 min 141 142 * Make files page (simple list, can hide bullets with css) 143 144 1631 to 1637 = 6 min 145 146 * Make commit history page (simple log in <pre> tag) 147 148 1638 to 1642 = 4 min 149 150 * Draw a cute little ratty logo 151 152 1808 to 1843 = 35 min 153 154 * Make .git link for http cloning 155 156 * first, do a proof of concept... 157 158 2105 to 2128 = 23 min 159 160 * create bare repo foo.git upon new repo creation 161 (git clone --bare input_foo output/foo/foo.git) 162 163 0750 to 0804 = 14 min 164 165 * pull changes when already exists and update 4 web: 166 cd output/foo/foo.git 167 git ???? <--- turns out it's fetch to update 168 git update-server-info 169 170 0805 to 0839 = 34 min 171 172 * add clone instructions to header, test it 173 174 0841 to 0850 = 9 min 175 176 * Make common footer with RepoRat link and date-time generated 177 178 0908 to 0916 = 8 min 179 180 * Use a config file (itself ruby source!) instead of CLI args 181 182 1143 to 1221 = 38 min 183 184 * run from repo root, don't take repo dir from cli arg 185 186 1937 to 1949 = 12 min 187 188 2023-09-29: Well, that does it for now.