Skip to content

Commit

Permalink
docs: Address review comments by @Zimmi48
Browse files Browse the repository at this point in the history
  • Loading branch information
erikmd committed May 1, 2020
1 parent d9f7aa0 commit f623a57
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,10 @@ configuration and boilerplate files in the
[AAC Tactics](https://github.com/coq-community/aac-tactics)
project are generated as follows:
```shell
mustache meta.yml ../templates/default.nix.mustache > default.nix
mustache meta.yml ../templates/README.md.mustache > README.md
mustache meta.yml ../templates/.travis.yml.mustache > .travis.yml
mustache meta.yml ../templates/coq.opam.mustache > coq-aac-tactics.opam
mkdir -p .github/workflows
mustache meta.yml ../templates/coq-action.yml.mustache > .github/workflows/coq-action.yml
mustache meta.yml ../templates/default.nix.mustache > default.nix
mustache meta.yml ../templates/.travis.yml.mustache > .travis.yml
```
Other projects using the templates in a similar way include
[Chapar](https://github.com/coq-community/chapar) and
Expand All @@ -54,6 +52,14 @@ cd -
../templates/generate.sh
git add <the_generated_files>
```
Regarding continuous integration, the `generate.sh` script will create:
* a [Travis CI](https://docs.travis-ci.com/) configuration
[(based on opam + Nix)](./.travis.yml.mustache),
* or a [GitHub Action](https://help.github.com/en/actions) workflow
[(based on opam)](./coq-action.yml.mustache),

depending on whether `meta.yml` contains `travis: true` or `action: true`.

Keeping generated files under version control is not ideal, but `README.md` has to exist,
and generally this is a common practice when using build systems such as Autotools.
To get a `mustache` tool in, e.g., NixOS, you can run `nix-env -i mustache-go`.
Expand Down
14 changes: 10 additions & 4 deletions generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@

srcdir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )

# ask1() { local yn; echo -n "$* [Y/n] "; read -r -n 1 yn; [[ "$yn" =~ [Yy] ]] && echo && return 0; [ -z "$yn" ] && return 0; echo; return 1; }
# if ask1 "Question?"; then ...; else ...; fi

get_yaml() {
# Arg 1: the meta.yml path
# STDIN: the mustache code
Expand Down Expand Up @@ -45,7 +42,7 @@ for f in "$srcdir"/{,.}*.mustache; do
continue
fi
;;
.travis.yml | default.nix)
.travis.yml)
mustache='{{ travis }}'
bool=$(get_yaml meta.yml <<<"$mustache")
if [ -n "$bool" ] && [ "$bool" != false ]; then
Expand All @@ -54,6 +51,15 @@ for f in "$srcdir"/{,.}*.mustache; do
continue
fi
;;
default.nix)
mustache='{{ tested_coq_nix_versions }}'
bool=$(get_yaml meta.yml <<<"$mustache")
if [ -n "$bool" ] && [ "$bool" != false ]; then
: noop
else
continue
fi
;;
esac
echo "Generating $target..."
mustache meta.yml "$f" > "$target"
Expand Down

0 comments on commit f623a57

Please sign in to comment.