Skip to content

Commit

Permalink
add check_hugo_version to makefile
Browse files Browse the repository at this point in the history
* Adds checking of current hugo version installed
* checks the current hugo version installed and verifies if the correct
hugo version required is installed before serve.
* adds .tool-versions to gitignore - an autogenerated file by asdf.

Signed-off-by: bupd <[email protected]>
  • Loading branch information
bupd committed Nov 15, 2024
1 parent a0a6180 commit be4dac5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,4 @@ Thumbs.db
*.un~
.idea/
.hugo_build.lock
.tool-versions
15 changes: 14 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
HUGO_VERSION_REQUIRED="v0.74.0"
EXTENDED_REQUIRED="extended"

check_hugo_version:
@version=$$(hugo version | head -n 1 | awk '{print $$5}' | sed 's/-.*//'); \
extended=$$(hugo version | head -n 1 | grep -o 'extended'); \
if [ "$$version" != "$(HUGO_VERSION_REQUIRED)" ] || [ "$$extended" != "$(EXTENDED_REQUIRED)" ]; then \
echo "Error: Current Hugo version is $$version. AND is not $(HUGO_VERSION_REQUIRED) extended version."; \
exit 1; \
else \
echo "Hugo version $$version is correct and is extended version."; \
fi

clean:
rm -rf public resources

prepare:
$(CURDIR)/load-docs.sh

serve:
serve: check_hugo_version
hugo server \
--bind 0.0.0.0 \
--buildDrafts \
Expand Down

0 comments on commit be4dac5

Please sign in to comment.