Skip to content

Commit

Permalink
feat: deploy README note
Browse files Browse the repository at this point in the history
Adds the option `-n` to `deploy-timelines.sh`, to add a note for the
clas12mon webpage. This is done by generating a `README` file with the
user-specified note; many chefs have been doing this manually.
  • Loading branch information
c-dilks committed Feb 20, 2025
1 parent ac2763b commit c7d61bf
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion bin/deploy-timelines.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ usage() {
available choices:
$(find $TIMELINESRC/data/metadata -name "*.json" -exec basename {} .json \; | sed 's;^; ;')
-n [NOTE] add a note that will be shown on the clas12mon webpage
(i.e., the README file); surround your note in quotes
-h print this usage guide
""" >&2
}
Expand All @@ -77,9 +80,10 @@ dryRun=false
customTarget=false
subDir=""
metadataFile=""
readmeNote=""
inputDir=""
helpMode=false
while getopts "d:i:Ut:Dcs:m:h-:" opt; do
while getopts "d:i:Ut:Dcs:m:n:h-:" opt; do
case $opt in
d) inputCmdOpts+=" -d $OPTARG" ;;
i) inputCmdOpts+=" -i $OPTARG" ;;
Expand All @@ -89,6 +93,7 @@ while getopts "d:i:Ut:Dcs:m:h-:" opt; do
c) customTarget=true ;;
s) subDir=$OPTARG ;;
m) metadataFile=$OPTARG ;;
n) readmeNote=$OPTARG ;;
h) helpMode=true ;;
-)
[ "$OPTARG" != "help" ] && printError "unknown option --$OPTARG"
Expand Down Expand Up @@ -120,6 +125,9 @@ if [ -n "$metadataFile" ]; then
fi
fi

# print the README note, if set
[ -n "$readmeNote" ] && echo "using the note: '$readmeNote'"

# specify target directory
[ -z "$subDir" ] && subDir=$dataset
if ${customTarget}; then
Expand All @@ -137,6 +145,8 @@ DEPLOYMENT PLAN: copy [SOURCE]/* [DESTINATION]/*
[DESTINATION]: $targetDir
[NOTE]: '$readmeNote'
WARNING: [DESTINATION] will be REMOVED before deploying!
-----------------------------------------------------------
"""
Expand All @@ -158,6 +168,7 @@ rm -rv $targetDir
mkdir -pv $targetDir
cp -rv $inputDir/* $targetDir/
[ -n "$metadataFile" ] && cp -v $metadataFile $targetDir/metadata.json
[ -n "$readmeNote" ] && echo "$readmeNote" > $targetDir/README
run-groovy $TIMELINE_GROOVY_OPTS $TIMELINESRC/bin/index-webpage.groovy $targetDir
echo "DONE."

Expand Down

0 comments on commit c7d61bf

Please sign in to comment.