~skiqqy/gwiki

f588c8b370f8ee63dc64e3005fddaecefd3250e1 — Stephen Cochrane 6 months ago 822640f master
Tidy up and added new feature
2 files changed, 27 insertions(+), 3 deletions(-)

M README.md
M entry.sh
M README.md => README.md +17 -0
@@ 60,3 60,20 @@ a mkdocs project), gwiki then pulls, builds, and deploys this wiki.

Then if you wish to add a wiki to be deployed, you simply have to update
`config` appropriatly, and push the changes, gwiki does the rest!

### Valid wiki repo

A valid wiki must have

* `Makefile` in the project root, which builds the website with `$ make`

Optionally, the wiki repo may have the following

* `.gwiki/init.sh` Bash/POSIX sh script which sets up the deps.
	- Note, the container is alpine based, hence you may install needed
	  packages using alpines package manager `apk`.
* `config`, this may specfiy subwikis, in which gwiki must pull, and build, it
  also acts in a similar manor to `.gwiki/init.sh`, except it gets called every
  build cycle, to specfiy subwikis, config should contain something like below:
  `wikis=( 'https://some.git.repo/' 'https://another.git.repo' )`


M entry.sh => entry.sh +10 -3
@@ 88,10 88,10 @@ watch()
			if [ ! -d "$root/wiki/$(basename "$wiki")" ]
			then
				git clone "$wiki" "$root/wiki/$(basename "$wiki")"
				pushd "$root/wiki/$(basename "$wiki")"
				pushd "$root/wiki/$(basename "$wiki")" || return 1
				make         # Try make
				mkdocs build # Try mkdocs
				popd
				popd || return 1
			fi

			watch "$root/wiki/$(basename "$wiki")"


@@ 112,10 112,18 @@ deploy () {

	cd "$root" || return 1

	# Run init.sh, if it exists
	if [ -f .gwiki/init.sh ]
	then
		echo "Running init.sh"
		. .gwiki/init.sh
	fi

	# Try different builds
	make         # Try make
	mkdocs build # Try mkdocs

	watch & # Setup watcher
	# Start the web server.
	printf 'Starting Web Server\n'
	/usr/sbin/lighttpd -D -f /etc/lighttpd/lighttpd.conf


@@ 127,5 135,4 @@ init
. /etc/gwiki/config || return 1

root='/deploy'
watch & # Setup watcher
deploy  # Deploy