diff options
author | Jannis M. Hoffmann <jannis@fehcom.de> | 2023-09-08 23:32:10 +0200 |
---|---|---|
committer | Jannis M. Hoffmann <jannis@fehcom.de> | 2023-09-08 23:32:10 +0200 |
commit | 926ec7a6b85e6e3f7335a8c5ddcccd51937ee2d8 (patch) | |
tree | b7a420a919d0146f2a0bd2e1e577b795fcb99202 /actions | |
parent | 4510e3720274865996ef056f1687997ba0b482be (diff) |
added a build configuration step
Diffstat (limited to 'actions')
-rwxr-xr-x | actions | 91 |
1 files changed, 31 insertions, 60 deletions
@@ -1,31 +1,32 @@ -#!/usr/bin/env sh +#!/bin/sh set -euC help_text= -help_text="$help_text install\t[]\t\n" -install () { - perl Makefile.PL - make - make test - make install +help_text="$help_text build\t[]\t\n" +dev_config () { + ./configure -e extractrs -n cat } -help_text="$help_text dist\t[]\tcreate a source distribution\n" -dist () { - perl Makefile.PL - make - make test - make dist +help_text="$help_text unconfigure\t[]\tresets the build\n" +unconfigure () { + rm -f .configured jwebmail.service lib/JWebmail/Config.pm +} + +help_text="$help_text build\t[]\t\n" +build () { + env PATH="node_modules/.bin/:$PATH" ninja "$@" } -help_text="$help_text run_tests\t[args='t/' ...]\tpasses arg to the 'prove' tool\n" -run_tests () { - if [ $# -gt 0 ] - then prove -l "$@" - else prove -l t/ +help_text="$help_text install\t[]\t\n" +install () { + perl Makefile.PL + make + if readlink /bin/init | grep -q 'systemd' + then install -m 644 jwebmail.service /etc/systemd/system fi + install -m 644 jwebmail.toml /etc } help_text="$help_text start_dev\t[]\tstarts a hot reloading dev server\n" @@ -33,29 +34,26 @@ start_dev () { morbo script/jwebmail } -help_text="$help_text logrotate\t[mode=development]\tarchives the current log file\n" -logrotate () { +help_text="$help_text logrotate_dev\t[mode=development]\tarchives the current log file\n" +logrotate_dev () { mode=${1:-development} mv -i "log/$mode.log" "log/${mode}_$(date --iso-8601=minutes).log" } -help_text="$help_text linelength\t[[files]]\tchecks documentation files for overly long lines\n" -linelength () { - files=${1:-'README.md CHANGES.md LICENSE'} +help_text="$help_text follow_log\t[mode=development]\tfollows the current log file\n" +follow_log () { + mode=${1:-development} + tail -f "log/$mode.log" +} + +help_text="$help_text release_check\t[]\t\n" +release_check () { + files='README.md CHANGES.md LICENSE' for file in $files do fold -s -w 85 "$file" | diff "$file" - done -} - -help_text="$help_text follow\t[mode=development]\tfollows the current log file\n" -follow () { - mode=${1:-development} - tail -f "log/$mode.log" -} -help_text="$help_text check_manifest\t[]\tchecks if files in the MANIFEST actually exist\n" -check_manifest () { perl -nE 'chomp; say if $_ && !-e' MANIFEST } @@ -87,37 +85,10 @@ list_translations () { fi } -help_text="$help_text rust_extract\t[]\tupdates and gets the rust extract binary\n" -rust_extract () { - cd extract - cargo build --release --target=x86_64-unknown-linux-musl - cp target/x86_64-unknown-linux-musl/release/jwebmail-extract ../bin - cd .. -} - -help_text="$help_text systemd_unit\t[path=/etc/systemd/system/\$JWM_NAME.service] env(JWM_{NAME,USER,HOME,LOG_LEVEL})\tcreates a systemd unit file\n" -systemd_unit () { - : "${JWM_NAME=jwebmail}" "${JWM_USER=$USER}" "${JWM_HOME=$(pwd)}" "${JWM_LOG_LEVEL=info}" - export JWM_NAME JWM_USER JWM_HOME JWM_LOG_LEVEL - - cmd='perl -pe s/\$(\w+)/$ENV{$1}/ga jwebmail.service.tmpl' - path=${1-/etc/systemd/system/$JWM_NAME.service} - if [ "$path" = '-' ] - then $cmd - else $cmd >|"$path" - fi -} - -help_text="$help_text compile_python\t[]\tprepare python bytecode files\n" -compile_python () { - python3 -m compileall script/qmauth.py -} - help () { echo "The following actions are available:" echo - printf "$help_text" | expand -t 22,43 - echo + printf "$help_text\n" | expand -t 21,41 } cmd=${1-help} |