mirror of
https://github.com/CatalaLang/catala.git
synced 2024-09-16 14:57:13 +03:00
Update the generation process of the website assets
Now they're more simply bundled into a `tar` file generated from the `Makefile`.
This commit is contained in:
parent
e0928677b1
commit
cafad727fe
14
INSTALL.md
14
INSTALL.md
@ -137,19 +137,17 @@ To uninstall, use
|
|||||||
#### Updating [`@catala-lang/catala-web-assets`](https://www.npmjs.com/package/@catala-lang/catala-web-assets)
|
#### Updating [`@catala-lang/catala-web-assets`](https://www.npmjs.com/package/@catala-lang/catala-web-assets)
|
||||||
|
|
||||||
The Catala website features assets generated by the Catala compiler. They are
|
The Catala website features assets generated by the Catala compiler. They are
|
||||||
needed to build the website. To produce them, simply run
|
needed to build the website. To produce them, run
|
||||||
|
|
||||||
make website-assets DUNE_PROFILE=release
|
make website-assets.tar
|
||||||
|
|
||||||
Then, use a helper script to copy them over to the `assets` directory of the
|
Then, get the base [`catala-web-assets`](https://github.com/CatalaLang/catala-web-assets)
|
||||||
[`catala-web-assets`](https://github.com/CatalaLang/catala-web-assets)
|
repository, and untar the generated file within the `assets/` subdirectory:
|
||||||
repository.
|
|
||||||
|
|
||||||
./generate_website_assets.sh <path-to-catala-web-assets>/assets
|
tar xf website-assets.tar -C <path-to-catala-web-assets>/assets
|
||||||
|
|
||||||
> You will need the `groff` executable to generate the HTML versions of the man
|
> You will need the `groff` executable to generate the HTML versions of the man
|
||||||
pages, as well as the `rsync` executable to transfer files (preferred to `cp`)
|
pages.
|
||||||
because it also works with a remote server.
|
|
||||||
|
|
||||||
## Syntax highlighting
|
## Syntax highlighting
|
||||||
|
|
||||||
|
65
Makefile
65
Makefile
@ -217,15 +217,27 @@ tests/%: .FORCE
|
|||||||
# (and therefore the doc target here)
|
# (and therefore the doc target here)
|
||||||
WEBSITE_ASSETS = grammar.html catala.html clerk.html
|
WEBSITE_ASSETS = grammar.html catala.html clerk.html
|
||||||
|
|
||||||
$(addprefix _build/default/,$(WEBSITE_ASSETS)):
|
WEBSITE_ASSETS_EXAMPLES = \
|
||||||
dune build $@
|
tutorial_en/tutorial_en.html \
|
||||||
|
tutoriel_fr/tutoriel_fr.html \
|
||||||
|
us_tax_code/us_tax_code.html \
|
||||||
|
allocations_familiales/allocations_familiales.html \
|
||||||
|
allocations_familiales/allocations_familiales_schema.json \
|
||||||
|
aides_logement/aides_logement.html \
|
||||||
|
aides_logement/aides_logement_schema.json
|
||||||
|
|
||||||
|
WEBSITE_ASSETS_ALL = $(WEBSITE_ASSETS) $(addprefix catala-examples.tmp/,$(WEBSITE_ASSETS_EXAMPLES))
|
||||||
|
|
||||||
website-assets-base: build
|
website-assets-base: build
|
||||||
dune build $(WEBSITE_ASSETS)
|
$(call local_tmp_clone,catala-examples) && \
|
||||||
|
dune build $(addprefix _build/default/,$(WEBSITE_ASSETS_ALL))
|
||||||
|
|
||||||
|
website-assets.tar:
|
||||||
|
# $(MAKE) DUNE_PROFILE=release website-assets-base
|
||||||
|
tar cf $@ $(foreach file,$(WEBSITE_ASSETS_ALL),-C $(CURDIR)/$(dir _build/default/$(file)) $(notdir $(file)))
|
||||||
|
|
||||||
#> website-assets : Builds all the assets necessary for the Catala website
|
#> website-assets : Builds all the assets necessary for the Catala website
|
||||||
website-assets:
|
website-assets: website-assets.tar
|
||||||
$(MAKE) DUNE_PROFILE=release website-assets-base
|
|
||||||
|
|
||||||
##########################################
|
##########################################
|
||||||
# Miscellaneous
|
# Miscellaneous
|
||||||
@ -238,32 +250,35 @@ all: \
|
|||||||
runtimes \
|
runtimes \
|
||||||
plugins
|
plugins
|
||||||
|
|
||||||
BRANCH=$(shell git branch --show-current 2>/dev/null || echo master)
|
BRANCH = $(shell git branch --show-current 2>/dev/null || echo master)
|
||||||
|
|
||||||
|
# Attempt a clone of the named CatalaLang repo into <name>.tmp, using local git
|
||||||
|
# objects in ../<name> if available, the branch with the same name as the
|
||||||
|
# current branch if it exists (master otherwise), and falling back to a local
|
||||||
|
# clone of ../<name> if the network is not available. The temp dir is removed
|
||||||
|
# when the shell terminates, so this must be run in the same "Makefile line" as
|
||||||
|
# its usage.
|
||||||
|
local_tmp_clone = { \
|
||||||
|
rm -rf $1.tmp && \
|
||||||
|
trap "rm -rf $1.tmp" EXIT && \
|
||||||
|
git clone https://github.com/CatalaLang/$1 \
|
||||||
|
--depth 1 --reference-if-able ../$1 \
|
||||||
|
$1.tmp -b $(BRANCH) || \
|
||||||
|
git clone https://github.com/CatalaLang/$1 \
|
||||||
|
--depth 1 --reference-if-able ../$1 \
|
||||||
|
$1.tmp || \
|
||||||
|
git clone -s ../$1 $1.tmp $(BRANCH) || \
|
||||||
|
git clone -s ../$1 $1.tmp master; \
|
||||||
|
}
|
||||||
|
|
||||||
#> alltest : Runs more extensive tests, including the examples and french-law. Use before push!
|
#> alltest : Runs more extensive tests, including the examples and french-law. Use before push!
|
||||||
alltest: dependencies-python
|
alltest: dependencies-python
|
||||||
@export DUNE_PROFILE=check && \
|
@export DUNE_PROFILE=check && \
|
||||||
dune build @update-parser-messages @install @runtest && \
|
dune build @update-parser-messages @install @runtest && \
|
||||||
$(CLERK_BIN) test tests && \
|
$(CLERK_BIN) test tests && \
|
||||||
rm -rf catala-examples.tmp french-law.tmp && \
|
$(call local_tmp_clone,catala-examples) && \
|
||||||
trap "rm -rf catala-examples.tmp french-law.tmp $$TMP" EXIT && \
|
|
||||||
{ git clone https://github.com/CatalaLang/catala-examples \
|
|
||||||
--depth 1 --reference-if-able ../catala-examples \
|
|
||||||
catala-examples.tmp -b $(BRANCH) || \
|
|
||||||
git clone https://github.com/CatalaLang/catala-examples \
|
|
||||||
--depth 1 --reference-if-able ../catala-examples \
|
|
||||||
catala-examples.tmp || \
|
|
||||||
git clone -s ../catala-examples catala-examples.tmp $(BRANCH) || \
|
|
||||||
git clone -s ../catala-examples catala-examples.tmp master; } && \
|
|
||||||
$(CLERK_BIN) test catala-examples.tmp && \
|
$(CLERK_BIN) test catala-examples.tmp && \
|
||||||
{ git clone https://github.com/CatalaLang/french-law \
|
$(call local_tmp_clone,french-law) && \
|
||||||
--depth 1 --reference-if-able ../french-law \
|
|
||||||
french-law.tmp -b $(BRANCH) || \
|
|
||||||
git clone https://github.com/CatalaLang/french-law \
|
|
||||||
--depth 1 --reference-if-able ../french-law \
|
|
||||||
french-law.tmp || \
|
|
||||||
git clone -s ../french-law french-law.tmp $(BRANCH) || \
|
|
||||||
git clone -s ../french-law french-law.tmp master; } && \
|
|
||||||
make -C french-law.tmp all PY_VENV_DIR=$(ROOT_DIR)/_python_venv
|
make -C french-law.tmp all PY_VENV_DIR=$(ROOT_DIR)/_python_venv
|
||||||
|
|
||||||
#> clean : Clean build artifacts
|
#> clean : Clean build artifacts
|
||||||
@ -288,4 +303,4 @@ help_catala:
|
|||||||
.PHONY: inspect clean all english allocations_familiales \
|
.PHONY: inspect clean all english allocations_familiales \
|
||||||
pygments install build_dev build doc format dependencies \
|
pygments install build_dev build doc format dependencies \
|
||||||
dependencies-ocaml catala.html help parser-messages plugins \
|
dependencies-ocaml catala.html help parser-messages plugins \
|
||||||
website-assets website-assets-base
|
website-assets.tar website-assets-base
|
||||||
|
@ -1,25 +0,0 @@
|
|||||||
#! /usr/bin/env sh
|
|
||||||
|
|
||||||
set -eux
|
|
||||||
|
|
||||||
cd "$(dirname "$0")"
|
|
||||||
|
|
||||||
if [ $# -ne 1 ]; then
|
|
||||||
echo "USAGE: \$1 DST where DST is the directory in which files have to be copied"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
BUILD=_build/default
|
|
||||||
|
|
||||||
rsync $BUILD/examples/allocations_familiales/allocations_familiales.html $1/
|
|
||||||
rsync $BUILD/examples/aides_logement/aides_logement.html $1/
|
|
||||||
rsync $BUILD/examples/us_tax_code/us_tax_code.html $1/
|
|
||||||
rsync $BUILD/examples/tutorial_en/tutorial_en.html $1/
|
|
||||||
rsync $BUILD/examples/tutoriel_fr/tutoriel_fr.html $1/
|
|
||||||
|
|
||||||
rsync $BUILD/grammar.html $1/
|
|
||||||
rsync $BUILD/catala.html $1/
|
|
||||||
rsync $BUILD/clerk.html $1/
|
|
||||||
|
|
||||||
rsync $BUILD/examples/allocations_familiales/allocations_familiales_schema.json $1/
|
|
||||||
rsync $BUILD/examples/aides_logement/aides_logement_schema.json $1/
|
|
Loading…
Reference in New Issue
Block a user