#!/bin/bash # -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8 source "$(dirname -- "$0")/../load.sh" || exit 1 require: git pman pman.conf ################################################################################ # Informations ################################################################################ SHOW_VARS=( --Configuration "${CONFIG_VARS[@]}" --Paramètres CurrentBranch CurrentType=SrcType ) function show_action() { local var src echo_setv ConfigBranch="$ConfigBranch" echo_setv ConfigFile="$(ppath "$ConfigFile")" for var in "${SHOW_VARS[@]}"; do if [ "${var#--}" != "$var" ]; then estep "${var#--}" else splitfsep "$var" = var src [ -n "$src" ] || src="$var" echo_setv "$var=${!src}" fi done } ################################################################################ # Initialisation ################################################################################ function _init_config() { if [ ! -f .pman.conf -o -n "$ForceCreate" ]; then ac_set_tmpfile config cp "$ConfigFile" "$config" "${EDITOR:-nano}" "$config" [ -s "$config" ] || return 1 cp "$config" .pman.conf if testdiff .pman.conf "$ConfigFile"; then ConfigFile="$(pwd)/.pman.conf" load_config load_branches current "$SrcBranch" fi git add .pman.conf fi if [ ! -f ".gitignore" ]; then echo >.gitignore "\ .~lock*# .*.swp" git add .gitignore fi return 0 } function init_repo_action() { local -a push_branches; local config [ ${#LocalBranches[*]} -eq 0 ] || die "Ce dépôt a déjà été initialisé" _init_config || exit_with ewarn "Initialisation du dépôt annulée" einfo "Création de la branche $MAIN" git symbolic-ref HEAD "refs/heads/$MAIN" git commit -m "commit initial" push_branches+=("$MAIN") einfo "Création de la branche $DEVELOP" git checkout -b "$DEVELOP" push_branches+=("$DEVELOP") _push_branches } function init_config_action() { local -a push_branches; local config [ -f .pman.conf -a -z "$ForceCreate" ] && die "La configuration pman a déjà été initialisée" resolve_should_push _init_config || exit_with ewarn "Initialisation de la configuration annulée" git commit -m "configuration pman" push_branches+=("$CurrentBranch") _push_branches } function _init_composer() { if [ ! -f .composer.pman.yml -o -n "$ForceCreate" ]; then ac_set_tmpfile config cat >"$config" <