about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-10-04 17:59:39 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-10-04 17:59:39 +0200
commit1e62086f74fae8df13cd69e8745395828ddcebb5 (patch)
tree4ec64388d626e6239f84719001049ce40d9ddeb0
parentfix(common/init): Check for not replaced `%INIT_` variables (diff)
downloadflake-templates-1e62086f74fae8df13cd69e8745395828ddcebb5.tar.gz
flake-templates-1e62086f74fae8df13cd69e8745395828ddcebb5.zip
chore(build): Regenerate
-rw-r--r--build/awk/.envrc2
-rw-r--r--build/awk/init19
-rw-r--r--build/c/.envrc3
-rw-r--r--build/c/init19
-rw-r--r--build/latex/academia/.envrc2
-rw-r--r--build/latex/academia/init19
-rw-r--r--build/latex/letter/.envrc2
-rw-r--r--build/latex/letter/init19
-rw-r--r--build/latex/presentation/.envrc2
-rw-r--r--build/latex/presentation/init19
-rw-r--r--build/rust/.envrc4
-rw-r--r--build/rust/Cargo.toml4
-rw-r--r--build/rust/flake.nix5
-rw-r--r--build/rust/init19
-rw-r--r--build/shell/.envrc2
-rw-r--r--build/shell/init19
16 files changed, 143 insertions, 16 deletions
diff --git a/build/awk/.envrc b/build/awk/.envrc
index 3bc1085..3db39e6 100644
--- a/build/awk/.envrc
+++ b/build/awk/.envrc
@@ -1,3 +1,5 @@
+#!/usr/bin/env sh
+
 use flake || use nix
 watch_file flake.nix
 
diff --git a/build/awk/init b/build/awk/init
index e8f72c8..b645441 100644
--- a/build/awk/init
+++ b/build/awk/init
@@ -30,6 +30,16 @@ die() {
     printf "init: ERROR: %s\n" "$1"
     exit 1
 }
