ソースを参照

portability improvements

exp-with-scrum
コミット
e24aa4d479
署名者: yogsototh GPGキーID: 7B19A4C650D59646
  1. 1
      .gitignore
  2. 14
      Makefile
  3. 1
      engine/mk-gemini-index.sh
  4. 4
      engine/mk-index-entry.sh
  5. 1
      engine/mk-index.sh
  6. 1
      engine/mk-rss-entry.sh
  7. 5
      engine/mkrss.sh
  8. 1
      engine/update-file-size.sh
  9. 3
      shell.nix

1
.gitignore

@ -1,3 +1,4 @@
.cache/
_site/
.direnv/
engine/envvars.sh

14
Makefile

@ -67,7 +67,7 @@ ALL += indexcache
DST_INDEX_FILES ?= $(patsubst %.xml,%.index, $(DST_XML_FILES))
MK_INDEX_ENTRY := ./engine/mk-index-entry.sh
INDEX_CACHE_DIR ?= $(CACHE_DIR)/rss
$(INDEX_CACHE_DIR)/%.index: $(INDEX_CACHE_DIR)/%.xml $(MK_INDEX_ENTRY)
$(INDEX_CACHE_DIR)/%.index: $(INDEX_CACHE_DIR)/%.xml $(MK_INDEX_ENTRY) $(ENV_VARS)
@mkdir -p $(INDEX_CACHE_DIR)
$(MK_INDEX_ENTRY) "$<" "$@"
@ -81,8 +81,14 @@ $(HTML_INDEX): $(DST_INDEX_FILES) $(MKINDEX) $(INDEX_TEMPLATE)
index: $(HTML_INDEX)
ALL += index
ENV_VARS := ./engine/envvars.sh
NIX_FILES := ./shell.nix $(shell find nix -type f)
$(ENV_VARS): $(NIX_FILES)
echo "export PATH=\"${PATH}\"" >> ./engine/envvars.sh
ALL += ./engine/envvars.sh
# RSS
DST_RSS_FILES ?= $(patsubst %.xml,%.rss, $(DST_XML_FILES))
DST_RSS_FILES ?= $(patsubst %.xml,%.rss, $(DST_XML_FILES)) $(ENV_VARS)
MK_RSS_ENTRY := ./engine/mk-rss-entry.sh
$(RSS_CACHE_DIR)/%.rss: $(RSS_CACHE_DIR)/%.xml $(MK_RSS_ENTRY)
@mkdir -p $(RSS_CACHE_DIR)
@ -90,7 +96,7 @@ $(RSS_CACHE_DIR)/%.rss: $(RSS_CACHE_DIR)/%.xml $(MK_RSS_ENTRY)
RSS := $(DST_DIR)/rss.xml
MKRSS := engine/mkrss.sh
$(RSS): $(DST_RSS_FILES) $(MKRSS)
$(RSS): $(DST_RSS_FILES) $(MKRSS) $(ENV_VARS)
$(MKRSS)
.PHONY: rss
@ -115,7 +121,7 @@ gmi: $(DST_GMI_FILES)
# GEMINI INDEX
GMI_INDEX := $(DST_DIR)/index.gmi
MK_GMI_INDEX := engine/mk-gemini-index.sh
$(GMI_INDEX): $(DST_GMI_FILES) $(MK_GMI_INDEX)
$(GMI_INDEX): $(DST_GMI_FILES) $(MK_GMI_INDEX) $(ENV_VARS)
@mkdir -p $(DST_DIR)
$(MK_GMI_INDEX)
ALL += $(GMI_INDEX)

1
engine/mk-gemini-index.sh

@ -1,6 +1,7 @@
#!/usr/bin/env zsh
cd "$(git rev-parse --show-toplevel)" || exit 1
source ./engine/envvars.sh
# Directory
webdir="_site"
postsdir="$webdir/posts"

4
engine/mk-index-entry.sh

@ -1,5 +1,6 @@
#!/usr/bin/env zsh
cd "$(git rev-parse --show-toplevel)" || exit 1
source ./engine/envvars.sh
xfic="$1"
dst="$2"
@ -10,9 +11,11 @@ indexdir=".cache/rss"
dateaccessor='.yyydate'
# title and keyword shouldn't be changed
titleaccessor='title'
keywordsaccessor='meta[name=keywords]::attr(content)'
finddate(){ < $1 hxselect -c $dateaccessor | sed 's/\[//g;s/\]//g;s/ .*$//' }
findtitle(){ < $1 hxselect -c $titleaccessor }
findkeywords(){ < $1 hxselect -c $keywordsaccessor | sed 's/,/ /g' }
autoload -U colors && colors
@ -20,7 +23,6 @@ blogfile="$(echo "$xfic"|sed 's#.xml$#.html#;s#^'$indexdir'/#posts/#')"
printf "%-30s" $blogfile
d=$(finddate $xfic)
echo -n " [$d]"
rssdate=$(formatdate $d)
title=$(findtitle $xfic)
keywords=( $(findkeywords $xfic) )
printf ": %-55s" "$title ($keywords)"

1
engine/mk-index.sh

@ -2,6 +2,7 @@
autoload -U colors && colors
cd "$(git rev-parse --show-toplevel)" || exit 1
source ./engine/envvars.sh
# Directory
webdir="_site"
indexfile="$webdir/index.html"

1
engine/mk-rss-entry.sh

@ -1,6 +1,7 @@
#!/usr/bin/env zsh
cd "$(git rev-parse --show-toplevel)" || exit 1
source ./engine/envvars.sh
# Directory
webdir="_site"
postsdir="$webdir/posts"

5
engine/mkrss.sh

@ -1,6 +1,7 @@
#!/usr/bin/env zsh
#! /usr/bin/env zsh
cd "$(git rev-parse --show-toplevel)" || exit 1
source ./engine/envvars.sh
# Directory
webdir="_site"
postsdir="$webdir/posts"
@ -104,4 +105,4 @@ cp -f "$rssfile" "$legacyenrss"
cp -f "$rssfile" "$legacyfrrss"
rm -rf $tmpdir
echo "* RSS [done]"
echo "\* RSS [done]"

1
engine/update-file-size.sh

@ -1,6 +1,7 @@
#!/usr/bin/env zsh
cd "$(git rev-parse --show-toplevel)" || exit 1
source ./engine/envvars.sh
webdir="_optim"
sizeof() {

3
shell.nix

@ -13,7 +13,8 @@ pkgs.mkShell {
[ cacert
coreutils
entr
html-xml-utils
pandoc
html-xml-utils # hxselect
zsh
perl
perlPackages.URI

読み込み中…
キャンセル
保存