From de941df4cb8ef4f95563ef818380f870f442f7cd Mon Sep 17 00:00:00 2001 From: "Jannis M. Hoffmann" Date: Mon, 9 May 2022 01:15:07 +0200 Subject: add rule to actions to gather translatable snippets --- actions.sh | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) (limited to 'actions.sh') diff --git a/actions.sh b/actions.sh index f950a82..0bb0000 100755 --- a/actions.sh +++ b/actions.sh @@ -6,7 +6,8 @@ help_text= help_text="$help_text run_tests\t[arg]\tpasses arg to the 'prove' tool\n" run_tests () { - eval "prove -l ${1-} t/" + #eval "prove -l ${1-} t/" + make test } help_text="$help_text start_dev\t[]\tstarts a hot reloading dev server\n" @@ -14,7 +15,7 @@ start_dev () { morbo script/jwebmail } -help_text="$help_text logrotate\t[mode]\tarives the current log file\n" +help_text="$help_text logrotate\t[mode]\tarchives the current log file\n" logrotate () { mode=${1:-development} mv -i "log/$mode.log" "log/${mode}_$(date --iso-8601=minutes).log" @@ -37,10 +38,11 @@ follow () { help_text="$help_text check_manifest\t[]\tchecks if files in the MANIFEST actually exist\n" check_manifest () { - perl -nE 'chomp; say unless -e' MANIFEST + #perl -nE 'chomp; say unless -e' MANIFEST + make ci } -help_text="$help_text list_deps\t[]\tlists all non core dependencies\n" +help_text="$help_text list_deps\t[module]\tlists all non core dependencies of a module (default=JWebmail)\n" list_deps () { module=${1:-JWebmail} core="$(corelist -v v5.34.1 | awk '{ print $1 }')" @@ -48,17 +50,30 @@ list_deps () { for dep in $deps do - if echo "$core" | grep -qxF "$dep" - then : - else echo "$dep" + if ! echo "$core" | grep -qxF "$dep" + then echo "$dep" fi done } +help_text="$help_text list_translations\t[raw]\tlists translatable snipptes on a best effort base (incomplete!!)\n" +list_translations () { + raw=${1-} + if [ "$raw" ] + then + find lib -name '*.pm' -exec grep '\->l(' '{}' '+' + find templates -name '*.html.ep' -exec grep "l[ (][\"']" '{}' '+' + else + p1="$(find lib -name '*.pm' -exec grep '\->l(' '{}' '+' | sed 's/^\(\S*\):.*->l(\([^)]*\)).*$/\1: \2/')" + p2="$(find templates -name '*.html.ep' -exec grep "l[ (][\"']" '{}' '+' | sed "s/^\\(\\S*\\):.*l[ (][\"']\\([^\"']*\\)[\"'].*$/\\1: '\\2'/")" + echo "$(echo "$p1"; echo "$p2")" | sort | uniq + fi +} + help () { echo "The following actions are available:" echo - printf "$help_text" | expand -t 19,29 + printf "$help_text" | expand -t 22,33 echo } -- cgit v1.2.3