Add feature to wake up news *and* events
All checks were successful
the build was successful

This commit is contained in:
Reinhard Müller 2019-03-12 01:51:47 +01:00
parent c06cc5974d
commit 40f9044019
15 changed files with 29 additions and 17 deletions

View File

@ -11,5 +11,6 @@ contact/local:[]
news/*/news:[education]
news/*/.news:[education]
news/nl/nl:[education]
news/nl/.nl:[education]
events/*/event:[education]
d_day:[]

View File

@ -7,9 +7,9 @@ about/people/groups:[]
about/people/volunteers:[]
activities/*/project:[]
campaigns/*/project:[]
news/*/news:[at]
news/*/.news:[at]
news/nl/nl:[at]
news/nl/.nl:[at]
events/*/event:[at]
d_day:[]

View File

@ -24,12 +24,15 @@ build_main.sh [options] tree_maker [input_dir] "destination_dir"
Note: if destination_dir is set via previous options, and only one paramter
is given, then this parameter will be interpreted as input_dir
build_main.sh [options] wakeup_news [date]
build_main.sh [options] wakeup [date]
News items that are in the future at the time of their commit are not
considered for the content of dependent files (e.g. news.html, index.html).
This function performs a `touch` on all files which are to be released at
the presented date, thus forcing a subsequent buildrun to rebuild dependent
files even though the input files may not have changed their content.
The same goes for events which start today (have to be moved from future to
current events) or ended yesterday (have to be moved from current to past
events).
The date option defaults to the present date, if given it must adhere to
the form YYYY-MM-DD.

View File

@ -48,7 +48,7 @@ if [ -z "$inc_arguments" ]; then
[ "$#" -gt 0 ] && shift 1 && workfile="$1"
[ "$#" -gt 0 ] && shift 1 && processor="$1"
;;
wakeup_news)
wakeup)
command="$1$command"
[ "$#" -gt 0 ] && shift 1 && today="$1"
;;
@ -80,7 +80,7 @@ if [ -z "$inc_arguments" ]; then
process_file) [ -z "$workfile" ] && die "Need at least input file" ;;
build_xmlstream) [ -z "$workfile" ] && die "Missing xhtml file name" ;;
tree_maker) [ -z "$target" ] && die "Missing target location" ;;
wakeup_news) true;;
wakeup) true;;
*help*) print_help; exit 0 ;;
*) die "Urecognised command or no command given" ;;
esac

View File

@ -63,5 +63,5 @@ case "$command" in
process_file) process_file "$workfile" "$processor" ;;
build_xmlstream) build_xmlstream "$(get_shortname "$workfile")" "$(get_language "$workfile")" ;;
tree_maker) tree_maker "$tree" "$target" ;;
wakeup_news) wakeup_news "$today" ;;
wakeup) wakeup "$today" ;;
esac

View File

@ -2,7 +2,6 @@
inc_stirrups=true
[ -z "$inc_misc" ] && . "$basedir/build/misc.sh"
# [ -z "$inc_sources" ] && . "$basedir/build/sources.sh"
dir_maker(){
# set up directory tree for output
@ -24,12 +23,23 @@ dir_maker(){
done
}
wakeup_news(){
wakeup(){
# Performs a `touch` on all files which are to be released at the
# presented date.
today="$1"
find "$basedir" -name '*.xml' \
# All news with today's date
find "${basedir}/news" -name '*.xml' \
| xargs egrep -l "<[^>]+ date=[\"']${today}[\"'][^>]*>" \
| xargs touch -c 2>&- || true
# All events which start today
find "${basedir}/events" -name '*.xml' \
| xargs egrep -l "<[^>]+ start=[\"']${today}[\"'][^>]*>" \
| xargs touch -c 2>&- || true
# All events which ended yesterday
find "${basedir}/events" -name '*.xml' \
| xargs egrep -l "<[^>]+ end=[\"']$(date -d "${today} -1 day" +%F)[\"'][^>]*>" \
| xargs touch -c 2>&- || true
}

View File

@ -7,9 +7,9 @@ about/people/groups:[]
about/people/volunteers:[]
activities/*/project:[]
campaigns/*/project:[]
news/*/news:[de]
news/*/.news:[de]
news/nl/nl:[de]
news/nl/.nl:[de]
events/*/event:[de]
d_day:[]

View File

@ -7,9 +7,9 @@ about/people/groups:[]
about/people/volunteers:[]
activities/*/project:[]
campaigns/*/project:[]
news/*/news:[ee]
news/*/.news:[ee]
news/nl/nl:[ee]
news/nl/.nl:[ee]
events/*/event:[ee]
d_day:[]

View File

@ -1,3 +1,2 @@
events/*/event:[]
events/*/*/event:[]
d_day:[]

View File

@ -1,2 +1 @@
events/*/event:[fellowship]
d_day:[]

View File

@ -7,9 +7,9 @@ about/people/groups:[]
about/people/volunteers:[]
activities/*/project:[]
campaigns/*/project:[]
news/*/news:[fi]
news/*/.news:[fi]
news/nl/nl:[fi]
news/nl/.nl:[fi]
events/*/event:[fi]
d_day:[]

View File

@ -9,9 +9,9 @@ about/people/volunteers:[]
activities/*/project:[]
campaigns/*/project:[]
contact/local:[]
news/*/news:[fr]
news/*/.news:[fr]
news/nl/nl:[fr]
news/nl/.nl:[fr]
events/*/event:[fr]
d_day:[]

View File

@ -2,5 +2,4 @@ news/2019/news:[frontpage]
news/2019/.news:[frontpage]
events/2019/event:[frontpage]
tools/frontpage/:[]
d_day:[]
tools/static-elements/element-:[]

View File

@ -8,6 +8,7 @@ about/people/volunteers:[]
activities/*/project:[]
campaigns/*/project:[]
contact/local:[]
news/*/news:[it]
news/*/.news:[it]
news/nl/nl:[it]

View File

@ -8,9 +8,9 @@ about/people/volunteers:[]
activities/*/project:[]
campaigns/*/project:[]
contact/local:[]
news/*/news:[gb]
news/*/.news:[gb]
news/nl/nl:[gb]
news/nl/.nl:[gb]
events/*/event:[gb]
d_day:[]