Skip to content

Commit

Permalink
Make update-cge-www really complete
Browse files Browse the repository at this point in the history
  • Loading branch information
michaliskambi committed Jul 1, 2024
1 parent 62b15ba commit 7f3ad25
Showing 1 changed file with 25 additions and 23 deletions.
48 changes: 25 additions & 23 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Customize LANGUAGE_SUFFIX and ASCIIDOCTOR_LANGUAGE for non-English languages.
# See the "upload-all" below for examples how to use them.
# See the "copy-all" below for examples how to use them.
#
# Suffix added to input and output filenames.
LANGUAGE_SUFFIX:=
Expand Down Expand Up @@ -37,38 +37,40 @@ clean:
test:
$(MAKE) -C code-samples$(LANGUAGE_SUFFIX)/ clean all

SSH_TARGET:[email protected]
SCP_TARGET:=$(SSH_TARGET):/home/michalis/cge-html/
HTML_BASE:=https://castle-engine.io/

.PHONY: upload
upload: test clean all
scp $(NAME).html $(NAME).pdf patreon-wordmark.png $(SCP_TARGET)
$(TEST_BROWSER) $(HTML_BASE)$(NAME).html &
$(TEST_BROWSER) $(HTML_BASE)$(NAME).pdf &
ssh $(SSH_TARGET) www_permissions.sh
ssh $(SSH_TARGET) purge_cache.sh

.PHONY: upload-all
upload-all:
$(MAKE) upload
$(MAKE) upload LANGUAGE_SUFFIX=_russian ASCIIDOCTOR_LANGUAGE='-a lang=ru'
$(MAKE) upload LANGUAGE_SUFFIX=_bg ASCIIDOCTOR_LANGUAGE='-a lang=bg'
$(MAKE) upload LANGUAGE_SUFFIX=_ukrainian ASCIIDOCTOR_LANGUAGE='-a lang=ua'
scp modern_pascal_introduction_chinese.pdf $(SCP_TARGET)

# Utilities to update on server ------------------------------------------------
#
# Update cge-www contents assuming they are in $CASTLE_ENGINE_PATH/../cge-www/ .
#
# The full sequence to do update:
# - make upload # updates PDF; or make upload-all, if translations changed
# - make update-cge-www
# - commit and push cge-www repo,
# - www_synchronize_noimages.sh on sever.

# Variables (adjust CGE_WWW_PATH if it's not in the default location).
CGE_WWW_PATH:=$(CASTLE_ENGINE_PATH)/../cge-www/
CGE_ADOC_PATH:=$(CGE_WWW_PATH)/htdocs/doc/modern_pascal.adoc
CGE_SAMPLES_PATH:=$(CGE_WWW_PATH)/htdocs/doc/modern_pascal_code_samples/

# Copy from here to cge-www one language version.
.PHONY: copy-one-language
copy-one-language: test clean all
cp -f $(NAME).html $(NAME).pdf patreon-wordmark.png $(CGE_WWW_PATH)
$(TEST_BROWSER) $(HTML_BASE)$(NAME).html &
$(TEST_BROWSER) $(HTML_BASE)$(NAME).pdf &

# Copy from here to cge-www all languages' versions.
.PHONY: copy-all
copy-all:
$(MAKE) copy-one-language
$(MAKE) copy-one-language LANGUAGE_SUFFIX=_russian ASCIIDOCTOR_LANGUAGE='-a lang=ru'
$(MAKE) copy-one-language LANGUAGE_SUFFIX=_bg ASCIIDOCTOR_LANGUAGE='-a lang=bg'
$(MAKE) copy-one-language LANGUAGE_SUFFIX=_ukrainian ASCIIDOCTOR_LANGUAGE='-a lang=ua'
cp -f modern_pascal_introduction_chinese.pdf $(CGE_WWW_PATH)

# Copy from here to cge-www everything: HTML and PDF generated by AsciiDoctor,
# adoc (for rendering with CGE website styles), and code samples.
.PHONY: update-cge-www
update-cge-www:
update-cge-www: copy-all
# Sanity check.
if [ ! -f $(CGE_ADOC_PATH) ]; then \
echo "Missing $(CGE_ADOC_PATH), make sure CASTLE_ENGINE_PATH env variable is OK and cge-www is cloned alongside"; \
Expand Down

0 comments on commit 7f3ad25

Please sign in to comment.