ivoa / ivoa-web

ivoa.net website static web pages
Creative Commons Attribution Share Alike 4.0 International
3 stars 2 forks source link

Add a Makefile to install Hugo and start preview #15

Closed gmantele closed 5 months ago

gmantele commented 5 months ago

Makefile to perform few Hugo actions. By default, the make command returns the following listing of available commands:

Available targets:

* help        Display this help (i.e. list all available targets). 
              (DEFAULT TARGET)

* preview     Start the preview service (on port 1313). All required 
              tools are installed/upgraded automatically, when needed.

* list-draft  List all draft pages (i.e. all pages only visible 
              in preview mode).

* install     Install Hugo (or upgrade it if a different version is 
              set in Makefile).

* uninstall   Uninstall Hugo.

Fixes #14

gmantele commented 5 months ago

This Makefile is an adapted version of the one I used for the website I am managing. We can of course easily rename targets, or even add/remove some.

gmantele commented 5 months ago

The target preview calls a bash script doing several things (which were quite complicated to do in a Makefile):

  1. Check whether the port 1313 is available or not. If not, an error message is displayed with the PID of the currently running Hugo preview.
  2. Start Hugo in preview + watch mode.
  3. Wait a bit for it to be operational.
  4. Open the preview website in a web browser.
gmantele commented 5 months ago

I tested locally on my laptop (an outdated fedora) and it works. I'm not sure we will initially use the draft list feature, but it makes sense to have it there for later.

Good to know that it works on an outdated Fedora. I had not yet user with this Linux distribution.