+quotify() {
+    python -c "
+import sys
+if len(sys.argv) > 1:
+    text =''.join(sys.argv[1:])
+else:
+    text = sys.stdin.read()
+quoted_text = text.replace(\"'\", \"'\\\\''\")
+print(f\"'{quoted_text}'\", end='')" "$@"
+}
 
 # Prompt the user for a specific variable.
 # ## Args:
@@ -57,7 +67,7 @@ prompt() {
         LE "> " 0 " " "$pr_suggested_answer" ""
     fi
 
-    pr_new_variable="$(printf '%s="%s"' "$pr_variable_upper" "$REPLY")"
+    pr_new_variable="$(printf '%s=%s' "$pr_variable_upper" "$(quotify "$REPLY")")"
 
     eval "$pr_new_variable"
     printf "%s\n" "$pr_new_variable" >>"$replacement_file"
@@ -73,6 +83,8 @@ require mv
 require sed
 require chmod
 
+require python
+
 # necessary meta data
 prompt APPLICATION_NAME "The name of the application" "$(basename "$PWD")"
 prompt APPLICATION_NAME_STYLIZED "The stylized name of the application (for documentation)" "$(echo "$APPLICATION_NAME" | sed 's/[_-]/ /g' | sed 's/^\(\w\)/\U\1/g' | sed 's/ \(\w\)/ \U\1/g')"
@@ -169,6 +181,11 @@ while read -r var; do
     done
 done <"$replacement_file"
 
+if [ "$(rg "%INIT_" --files-with-matches | wc -l)" -ne 0 ]; then
+    echo "Following init variables were not replaced. This is a bug."
+    rg "%INIT_"
+fi
+
 # HACK: Re-add the executable permissions to files, which the nix template has somehow
 # removed <2024-04-02>
 chmod +x scripts/*
diff --git a/build/c/.envrc b/build/c/.envrc
index 8f9d5d7..3db39e6 100644
--- a/build/c/.envrc
+++ b/build/c/.envrc
@@ -1,7 +1,8 @@
+#!/usr/bin/env sh
+
 use flake || use nix
 watch_file flake.nix
 
-PATH_add ./target
 PATH_add ./scripts
 
 if on_git_branch; then
diff --git a/build/c/init b/build/c/init
index e8f72c8..b645441 100644
--- a/build/c/init
+++ b/build/c/init
@@ -30,6 +30,16 @@ die() {
     printf "init: ERROR: %s\n" "$1"
     exit 1
 }
+quotify() {
+    python -c "
+import sys
+if len(sys.argv) > 1:
+    text =''.join(sys.argv[1:])
+else:
+    text = sys.stdin.read()
+quoted_text = text.replace(\"'\", \"'\\\\''\")
+print(f\"'{quoted_text}'\", end='')" "$@"
+}
 
 # Prompt the user for a specific variable.
 # ## Args:
@@ -57,7 +67,7 @@ prompt() {
         LE "> " 0 " " "$pr_suggested_answer" ""
     fi
 
-    pr_new_variable="$(printf '%s="%s"' "$pr_variable_upper" "$REPLY")"
+    pr_new_variable="$(printf '%s=%s' "$pr_variable_upper" "$(quotify "$REPLY")")"
 
     eval "$pr_new_variable"
     printf "%s\n" "$pr_new_variable" >>"$replacement_file"
@@ -73,6 +83,8 @@ require mv
 require sed
 require chmod
 
+require python
+
 # necessary meta data
 prompt APPLICATION_NAME "The name of the application" "$(basename "$PWD")"
 prompt APPLICATION_NAME_STYLIZED "The stylized name of the application (for documentation)" "$(echo "$APPLICATION_NAME" | sed 's/[_-]/ /g' | sed 's/^\(\w\)/\U\1/g' | sed 's/ \(\w\)/ \U\1/g')"
@@ -169,6 +181,11 @@ while read -r var; do
     done
 done <"$replacement_file"
 
+if [ "$(rg "%INIT_" --files-with-matches | wc -l)" -ne 0 ]; then
+    echo "Following init variables were not replaced. This is a bug."
+    rg "%INIT_"
+fi
+
 # HACK: Re-add the executable permissions to files, which the nix template has somehow
 # removed <2024-04-02>
 chmod +x scripts/*
diff --git a/build/latex/academia/.envrc b/build/latex/academia/.envrc
index 3bc1085..3db39e6 100644
--- a/build/latex/academia/.envrc
+++ b/build/latex/academia/.envrc
@@ -1,3 +1,5 @@
+#!/usr/bin/env sh
+
 use flake || use nix
 watch_file flake.nix
 
diff --git a/build/latex/academia/init b/build/latex/academia/init
index e8f72c8..b645441 100644
--- a/build/latex/academia/init
+++ b/build/latex/academia/init
@@ -30,6 +30,16 @@ die() {
     printf "init: ERROR: %s\n" "$1"
     exit 1
 }
+quotify() {
+    python -c "
+import sys
+if len(sys.argv) > 1:
+    text =''.join(sys.argv[1:])
+else:
+    text = sys.stdin.read()
+quoted_text = text.replace(\"'\", \"'\\\\''\")
+print(f\"'{quoted_text}'\", end='')" "$@"
+}
 
 # Prompt the user for a specific variable.
 # ## Args:
@@ -57,7 +67,7 @@ prompt() {
         LE "> " 0 " " "$pr_suggested_answer" ""
     fi
 
-    pr_new_variable="$(printf '%s="%s"' "$pr_variable_upper" "$REPLY")"
+    pr_new_variable="$(printf '%s=%s' "$pr_variable_upper" "$(quotify "$REPLY")")"
 
     eval "$pr_new_variable"
     printf "%s\n" "$pr_new_variable" >>"$replacement_file"
@@ -73,6 +83,8 @@ require mv
 require sed
 require chmod
 
+require python
+
 # necessary meta data
 prompt APPLICATION_NAME "The name of the application" "$(basename "$PWD")"
 prompt APPLICATION_NAME_STYLIZED "The stylized name of the application (for documentation)" "$(echo "$APPLICATION_NAME" | sed 's/[_-]/ /g' | sed 's/^\(\w\)/\U\1/g' | sed 's/ \(\w\)/ \U\1/g')"
@@ -169,6 +181,11 @@ while read -r var; do
     done
 done <"$replacement_file"
 
+if [ "$(rg "%INIT_" --files-with-matches | wc -l)" -ne 0 ]; then
+    echo "Following init variables were not replaced. This is a bug."
+    rg "%INIT_"
+fi
+
 # HACK: Re-add the executable permissions to files, which the nix template has somehow
 # removed <2024-04-02>
 chmod +x scripts/*
diff --git a/build/latex/letter/.envrc b/build/latex/letter/.envrc
index 3bc1085..3db39e6 100644
--- a/build/latex/letter/.envrc
+++ b/build/latex/letter/.envrc
@@ -1,3 +1,5 @@
+#!/usr/bin/env sh
+
 use flake || use nix
 watch_file flake.nix
 
diff --git a/build/latex/letter/init b/build/latex/letter/init
index e8f72c8..b645441 100644
--- a/build/latex/letter/init
+++ b/build/latex/letter/init
@@ -30,6 +30,16 @@ die() {
     printf "init: ERROR: %s\n" "$1"
     exit 1
 }
+quotify() {
+    python -c "
+import sys
+if len(sys.argv) > 1:
+    text =''.join(sys.argv[1:])
+else:
+    text = sys.stdin.read()
+quoted_text = text.replace(\"'\", \"'\\\\''\")
+print(f\"'{quoted_text}'\", end='')" "$@"
+}
 
 # Prompt the user for a specific variable.
 # ## Args:
@@ -57,7 +67,7 @@ prompt() {
         LE "> " 0 " " "$pr_suggested_answer" ""
     fi
 
-    pr_new_variable="$(printf '%s="%s"' "$pr_variable_upper" "$REPLY")"
+    pr_new_variable="$(printf '%s=%s' "$pr_variable_upper" "$(quotify "$REPLY")")"
 
     eval "$pr_new_variable"
     printf "%s\n" "$pr_new_variable" >>"$replacement_file"
@@ -73,6 +83,8 @@ require mv
 require sed
 require chmod
 
+require python
+
 # necessary meta data
 prompt APPLICATION_NAME "The name of the application" "$(basename "$PWD")"
 prompt APPLICATION_NAME_STYLIZED "The stylized name of the application (for documentation)" "$(echo "$APPLICATION_NAME" | sed 's/[_-]/ /g' | sed 's/^\(\w\)/\U\1/g' | sed 's/ \(\w\)/ \U\1/g')"
@@ -169,6 +181,11 @@ while read -r var; do
     done
 done <"$replacement_file"
 
+if [ "$(rg "%INIT_" --files-with-matches | wc -l)" -ne 0 ]; then
+    echo "Following init variables were not replaced. This is a bug."
+    rg "%INIT_"
+fi
+
 # HACK: Re-add the executable permissions to files, which the nix template has somehow
 # removed <2024-04-02>
 chmod +x scripts/*
diff --git a/build/latex/presentation/.envrc b/build/latex/presentation/.envrc
index 3bc1085..3db39e6 100644
--- a/build/latex/presentation/.envrc
+++ b/build/latex/presentation/.envrc
@@ -1,3 +1,5 @@
+#!/usr/bin/env sh
+
 use flake || use nix
 watch_file flake.nix
 
diff --git a/build/latex/presentation/init b/build/latex/presentation/init
index e8f72c8..b645441 100644
--- a/build/latex/presentation/init
+++ b/build/latex/presentation/init
@@ -30,6 +30,16 @@ die() {
     printf "init: ERROR: %s\n" "$1"
     exit 1
 }
+quotify() {
+    python -c "
+import sys
+if len(sys.argv) > 1:
+    text =''.join(sys.argv[1:])
+else:
+    text = sys.stdin.read()
+quoted_text = text.replace(\"'\", \"'\\\\''\")
+print(f\"'{quoted_text}'\", end='')" "$@"
+}
 
 # Prompt the user for a specific variable.
 # ## Args:
@@ -57,7 +67,7 @@ prompt() {
         LE "> " 0 " " "$pr_suggested_answer" ""
     fi
 
-    pr_new_variable="$(printf '%s="%s"' "$pr_variable_upper" "$REPLY")"
+    pr_new_variable="$(printf '%s=%s' "$pr_variable_upper" "$(quotify "$REPLY")")"
 
     eval "$pr_new_variable"
     printf "%s\n" "$pr_new_variable" >>"$replacement_file"
@@ -73,6 +83,8 @@ require mv
 require sed
 require chmod
 
+require python
+
 # necessary meta data
 prompt APPLICATION_NAME "The name of the application" "$(basename "$PWD")"
 prompt APPLICATION_NAME_STYLIZED "The stylized name of the application (for documentation)" "$(echo "$APPLICATION_NAME" | sed 's/[_-]/ /g' | sed 's/^\(\w\)/\U\1/g' | sed 's/ \(\w\)/ \U\1/g')"
@@ -169,6 +181,11 @@ while read -r var; do
     done
 done <"$replacement_file"
 
+if [ "$(rg "%INIT_" --files-with-matches | wc -l)" -ne 0 ]; then
+    echo "Following init variables were not replaced. This is a bug."
+    rg "%INIT_"
+fi
+
 # HACK: Re-add the executable permissions to files, which the nix template has somehow
 # removed <2024-04-02>
 chmod +x scripts/*
diff --git a/build/rust/.envrc b/build/rust/.envrc
index c8c5665..3db39e6 100644
--- a/build/rust/.envrc
+++ b/build/rust/.envrc
@@ -1,8 +1,8 @@
+#!/usr/bin/env sh
+
 use flake || use nix
 watch_file flake.nix
 
-PATH_add ./target/debug
-PATH_add ./target/release
 PATH_add ./scripts
 
 if on_git_branch; then
diff --git a/build/rust/Cargo.toml b/build/rust/Cargo.toml
index dd6c3be..49a68c7 100644
--- a/build/rust/Cargo.toml
+++ b/build/rust/Cargo.toml
@@ -3,8 +3,8 @@ name = "%INIT_APPLICATION_NAME"
 description = "%INIT_DESCRIPTION"
 version = "%INIT_APPLICATION_VERSION"
 edition = "2021"
-license = "%INIT_SPDX_LICENSE_IDENTIFER"
-homepage = "%INIT_APPLICATION_HOMEPAGE"
+license = "%INIT_SPDX_LICENSE_IDENTIFIER"
+homepage = "%INIT_HOME_PAGE"
 repository = "%INIT_APPLICATION_SOURCE_CODE_REPOSITORY"
 # TODO
 # categories = [""]
diff --git a/build/rust/flake.nix b/build/rust/flake.nix
index bd54e79..084cf27 100644
--- a/build/rust/flake.nix
+++ b/build/rust/flake.nix
@@ -13,15 +13,12 @@
 
     crane = {
       url = "github:ipetkov/crane";
-      inputs = {
-        nixpkgs.follows = "nixpkgs";
-      };
+      inputs = {};
     };
     rust-overlay = {
       url = "github:oxalica/rust-overlay";
       inputs = {
         nixpkgs.follows = "nixpkgs";
-        flake-utils.follows = "flake-utils";
       };
     };
 
diff --git a/build/rust/init b/build/rust/init
index e8f72c8..b645441 100644
--- a/build/rust/init
+++ b/build/rust/init
@@ -30,6 +30,16 @@ die() {
     printf "init: ERROR: %s\n" "$1"
     exit 1
 }
+quotify() {
+    python -c "
+import sys
+if len(sys.argv) > 1:
+    text =''.join(sys.argv[1:])
+else:
+    text = sys.stdin.read()
+quoted_text = text.replace(\"'\", \"'\\\\''\")
+print(f\"'{quoted_text}'\", end='')" "$@"
+}
 
 # Prompt the user for a specific variable.
 # ## Args:
@@ -57,7 +67,7 @@ prompt() {
         LE "> " 0 " " "$pr_suggested_answer" ""
     fi
 
-    pr_new_variable="$(printf '%s="%s"' "$pr_variable_upper" "$REPLY")"
+    pr_new_variable="$(printf '%s=%s' "$pr_variable_upper" "$(quotify "$REPLY")")"
 
     eval "$pr_new_variable"
     printf "%s\n" "$pr_new_variable" >>"$replacement_file"
@@ -73,6 +83,8 @@ require mv
 require sed
 require chmod
 
+require python
+
 # necessary meta data
 prompt APPLICATION_NAME "The name of the application" "$(basename "$PWD")"
 prompt APPLICATION_NAME_STYLIZED "The stylized name of the application (for documentation)" "$(echo "$APPLICATION_NAME" | sed 's/[_-]/ /g' | sed 's/^\(\w\)/\U\1/g' | sed 's/ \(\w\)/ \U\1/g')"
@@ -169,6 +181,11 @@ while read -r var; do
     done
 done <"$replacement_file"
 
+if [ "$(rg "%INIT_" --files-with-matches | wc -l)" -ne 0 ]; then
+    echo "Following init variables were not replaced. This is a bug."
+    rg "%INIT_"
+fi
+
 # HACK: Re-add the executable permissions to files, which the nix template has somehow
 # removed <2024-04-02>
 chmod +x scripts/*
diff --git a/build/shell/.envrc b/build/shell/.envrc
index 3bc1085..3db39e6 100644
--- a/build/shell/.envrc
+++ b/build/shell/.envrc
@@ -1,3 +1,5 @@
+#!/usr/bin/env sh
+
 use flake || use nix
 watch_file flake.nix
 
diff --git a/build/shell/init b/build/shell/init
index e8f72c8..b645441 100644
--- a/build/shell/init
+++ b/build/shell/init
@@ -30,6 +30,16 @@ die() {
     printf "init: ERROR: %s\n" "$1"
     exit 1
 }
+quotify() {
+    python -c "
+import sys
+if len(sys.argv) > 1:
+    text =''.join(sys.argv[1:])
+else:
+    text = sys.stdin.read()
+quoted_text = text.replace(\"'\", \"'\\\\''\")
+print(f\"'{quoted_text}'\", end='')" "$@"
+}
 
 # Prompt the user for a specific variable.
 # ## Args:
@@ -57,7 +67,7 @@ prompt() {
         LE "> " 0 " " "$pr_suggested_answer" ""
     fi
 
-    pr_new_variable="$(printf '%s="%s"' "$pr_variable_upper" "$REPLY")"
+    pr_new_variable="$(printf '%s=%s' "$pr_variable_upper" "$(quotify "$REPLY")")"
 
     eval "$pr_new_variable"
     printf "%s\n" "$pr_new_variable" >>"$replacement_file"
@@ -73,6 +83,8 @@ require mv
 require sed
 require chmod
 
+require python
+
 # necessary meta data
 prompt APPLICATION_NAME "The name of the application" "$(basename "$PWD")"
 prompt APPLICATION_NAME_STYLIZED "The stylized name of the application (for documentation)" "$(echo "$APPLICATION_NAME" | sed 's/[_-]/ /g' | sed 's/^\(\w\)/\U\1/g' | sed 's/ \(\w\)/ \U\1/g')"
@@ -169,6 +181,11 @@ while read -r var; do
     done
 done <"$replacement_file"
 
+if [ "$(rg "%INIT_" --files-with-matches | wc -l)" -ne 0 ]; then
+    echo "Following init variables were not replaced. This is a bug."
+    rg "%INIT_"
+fi
+
 # HACK: Re-add the executable permissions to files, which the nix template has somehow
 # removed <2024-04-02>
 chmod +x scripts/*