gshr
git static host repo -- generates static html for repos
git clone https://git.vogt.world/gshr.git
Log | Files | README.md | LICENSE
← Commit log
commit
message
Cleaning up, documenting.
author
Ben Vogt <[email protected]>
date
2023-04-05 18:11:17
stats
7 file(s) changed, 76 insertions(+), 33 deletions(-)
files
Makefile
README.md
examples/ghsr-simple.toml
examples/go-git.toml
gshr.css
gshr.toml
templates/partials.html
  1diff --git a/Makefile b/Makefile
  2index 40a9cf8..d54d5d8 100644
  3--- a/Makefile
  4+++ b/Makefile
  5@@ -20,28 +20,16 @@ build: Makefile target target/output  target/gshr.bin
  6 	@# intentionally blank, proxy for prerequisite.
  7 
  8 dev: Makefile target target/output  target/gshr.bin
  9-	./target/gshr.bin \
 10-    -c=gshr.toml \
 11-    -o=target/output \
 12-		&& \
 13-    cd $(PWD)/target/output && \
 14-    python3 -m http.server 8000
 15+	./target/gshr.bin -c=gshr.toml -o=target/output \
 16+    cd target/output && python3 -m http.server 80
 17 
 18 dev-example-go-git: Makefile target target/output  target/gshr.bin
 19-	./target/gshr.bin \
 20-    -c=$(PWD)/examples/go-git.toml \
 21-    -c=$(PWD)/target/output \
 22-		&& \
 23-    cd $(PWD)/target/output && \
 24-    python3 -m http.server 8000
 25+	./target/gshr.bin -c=examples/go-git.toml -o=target/output \
 26+    cd target/output && python3 -m http.server 80
 27 
 28 dev-example-gshr: Makefile target target/output  target/gshr.bin
 29-	./target/gshr.bin \
 30-    -c=$(PWD)/examples/ghsr-simple.toml \
 31-    -o=$(PWD)/target/output \
 32-		&& \
 33-    cd $(PWD)/target/output && \
 34-    python3 -m http.server 8000
 35+	./target/gshr.bin -c=examples/gshr-simple.toml -o=target/output \
 36+    cd target/output && python3 -m http.server 80
 37 
 38 fmt:
 39 	go fmt
 40\ No newline at end of file
 41diff --git a/README.md b/README.md
 42index 865a397..de25ff8 100644
 43--- a/README.md
 44+++ b/README.md
 45@@ -3,23 +3,29 @@
 46 > Git static host repo.
 47 
 48 Command line tool for generating stand-alone, static git html hosting. Produces a single output
 49-directory for multiple repos, with html files for most preview-able text files, commit log, and
 50-more.
 51+directory for multiple repos, with...
 52+
 53+* Root index.html that lists all input repos.
 54+* Commit log page for each repo.
 55+* Individual commit page summarizing commit including diff.
 56+* File list page for each repo for the current HEAD ref.
 57+* File detail/preview page for each file in current HEAD ref.
 58+* Statically clone-able git folder for each repo.
 59 
 60 ---
 61 
 62-See for yourself:
 63+See for yourself.
 64 
 65-```
 66+```bash
 67 git clone https://github.com/vogtb/gshr
 68 cd gshr
 69 make dev-example-gshr
 70 ```
 71 
 72-Which basically runs
 73+Which basically runs this.
 74 
 75 ```bash
 76-gshr --config=${PWD}/example-configs/gshr-simple.toml --output=/tmp/gshr-output
 77+gshr -c=examples/gshr-simple.toml --output=/tmp/gshr-output
 78 cd /tmp/gshr-output
 79 python3 -m http.server 8000
 80 ```
 81@@ -39,15 +45,14 @@ Usage of gshr:
 82 
 83 The toml file needs to be in the format:
 84 
 85-* `base_url`: String for base url that this site will be served from. Eg: `"/"` or
 86-  `"https://mysite.com/git/"`.  
 87-* `site_name`: String overall site name. Displayed on the main index.html page that lists all
 88-  repos.
 89+* `base_url`: Base url for the site. Eg: `"/"` or `"https://mysite.com/git/"`.  
 90+* `site_name`: Site name displayed on the main index.html page that lists all repos.
 91 * `repos` List of data for each repo.
 92-  * `name`: String for rendering the name of this repo.
 93-  * `description`: String for rendering the description.
 94-  * `url`: String of the local absolute path, `git://`, `http://`, or `https://` url of the repo.
 95-  * `published_git_url`: String of where the repo lives. Eg: `[email protected]:vogtb/gshr.git`
 96+  * `name`: Name of repo to be used in display, paths.
 97+  * `description`: Description of repo used in html pages.
 98+  * `url`: Absolute, relative, or remote. eg: `/home/repo`, `./repo`, `git://`, `http://`.
 99+  * `published_git_url`: Optional Link to where the repo lives. Eg: `github.com/vogtb/gshr`.
