Skip to content

Commit 50133e5

Browse files
authored
Merge pull request #20 from github/vdye/docs
Update documentation and installation scripts, fix bug
2 parents 65332ba + d3f3734 commit 50133e5

18 files changed

+738
-188
lines changed

Diff for: .github/workflows/release.yml

+4
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ jobs:
4747
uses: actions/setup-go@v3
4848
with:
4949
go-version: '1.19.0'
50+
- uses: ruby/setup-ruby@v1
51+
with:
52+
ruby-version: '3.2.1'
53+
- run: gem install asciidoctor
5054
- name: Clone repository
5155
uses: actions/checkout@v3
5256
- name: Build the release artifact

Diff for: .gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
/git-bundle-web-server
33
/bin/
44
/_dist/
5+
/_docs/

Diff for: .vscode/settings.json

+9
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@
1313
"editor.wordWrap": "off",
1414
"files.trimTrailingWhitespace": true,
1515
},
16+
"[asciidoc]": {
17+
"editor.detectIndentation": false,
18+
"editor.insertSpaces": true,
19+
"editor.tabSize": 2,
20+
"editor.wordWrap": "off",
21+
"files.trimTrailingWhitespace": true,
22+
},
1623
"[shellscript]": {
1724
"editor.detectIndentation": false,
1825
"editor.insertSpaces": false,
@@ -21,6 +28,8 @@
2128
"files.trimTrailingWhitespace": true,
2229
},
2330
"files.associations": {
31+
"*.adoc": "asciidoc",
32+
"*.asc": "asciidoc",
2433
"*.md": "markdown",
2534
"*.sh": "shellscript",
2635
"prerm": "shellscript",

Diff for: Makefile

+32-8
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,13 @@ NAME := git-bundle-server
66
VERSION :=
77
PACKAGE_REVISION := 1
88

9+
# Installation information
10+
INSTALL_ROOT := /
11+
912
# Helpful paths
1013
BINDIR := $(CURDIR)/bin
1114
DISTDIR := $(CURDIR)/_dist
15+
DOCDIR := $(CURDIR)/_docs
1216

1317
# Platform information
1418
GOOS := $(shell go env GOOS)
@@ -25,6 +29,23 @@ build:
2529
@mkdir -p $(BINDIR)
2630
GOOS="$(GOOS)" GOARCH="$(GOARCH)" go build -o $(BINDIR) ./...
2731

32+
.PHONY: doc
33+
doc:
34+
@scripts/make-docs.sh --docs="$(CURDIR)/docs/man" \
35+
--output="$(DOCDIR)"
36+
37+
# Installation targets
38+
.PHONY: install
39+
install: build doc
40+
@echo
41+
@echo "======== Installing to $(INSTALL_ROOT) ========"
42+
@scripts/install.sh --bindir="$(BINDIR)" \
43+
--docdir="$(DOCDIR)" \
44+
--uninstaller="$(CURDIR)/scripts/uninstall.sh" \
45+
--allow-root \
46+
--include-symlinks \
47+
--install-root="$(INSTALL_ROOT)"
48+
2849
# Packaging targets
2950
.PHONY: check-arch
3051
check-arch:
@@ -49,12 +70,13 @@ DEBDIR := $(DISTDIR)/deb
4970
DEB_FILENAME := $(DISTDIR)/$(NAME)_$(VERSION)-$(PACKAGE_REVISION)_$(PACKAGE_ARCH).deb
5071

5172
# Targets
52-
$(DEBDIR)/root: check-arch build
73+
$(DEBDIR)/root: check-arch build doc
5374
@echo
5475
@echo "======== Formatting package contents ========"
55-
@build/package/layout-unix.sh --bindir="$(BINDIR)" \
56-
--include-symlinks \
57-
--output="$(DEBDIR)/root"
76+
@scripts/install.sh --bindir="$(BINDIR)" \
77+
--docdir="$(DOCDIR)" \
78+
--include-symlinks \
79+
--install-root="$(DEBDIR)/root"
5880

5981
$(DEB_FILENAME): check-version $(DEBDIR)/root
6082
@echo
@@ -80,12 +102,13 @@ PKGDIR := $(DISTDIR)/pkg
80102
PKG_FILENAME := $(DISTDIR)/$(NAME)_$(VERSION)-$(PACKAGE_REVISION)_$(PACKAGE_ARCH).pkg
81103

82104
# Targets
83-
$(PKGDIR)/payload: check-arch build
105+
$(PKGDIR)/payload: check-arch build doc
84106
@echo
85107
@echo "======== Formatting package contents ========"
86-
@build/package/layout-unix.sh --bindir="$(BINDIR)" \
87-
--uninstaller="$(CURDIR)/build/package/pkg/uninstall.sh" \
88-
--output="$(PKGDIR)/payload"
108+
@scripts/install.sh --bindir="$(BINDIR)" \
109+
--docdir="$(DOCDIR)" \
110+
--uninstaller="$(CURDIR)/scripts/uninstall.sh" \
111+
--install-root="$(PKGDIR)/payload"
89112

90113
$(PKG_FILENAME): check-version $(PKGDIR)/payload
91114
@echo
@@ -111,3 +134,4 @@ clean:
111134
go clean ./...
112135
$(RM) -r $(BINDIR)
113136
$(RM) -r $(DISTDIR)
137+
$(RM) -r $(DOCDIR)

Diff for: README.md

+104-13
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# `git-bundle-server`: Manage a self-hosted bundle server
1+
# Git Bundle Server
22

33
[bundle-uris]: https://github.com/git/git/blob/next/Documentation/technical/bundle-uri.txt
44
[codeowners]: CODEOWNERS
@@ -15,26 +15,86 @@ This repository is under active development, and loves contributions from the
1515
community :heart:. Check out [CONTRIBUTING][contributing] for details on getting
1616
started.
1717

18-
## Cloning and Building
18+
## Getting Started
1919

20-
Be sure to clone inside the `src` directory of your `GOROOT`.
20+
### Installing
2121

22-
Once there, you can build the `git-bundle-server` and `git-bundle-web-server`
23-
executables with
22+
> :warning: Installation on Windows is currently unsupported :warning:
23+
24+
<!-- Common sources -->
25+
[releases]: https://github.com/github/git-bundle-server/releases
26+
27+
#### Linux
28+
29+
Debian packages (for x86_64 systems) can be downloaded from the
30+
[Releases][releases] page and installed with:
31+
32+
```bash
33+
sudo dpkg -i /path/to/git-bundle-server_VVV-RRR_amd64.deb
34+
35+
# VVV: version
36+
# RRR: package revision
37+
```
38+
39+
#### MacOS
40+
41+
Packages for both Intel and M1 systems can be downloaded from the
42+
[Releases][releases] page (identified by the `amd64` vs `arm64` filename suffix,
43+
respectively). The package can be installed by double-clicking the downloaded
44+
file, or on the command line with:
45+
46+
```bash
47+
sudo installer -pkg /path/to/git-bundle-server_VVV-RRR_AAA.pkg -target /
48+
49+
# VVV: version
50+
# RRR: package revision
51+
# AAA: platform architecture (amd64 or arm64)
52+
```
53+
54+
#### From source
55+
56+
> To avoid environment issues building and executing Go code, we recommend that
57+
> you clone inside the `src` directory of your `GOROOT`.
58+
59+
You can also install the bundle server application from source on any Unix-based
60+
system. To install to the system root, clone the repository and run:
2461

2562
```ShellSession
26-
$ go build -o . ./...
63+
$ make install
2764
```
2865

29-
## Testing and Linting
66+
Note that you will likely be prompted for a password to allow installing to
67+
root-owned directories (e.g. `/usr/local/bin`).
3068

31-
To run the project's unit tests, navigate to the repository root directory and
32-
run `go test -v ./...`.
69+
To install somewhere other than the system root, you can manually specify an
70+
`INSTALL_ROOT` when building the `install` target:
3371

34-
To run the project's linter, navigate to the repository root directory and run
35-
`go vet ./...`.
72+
```ShellSession
73+
$ make install INSTALL_ROOT=</your/install/root>
74+
```
75+
76+
### Uninstalling
77+
78+
#### From Debian package
79+
80+
To uninstall `git-bundle-server` if it was installed from a Debian package, run:
81+
82+
```ShellSession
83+
$ sudo dpkg -r git-bundle-server
84+
```
3685

37-
## Bundle Management through CLI
86+
#### Everything else
87+
88+
All other installation methods include an executable script that uninstalls all
89+
bundle server resources. On MacOS & Linux, run:
90+
91+
```ShellSession
92+
$ /usr/local/git-bundle-server/uninstall.sh
93+
```
94+
95+
## Usage
96+
97+
### Repository management
3898

3999
The following command-line interface allows you to manage which repositories are
40100
being managed by the bundle server.
@@ -73,7 +133,7 @@ being managed by the bundle server.
73133
* `git-bundle-server delete <route>`: Remove the configuration for the given
74134
`<route>` and delete its repository data.
75135

76-
## Web Server Management
136+
### Web server management
77137

78138
Independent of the management of the individual repositories hosted by the
79139
server, you can manage the web server process itself using these commands:
@@ -85,6 +145,37 @@ server, you can manage the web server process itself using these commands:
85145
Finally, if you want to run the web server process directly in your terminal,
86146
for debugging purposes, then you can run `git-bundle-web-server`.
87147

148+
## Local development
149+
150+
### Building
151+
152+
> To avoid environment issues building and executing Go code, we recommend that
153+
> you clone inside the `src` directory of your `GOROOT`.
154+
155+
In the root of your cloned repository, you can build the `git-bundle-server` and
156+
`git-bundle-web-server` executables a few ways.
157+
158+
The first is to use GNU Make; from the root of the repository, simply run:
159+
160+
```ShellSession
161+
$ make
162+
```
163+
164+
If you do not have `make` installed on your system, you may instead run (again
165+
from the repository root):
166+
167+
```ShellSession
168+
$ go build -o bin/ ./...
169+
```
170+
171+
### Testing and Linting
172+
173+
To run the project's unit tests, navigate to the repository root directory and
174+
run `go test -v ./...`.
175+
176+
To run the project's linter, navigate to the repository root directory and run
177+
`go vet ./...`.
178+
88179
## License
89180

90181
This project is licensed under the terms of the MIT open source license. Please

Diff for: build/package/layout-unix.sh

-76
This file was deleted.

Diff for: build/package/pkg/scripts/postinstall

+22-5
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,32 @@ PACKAGE=$1
55
INSTALL_DESTINATION=$2
66

77
# Directories
8-
INSTALL_TO="$INSTALL_DESTINATION/usr/local/git-bundle-server/"
9-
LINK_TO="$INSTALL_DESTINATION/usr/local/bin/"
10-
RELATIVE_LINK_TO_INSTALL="../git-bundle-server"
8+
APP_ROOT="$INSTALL_DESTINATION/usr/local/git-bundle-server"
9+
LINK_TO="$INSTALL_DESTINATION/usr/local/bin"
10+
RELATIVE_LINK_TO_BIN="../git-bundle-server/bin"
1111
mkdir -p "$LINK_TO"
1212

1313
# Create symlinks
14-
for program in "$INSTALL_TO"/bin/*
14+
for program in "$APP_ROOT"/bin/*
1515
do
16-
/bin/ln -Fs "$RELATIVE_LINK_TO_INSTALL/bin/$(basename $program)" "$LINK_TO/$(basename $program)"
16+
p=$(basename "$program")
17+
rm -f "$LINK_TO/$p"
18+
ln -s "$RELATIVE_LINK_TO_BIN/$p" "$LINK_TO/$p"
19+
done
20+
21+
for mandir in "$APP_ROOT"/share/man/man*/
22+
do
23+
mdir=$(basename "$mandir")
24+
LINK_TO="$INSTALL_DESTINATION/usr/local/share/man/$mdir"
25+
RELATIVE_LINK_TO_MAN="../../../git-bundle-server/share/man/$mdir"
26+
mkdir -p "$LINK_TO"
27+
28+
for manpage in "$mandir"/*
29+
do
30+
mpage=$(basename "$manpage")
31+
rm -f "$LINK_TO/$mpage"
32+
ln -s "$RELATIVE_LINK_TO_MAN/$mpage" "$LINK_TO/$mpage"
33+
done
1734
done
1835

1936
exit 0

0 commit comments

Comments
 (0)