Skip to content

Commit 09ecccb

Browse files
pedrolucasphonza
authored andcommitted
Add documentation
Documentation is available in docs in the format of a scdoc file. Within each release, it should be run `make docs` which will convert the file to a traditional troff page which will be included in the final tarball and installed if available.
1 parent a9f07c7 commit 09ecccb

File tree

5 files changed

+132
-4
lines changed

5 files changed

+132
-4
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@ bin
33
pkg/statik
44
smithy.yml
55
smithy
6+
smithy.1
7+
smithy.yml.5

Makefile

+11-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
BUILD_VERSION ?= $(shell git describe --always --abbrev=40 --dirty)
22

3+
SCDOC = scdoc
34
PREFIX?=/usr/local
45
BINDIR?=$(PREFIX)/bin
56
SHAREDIR?=$(PREFIX)/share/smithy
7+
MANDIR?=$(PREFIX)/share/man
68

79
LDFLAGS="-X github.com/honza/smithy/cmd.SmithyVersion=${BUILD_VERSION}"
810
MODCACHE := $(shell go env GOMODCACHE)
@@ -18,10 +20,16 @@ smithy: bin/statik include/*.html
1820
smithy.yml:
1921
./smithy generate > smithy.yml
2022

23+
docs:
24+
$(SCDOC) < docs/smithy.1.scd > smithy.1
25+
$(SCDOC) < docs/smithy.yml.5.scd > smithy.yml.5
26+
2127
install: all
2228
mkdir -m755 -p $(DESTDIR)$(BINDIR) $(DESTDIR)$(SHAREDIR)
23-
install -m755 smithy $(DESTDIR)$(BINDIR)/smithy
24-
install -m644 smithy.yml $(DESTDIR)$(SHAREDIR)/smithy.yml
29+
cp -f smithy $(DESTDIR)$(BINDIR)/smithy
30+
cp -f smithy.yml $(DESTDIR)$(SHAREDIR)/smithy.yml
31+
cp -f smithy.1 $(DESTDIR)$(MANDIR)/man1/smithy.1 2>/dev/null || true
32+
cp -f smithy.yml.5 $(DESTDIR)$(MANDIR)/man5/smithy.yml.5 2>/dev/null || true
2533

2634
uninstall: all
2735
rm -r $(DESTDIR)$(BINDIR)/smithy
@@ -36,8 +44,7 @@ gofmt:
3644
go fmt ./pkg/... ./cmd/...
3745

3846
clean:
39-
rm smithy smithy.yml
40-
rm -rf pkg/statik
47+
rm -rf smithy smithy.yml pkg/statik smithy.1 smithy.yml.5
4148

4249
.PHONY:
4350
smithy smithy.yml clean

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ Building
2020
-------------------------------------------------------------------------------
2121

2222
The only dependency is [Golang](https://golang.org/) 1.15 or higher.
23+
Contributors to smithy should have the optional
24+
[scdoc](https://sr.ht/~sircmpwn/scdoc) for generating documentation.
2325

2426
```
2527
$ git clone https://github.com/honza/smithy

docs/smithy.1.scd

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
smithy(1)
2+
3+
# NAME
4+
5+
smithy - a small git forge
6+
7+
# SYNOPSIS
8+
9+
*smithy* _command_ [<_options_>...]
10+
11+
# DESCRIPTION
12+
13+
*smithy* is a web frontend for git repositories. It's implemented entirely in
14+
Golang, compiles to a single binary, and it's fast and easy to deploy. Smithy
15+
is an alternative to cgit or gitweb, and doesn't seek to compete with Gitea and
16+
the like.
17+
18+
# COMMANDS
19+
20+
*generate*
21+
Generate a sample configuration file, outputs to *STDOUT*.
22+
Check *smithy.yml(5)* for more information.
23+
24+
*serve --config path/to/config.toml*
25+
Serve the application, you'll need to supply a configuration file.
26+
Outputs its log to *STDOUT*.
27+
28+
# GLOBAL FLAGS
29+
30+
*--debug*
31+
Display debug messages to *STDOUT*.
32+
33+
*--config <path>*
34+
Use the given configuration file. See *smithy.yml(5)* for a reference.
35+
36+
# AUTHORS
37+
38+
Maintained by Honza Pokorny <[email protected]>, who is assisted by other free
39+
software contributors. For more information about smithy development, see
40+
https://github.com/honza/smithy.

docs/smithy.yml.5.scd

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
smithy.yml(5)
2+
3+
# NAME
4+
5+
*smithy.yml* - configuration file for *smithy*(1)
6+
7+
# DESCRIPTION
8+
9+
This file describes where smithy should scan for repositories, their
10+
respectives titles, description and slug. Also if it should include the default
11+
styles and assets or if it should load from a respective directory.
12+
13+
# GLOBAL DIRECTIVES
14+
15+
*host: <address>*
16+
Address will be displayed on a repository, indicating the URL he can use
17+
to clone.
18+
19+
*port: <...>*
20+
Port to serve smithy from. You can use a reverse-proxy (nginx, apache) to
21+
expose smithy.
22+
23+
# GIT DIRECTIVES
24+
25+
*root: <path>*
26+
The main directory where smithy should scan for repositories.
27+
28+
*repos*
29+
A list of repositories and their respective configurations.
30+
31+
# STATIC DIRECTIVES
32+
33+
If you'd like to customize the templates or the css, you can grab the source
34+
code, copy the `include` directory somewhere, and then set `root`, and
35+
`templates.dir` to that directory.
36+
37+
*root: <path>*
38+
When set to an empty string, it will load the static assets bundled within
39+
the project.
40+
41+
*prefix: <path>*
42+
A given prefix that all assets will receive.
43+
44+
# TEMPLATES DIRECTIVES
45+
46+
*dir: <path>*
47+
The directory to load templates from.
48+
49+
# EXAMPLE CONFIGURATION
50+
51+
When manually building smithy from source, a sample config file will be
52+
included on `/usr/local/share/smithy/smithy.yml`.
53+
54+
```
55+
title: Smithy, a lightweight git force
56+
description: Publish your git repositories with ease
57+
host: git.example.com
58+
port: 3456
59+
git:
60+
root: "/srv/git"
61+
repos:
62+
- path: "git"
63+
slug: "git"
64+
title: "git"
65+
description: "git is a fast, scalable distributed revision control system"
66+
static:
67+
root: ""
68+
prefix: /static/
69+
templates:
70+
dir: ""
71+
```
72+
73+
# AUTHORS
74+
75+
Maintained by Honza Pokorny <[email protected]>, who is assisted by other free
76+
software contributors. For more information about smithy development, see
77+
https://github.com/honza/smithy.

0 commit comments

Comments
 (0)