config pman composer

This commit is contained in:
Jephté Clain 2025-04-16 12:19:05 +04:00
parent ca129dfda4
commit d4cc8bfa42

View File

@ -91,6 +91,42 @@ function init_config_action() {
_push_branches
}
function _init_composer() {
if [ ! -f .composer.pman.yml -o -n "$ForceCreate" ]; then
ac_set_tmpfile config
cat >"$config" <<EOF
# -*- coding: utf-8 mode: yaml -*- vim:sw=2:sts=2:et:ai:si:sta:fenc=utf-8
composer:
profiles: [ develop, master ]
develop:
link: true
master:
link: false
EOF
"${EDITOR:-nano}" "$config"
[ -s "$config" ] || return 1
cp "$config" .composer.pman.yml
git add .composer.pman.yml
fi
return 0
}
function init_composer_action() {
local -a push_branches; local config
[ -f .composer.pman.yml -a -z "$ForceCreate" ] && die "La configuration composer pman a déjà été initialisée"
resolve_should_push
_init_composer || exit_with ewarn "Initialisation de la configuration annulée"
git commit -m "configuration composer pman"
push_branches+=("$CurrentBranch")
_push_branches
}
function _ensure_main_branch() {
[ -n "$MAIN" ] || die "La branche MAIN n'a pas été définie"
[ -n "$MainBranch" ] || die "$MAIN: cette branche n'existe pas (le dépôt a-t-il été initialisé?)"
@ -242,6 +278,7 @@ function init_action() {
case "$what" in
init|repo|r) init_repo_action "$@";;
config) init_config_action "$@";;
composer) init_composer_action "$@";;
main|m) checkout_main_action;;
develop|dev|d) init_develop_action "$@";;
upstream|up|u) init_upstream_action "$@";;
@ -263,7 +300,8 @@ Origin=
ForceCreate=
args=(
"gérer un projet git"
"repo|config|develop|upstream|dist
"repo|config|composer
develop|upstream|dist
INITIALISATION
@ -272,6 +310,7 @@ configurer certaines branches du dépôt si elles n'existent pas déjà
repo
initialiser un dépôt vide et créer les branches $MAIN et $DEVELOP
develop
créer la branche $DEVELOP
upstream