diff options
author | Thomas Letan <lthms@soap.coffee> | 2020-02-22 16:27:39 +0100 |
---|---|---|
committer | Thomas Letan <lthms@soap.coffee> | 2020-02-22 16:28:39 +0100 |
commit | f6bec1183c2ecaf58fc4e0ea291b55000692e23c (patch) | |
tree | 88b3ae64703a42359e607a3f331a9e9de1da1e69 /site/posts | |
parent | Use `tangle-org.el' during bootstrap (diff) |
Integrate `update-gitignore.sh' inside cleopatra
Diffstat (limited to 'site/posts')
-rw-r--r-- | site/posts/meta/Bootstrap.org | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/site/posts/meta/Bootstrap.org b/site/posts/meta/Bootstrap.org index 7e78e37..751e10c 100644 --- a/site/posts/meta/Bootstrap.org +++ b/site/posts/meta/Bootstrap.org @@ -184,7 +184,7 @@ The twist is, we derive the rule to tangle ~bootstrap.mk~ using ~<<extends>>~. #+BEGIN_SRC verbatim -<<extends(IN="Bootstrap.org", MK="bootstrap.mk")>> +<<extends(IN="Bootstrap.org", MK="bootstrap.mk", GF="scripts/update-gitignore.sh")>> #+END_SRC This means that modifying code block of ~<<extends>>~ is as “dangerous” as @@ -195,7 +195,7 @@ For purpose of illustrations, here is the snippet generated by Babel from the previous source block. #+BEGIN_SRC makefile :tangle Makefile :noweb yes -<<extends(IN="Bootstrap.org", MK="bootstrap.mk")>> +<<extends(IN="Bootstrap.org", MK="bootstrap.mk", GF="scripts/update-gitignore.sh")>> #+END_SRC From now on, the bootstrap process is completed: further generation processes @@ -242,7 +242,29 @@ build : ${CONTENTS} ${GENFILES} @soupault @echo " update .gitignore" @scripts/update-gitignore.sh ${CONTENTS} ${GENFILES} ${GENSASS} +#+END_SRC + +#+BEGIN_SRC bash :tangle scripts/update-gitignore.sh :tangle-mode (identity #o755) +#!/bin/bash + +BEGIN_MARKER="# begin generated files" +END_MARKER="# begin generated files" + +# remove the previous list of generated files to ignore +sed -i -e "/${BEGIN_MARKER}/,/${END_MARKER}/d" .gitignore +# remove trailing empty lines +sed -i -e :a -e '/^\n*$/{$d;N;};/\n$/ba' .gitignore +# output the list of files to ignore +echo "" >> .gitignore +echo ${BEGIN_MARKER} >> .gitignore +for f in $@; do + echo "${f}" >> .gitignore +done +echo ${END_MARKER} >> .gitignore +#+END_SRC + +#+BEGIN_SRC makefile :tangle bootstrap.mk serve : @echo " start a python server" @cd build; python -m http.server 2>/dev/null |