so much simpler

This commit is contained in:
Yann Esposito (Yogsototh) 2021-05-07 00:21:41 +02:00
parent 771a21ff3e
commit 78c176d73e
Signed by untrusted user who does not match committer: yogsototh
GPG Key ID: 7B19A4C650D59646
7 changed files with 25 additions and 26 deletions

View File

@ -39,8 +39,9 @@ PANDOC := pandoc \
--standalone
$(DST_DIR)/%.html: $(SRC_DIR)/%.org $(TEMPLATE)
@mkdir -p $(dir $@)
$(PANDOC) $< \
--output $@
$(PANDOC) $< --output $@.tmp
minify --mime text/html $@.tmp > $@
@rm $@.tmp
ALL += $(DST_PANDOC_FILES)
# HTML INDEX
@ -51,6 +52,13 @@ $(HTML_INDEX): $(DST_PANDOC_FILES) $(MKINDEX)
$(MKINDEX)
ALL += $(HTML_INDEX)
# RSS
RSS := $(DST_DIR)/rss.xml
MKRSS := engine/mkrss.sh
$(RSS): $(DST_PANDOC_FILES) $(MKRSS)
$(MKRSS)
ALL += $(RSS)
# ORG -> GEMINI
EXT := .org
SRC_GMI_FILES ?= $(shell find $(SRC_DIR) -type f -name "*$(EXT)" $(NO_DRAFT))
@ -71,7 +79,12 @@ $(GMI_INDEX): $(DST_GMI_FILES) $(MK_GMI_INDEX)
$(MK_GMI_INDEX)
ALL += $(GMI_INDEX)
# RSS
GEM_ATOM := $(DST_DIR)/gem-atom.xml
MK_GEMINI_ATOM := engine/mk-gemini-atom.sh
$(GEM_ATOM): $(DST_GMI_FILES) $(MK_GEMINI_ATOM)
$(MK_GEMINI_ATOM)
ALL += $(GEM_ATOM)
# Images
SRC_IMG_FILES ?= $(shell find $(SRC_DIR) -type f -name "*.jpg" -or -name "*.jpeg" -or -name "*.gif" -or -name "*.png")
@ -94,23 +107,9 @@ $(DST_DIR)/%.png: $(SRC_DIR)/%.png
convert "$<" -quality 50 -resize 800x800\> "$@"
ALL += $(DST_IMG_FILES)
# OPTIM PHASE
OPTIM_DIR ?= _optim
ENGINE_DIR ?= engine
ENGINE_SCRIPTS := $(shell find $(ENGINE_DIR) -type f)
OPTIM := engine/pre-deploy.sh
$(OPTIM_DIR)/index.html:$(DST_RAW_FILES) $(DST_GMI_FILES) $(DST_PANDOC_FILES) $(HTML_INDEX) $(ENGINE_SCRIPTS) $(OPTIM)
@mkdir -p $(OPTIM_DIR)
$(OPTIM)
optim: $(OPTIM_DIR)/index.html
# DEPLOY
deploy: $(OPTIM_DIR)/index.html
deploy: $(ALL)
engine/sync.sh # deploy to her.esy.fun
engine/ye-com-fastpublish.hs # deploy to yannesposito.com (via github pages)
@ -119,5 +118,4 @@ fast: $(ALL)
.PHONY: clean
clean:
-rm -rf $(DST_DIR)/*
-rm -rf $(OPTIM_DIR)/*
-[ ! -z "$(DST_DIR)" ] && rm -rf $(DST_DIR)/*

View File

@ -5,5 +5,5 @@ echo "Watching $PWD/{src,templates}"
# fswatch --exclude='\\.#' src | while read event; do
fswatch --exclude='^.*\.#.*$' src templates | while read event; do
echo "$event"
make
./engine/build.sh
done

View File

@ -1,4 +1,4 @@
#!/bin/zsh
cd "$(git rev-parse --show-toplevel)" || exit 1
make
make -j $(getconf _NPROCESSORS_ONLN)

View File

@ -2,7 +2,7 @@
cd "$(git rev-parse --show-toplevel)" || exit 1
# Directory
webdir="_optim"
webdir="_site"
postsdir="$webdir/posts"
rssfile="$webdir/gem-atom.xml"

View File

@ -2,7 +2,7 @@
cd "$(git rev-parse --show-toplevel)" || exit 1
# Directory
webdir="_optim"
webdir="_site"
postsdir="$webdir/posts"
rssfile="$webdir/rss.xml"

View File

@ -1,7 +1,7 @@
#!/usr/bin/env zsh
cd "$(git rev-parse --show-toplevel)" || exit 1
webdir="_optim"
webdir="_site"
[[ -d $webdir ]] || { echo "no $webdir directory"; exit 1 }
@ -9,5 +9,6 @@ echo -n "Uploading website"
rsync --progress\
--partial \
--delete \
--exclude '.git' \
-avHe ssh ${webdir}/ root@esy.fun:/var/www/her.esy.fun/
echo " [done]"

View File

@ -67,7 +67,7 @@ checkDir = do
toolsExists <- testdir "engine"
if (not toolsExists)
then exit (ExitFailure 1)
else return "_optim"
else return "_site"
mainRepository = "git@github.com:yogsototh/yannesposito.com.git"