From b3c37a43a40a932735c2bbb448e80b449e895427 Mon Sep 17 00:00:00 2001 From: Jephte Clain Date: Wed, 2 Oct 2024 13:46:46 +0400 Subject: [PATCH] modifs.mineures sans commentaires --- support/copy-templates | 39 +++++++++++++++++++++++++++++++ support/template-_bg_launcher.php | 2 +- support/template-_wrapper.sh | 0 3 files changed, 40 insertions(+), 1 deletion(-) create mode 100755 support/copy-templates mode change 100755 => 100644 support/template-_bg_launcher.php mode change 100755 => 100644 support/template-_wrapper.sh diff --git a/support/copy-templates b/support/copy-templates new file mode 100755 index 0000000..7e2e118 --- /dev/null +++ b/support/copy-templates @@ -0,0 +1,39 @@ +#!/bin/bash +# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 +source /etc/nulib.sh || exit 1 + +declare -A DESTDIRS=( + [template-_bg_launcher.php]=sbin + [template-.launcher.php]=_cli + [template-_wrapper.sh]=_cli +) +declare -A MODES=( + [template-_bg_launcher.php]=+x + [template-.launcher.php]= + [template-_wrapper.sh]=+x +) + +projdir= +args=( + "copier les templates dans le projet en cours" + #"usage" + -d:,--projdir: . +) +parse_args "$@"; set -- "${args[@]}" + +if [ -n "$projdir" ]; then + cd "$projdir" || die +fi + +[ -f composer.json ] || die "$(basename "$(dirname "$(pwd)")"): n'est pas un projet composer" + +setx -a templates=ls_files "$MYDIR" "template-*" +for template in "${templates[@]}"; do + destdir="${DESTDIRS[$template]}" + [ -n "$destdir" ] || die "$template: la destination n'est pas configurée" + mode="${MODES[$template]}" + destname="${template#template-}" + + tail -n+4 "$MYDIR/$template" >"$destdir/$destname" + [ -n "$mode" ] && chmod "$mode" "$destdir/$destname" +done diff --git a/support/template-_bg_launcher.php b/support/template-_bg_launcher.php old mode 100755 new mode 100644 index fb891d5..c627a47 --- a/support/template-_bg_launcher.php +++ b/support/template-_bg_launcher.php @@ -12,7 +12,7 @@ use nur\sery\app; const NULIB_APP_app_launcher = __DIR__.'/../_cli/.launcher.php'; app::init([ - "projdir" => __DIR__ . '/..', + "projdir" => __DIR__.'/..', "appcode" => \app\config\bootstrap::APPCODE, ]); BgLauncherApp::run(); diff --git a/support/template-_wrapper.sh b/support/template-_wrapper.sh old mode 100755 new mode 100644