home · contact · privacy
Move (links to) files meant to be public into separate directory.
authorChristian Heller <c.heller@plomlompom.de>
Wed, 21 Dec 2016 23:11:38 +0000 (00:11 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Wed, 21 Dec 2016 23:11:38 +0000 (00:11 +0100)
processor/all.do
processor/default.html.do
test.sh

index 73d0124..3c3a021 100644 (file)
@@ -1,6 +1,10 @@
 #!/bin/sh
 
+# Set up directories.
 metadata_dir=.meta
+public_dir=public
+cur_dir=$(pwd)
+mkdir -p "$public_dir"
 
 # Remove target files for which no sources files can be found.
 for file in "$metadata_dir"/*.intermediate; do
@@ -37,10 +41,14 @@ done
 for file in "$metadata_dir"/*.intermediate; do
   if test -f "$file"; then
     basename=$(basename "$file")
-    redo-ifchange "${basename%.intermediate}.html"
+    html_file=${basename%.intermediate}.html
+    redo-ifchange "$html_file"
+    ln -sf "$cur_dir/$html_file" "${public_dir}/"
   fi
 done
 
 # Regenerate feed and index pages. Always.
-redo "feed.xml"
-redo "index.html"
+redo feed.xml
+ln -sf "$cur_dir"/feed.xml "${public_dir}/"
+redo index.html
+ln -sf "$cur_dir"/index.html "${public_dir}/"
index 4371a3a..99be463 100644 (file)
@@ -24,6 +24,5 @@ EOF
 
 # Write remaining entry head and body. 
 printf "<title>%s – %s</title>\n</head>\n<body>\n" "$blog_title" "$title_plaintext_escaped"
-#printf "<title>%s – %s</title>\n</head>\n<body>\n" "$blog_title" "$entry_title"
 printf "<h1>%s</h1>\n" "$title_html"
 printf "<section>\n%s\n</section>\n</body>\n</html>" "$body"
diff --git a/test.sh b/test.sh
index c54e48a..8e2a024 100755 (executable)
--- a/test.sh
+++ b/test.sh
@@ -64,3 +64,15 @@ cat "$original_file" | \
   > "$generated_file"
 diff_test "$expected_file" "$generated_file"
 rm "$generated_file"
+
+# Check symbolic links.
+for file in "$generated_files_dir"/feed.xml "$generated_files_dir"/*.html; do
+  basename=$(basename "$file")
+  linkname=$(readlink "$generated_files_dir/public/$basename")
+  printf "== public/%s symbolic link test ==\n" "$basename"
+  if [ "$working_dir/$generated_files_dir/$basename" = "$linkname" ]; then
+    echo "== test SUCCESS =="
+  else
+    echo "== test FAILURE =="
+  fi
+done