100+  * `host_git`: Bool of whether we should package the repo up into `{name}.git` and host it.
101 
102 ---
103 
104@@ -101,3 +106,29 @@ output
105 ├── gshr.css
106 └── index.html
107 ```
108+
109+---
110+
111+# License
112+
113+The MIT License (MIT)
114+
115+Copyright (c) 2023 Ben Vogt
116+
117+Permission is hereby granted, free of charge, to any person obtaining a copy
118+of this software and associated documentation files (the "Software"), to deal
119+in the Software without restriction, including without limitation the rights
120+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
121+copies of the Software, and to permit persons to whom the Software is
122+furnished to do so, subject to the following conditions:
123+
124+The above copyright notice and this permission notice shall be included in all
125+copies or substantial portions of the Software.
126+
127+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
128+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
129+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
130+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
131+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
132+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
133+SOFTWARE.
134\ No newline at end of file
135diff --git a/examples/ghsr-simple.toml b/examples/ghsr-simple.toml
136index af46f49..c52f5cf 100644
137--- a/examples/ghsr-simple.toml
138+++ b/examples/ghsr-simple.toml
139@@ -1,4 +1,4 @@
140-base_url = "/"
141+base_url = "http://localhost/"
142 site_name = "public, self hosted git repositories"
143 
144 [[repos]]
145diff --git a/examples/go-git.toml b/examples/go-git.toml
146index 6fda03f..d626e9a 100644
147--- a/examples/go-git.toml
148+++ b/examples/go-git.toml
149@@ -1,4 +1,4 @@
150-base_url = "/"
151+base_url = "http://localhost/"
152 site_name = "example of a couple go repos on github"
153 
154 [[repos]]
155@@ -6,4 +6,4 @@ name = "go-git"
156 description = "A highly extensible Git implementation in pure Go."
157 url = "https://github.com/go-git/go-git"
158 published_git_url = "https://github.com/go-git/go-git"
159-
160+host_git = true
161diff --git a/gshr.css b/gshr.css
162index 9661e23..c650bd9 100644
163--- a/gshr.css
164+++ b/gshr.css
165@@ -254,6 +254,7 @@ div.content div.log {
166   display: block;
167 }
168 
169+div.content div.metadata table,
170 div.content div.log table,
171 div.content div.commit-detail table,
172 div.content div.index table,
173diff --git a/gshr.toml b/gshr.toml
174index fe598f8..3b52a0f 100644
175--- a/gshr.toml
176+++ b/gshr.toml
177@@ -1,9 +1,23 @@
178-base_url = "/"
179+base_url = "http://localhost/"
180 site_name = "public, self hosted git repositories"
181 
182 [[repos]]
183 name = "gshr"
184 description = "git static host repo -- generates static html for repos"
185 url = "/Users/bvogt/dev/src/ben/gshr"
186-published_git_url = "[email protected]:vogtb/gshr.git"
187+published_git_url = "github.com/vogtb/gshr"
188+host_git = true
189+
190+[[repos]]
191+name = "www"
192+description = "static site for www.vogt.world"
193+url = "/Users/bvogt/dev/src/ben/www"
194+published_git_url = "github.com/vogtb/www"
195+host_git = true
196+
197+[[repos]]
198+name = "f7"
199+description = "f7 is a spreadsheet formula execution library"
200+url = "/Users/bvogt/dev/src/ben/f7"
201+published_git_url = "github.com/vogtb/f7"
202 host_git = true
203diff --git a/templates/partials.html b/templates/partials.html
204index c8d6f53..d5519d8 100644
205--- a/templates/partials.html
206+++ b/templates/partials.html
207@@ -40,9 +40,16 @@
208       </tr>
209       <tr>
210         <td>
211-          <a href="{{ .PublishedGitURL }}">{{ .PublishedGitURL }}</a>
212+          git clone <a href="{{ .BaseURL }}{{ .Name }}.git">{{ .BaseURL }}{{ .Name }}.git</a>
213         </td>
214       </tr>
215+      {{ if not (eq .PublishedGitURL "") }}
216+      <tr>
217+        <td>
218+          alternate url: <a href="{{ .PublishedGitURL }}">{{ .PublishedGitURL }}</a>
219+        </td>
220+      </tr>
221+      {{ end }}
222       <tr>
223         <td>
224           <a href="{{ .BaseURL }}{{ .Name }}/log.html">Log</a>