Przeglądaj źródła

Initial commit

hotfix
Thibaud 1 miesiąc temu
commit
c68019a205
9 zmienionych plików z 263 dodań i 0 usunięć
  1. +22
    -0
      00_checkout_branch.sh
  2. +30
    -0
      00_status.sh
  3. +12
    -0
      01_quick_commit.sh
  4. +27
    -0
      02_add_branch.sh
  5. +28
    -0
      03_push_branch.sh
  6. +39
    -0
      04_merge_branch.sh
  7. +48
    -0
      05_delete_feature_branch.sh
  8. +10
    -0
      06_delete_all_features_branch.sh
  9. +47
    -0
      git_filter_secrets.sh

+ 22
- 0
00_checkout_branch.sh Wyświetl plik

@ -0,0 +1,22 @@
#!/bin/env bash
DIRNAME=`dirname $0`
git_current_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'
}
CUR_BRANCH=`git_current_branch`
CIBLE=$1
if [ "$CIBLE" == "" ]
then
CIBLE=$CUR_BRANCH
fi
$DIRNAME/01_quick_commit.sh
if [ ! "$CIBLE" = "$CUR_BRANCH" ];
then
git checkout $CIBLE
git pull
fi

+ 30
- 0
00_status.sh Wyświetl plik

@ -0,0 +1,30 @@
#!/bin/env bash
DIRNAME=`dirname $0`
git_current_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'
}
CUR_BRANCH=`git_current_branch`
TEST=`git status | grep propre | wc -l`
if [ $TEST -eq 0 ]
then
echo "La branche actuelle ($CUR_BRANCH) n'est pas propre"
echo # (optional) move to a new line
read -p "Voulez-vous voir les modifications courantes ? " -n 1 -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[YyOo]$ ]]
then
git status
fi
echo # (optional) move to a new line
read -p "Voulez-vous ajouter les modifications courantes ? " -n 1 -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[YyOo]$ ]]
then
git add .
fi
fi

+ 12
- 0
01_quick_commit.sh Wyświetl plik

@ -0,0 +1,12 @@
#!/bin/env bash
DIRNAME=`dirname $0`
TIMESTAMP=`date "+%Y%m%d%H%M"`
$DIRNAME/00_status.sh
TEST=`git status | grep propre | wc -l`
if [ $TEST -eq 0 ]
then
git commit -m "$TIMESTAMP"
fi

+ 27
- 0
02_add_branch.sh Wyświetl plik

@ -0,0 +1,27 @@
#!/bin/env bash
DIRNAME=`dirname $0`
if [ "$1" == "" ]
then
echo "Il faut préciser un nom de branche !"
exit 1
fi
$DIRNAME/01_quick_commit.sh
courante=`git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' | sed 's:(::g' | sed 's:)::g'`
if [ $courante != develop ]
then
echo "La branche actuelle n'est pas develop"
read -p "Voulez-vous basculer sur develop ? " -n 1 -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[YyOo]$ ]]
then
$DIRNAME/00_checkout_branch.sh develop
fi
fi
git branch $1
git checkout $1
git push --set-upstream all $1

+ 28
- 0
03_push_branch.sh Wyświetl plik

@ -0,0 +1,28 @@
#!/bin/env bash
DIRNAME=`dirname $0`
git_current_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'
}
CUR_BRANCH=`git_current_branch`
CIBLE=$1
if [ "$CIBLE" == "" ]
then
CIBLE=$CUR_BRANCH
fi
$DIRNAME/01_quick_commit.sh
if [ ! "$CIBLE" = "$CUR_BRANCH" ];
then
$DIRNAME/00_checkout_branch.sh $CIBLE
fi
git push all
if [ ! "$CIBLE" = "$CUR_BRANCH" ];
then
$DIRNAME/00_checkout_branch.sh $CUR_BRANCH
fi

+ 39
- 0
04_merge_branch.sh Wyświetl plik

@ -0,0 +1,39 @@
#!/bin/env bash
DIRNAME=`dirname $0`
echo "Il vaudrait mieux passer par https://git.topisto.net/topisto/suivi_projets"
read -p "Are you sure ?" -n 1 -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]
then
# do dangerous stuff
$DIRNAME/01_quick_commit.sh
courante=`git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' | sed 's:(::g' | sed 's:)::g'`
cible=develop
if [ "$courante" = "develop" ]
then
cible=hotfix
fi
if [ "$courante" = "hotfix" ]
then
cible=production
fi
echo merge $courante into $cible
git push
git checkout $cible
git merge $courante
git push
git checkout $courante
fi

+ 48
- 0
05_delete_feature_branch.sh Wyświetl plik

@ -0,0 +1,48 @@
#!/bin/env bash
DIRNAME=`dirname $0`
git_current_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'
}
CUR_BRANCH=`git_current_branch`
CIBLE=$1
if [ "$CIBLE" == "" ]
then
CIBLE=$CUR_BRANCH
fi
internal_delete_branch() {
git branch -D $1
git push all --delete $1
}
delete_branch() {
read -p "Delete $1 (y/n) ? " choice
case "$choice" in
y|Y|o|O ) internal_delete_branch $1;;
n|N ) echo "no";;
* ) echo "invalid choice ($choice)";;
esac
}
$DIRNAME/03_push_branch.sh
if [ ! "$CUR_BRANCH" = "develop" ]
then
echo "La branche actuelle n'est pas develop"
read -p "Voulez-vous basculer sur develop ? " -n 1 -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[YyOo]$ ]]
then
$DIRNAME/00_checkout_branch.sh develop
fi
fi
case $CIBLE in
($CUR_BRANCH) echo "Impossible : $CIBLE is current branch !";;
("evo"*) delete_branch $CIBLE;;
("ano"*) delete_branch $CIBLE;;
(*) echo "$CIBLE is not a feature branch";;
esac

+ 10
- 0
06_delete_all_features_branch.sh Wyświetl plik

@ -0,0 +1,10 @@
#!/bin/env bash
DIRNAME=`dirname $0`
for branche in $(git branch | cut -c 3-)
do
echo "branch $branche detected"
$DIRNAME/05_delete_feature_branch.sh $branche
done

+ 47
- 0
git_filter_secrets.sh Wyświetl plik

@ -0,0 +1,47 @@
#!/bin/env bash
#
# Étape 1 : ajouter les lignes suivantes dans .git/config
#
# [filter "secrets"]
# clean = ../scripts/filter-secrets.sh clean
# smudge = ../scripts/filter-secrets.sh smudge
#
# Étape 2 : ajouter les lignes suivantes dans le .git/info/attributes
# NB : il s'agit de la liste des fichiers sur lequel git doit appliquer le filtre
#
# config.yaml filter=secrets
# .env filter=secrets
#
#
if [ "$1" == "clean" ]; then
# Clean (replace sensitive data with placeholders)
sed -e 's/XXXXXXXXX/{API_KEY_PLACEHOLDER}/g' \
-e 's/YYYYYYYYY/{SENDING_API_KEY_PLACEHOLDER}/g' \
-e 's/ZZZZZZZZZ/{SMTP_PASSWORD_PLACEHOLDER}/g' \
-e 's/AAAAAAAAA/{POSTGRES_PASSWORD_PLACEHOLDER}/g' \
-e 's/BBBBBBBBB/{TWS_USERID_PLACEHOLDER}/g' \
-e 's/CCCCCCCCCC/{TWS_PASSWORD_PLACEHOLDER}/g'
# Si une erreur se produit avec sed, renvoyer un code d'erreur
if [ $? -ne 0 ]; then
echo "Erreur lors de l'exécution du clean"
exit 1
fi
elif [ "$1" == "smudge" ]; then
# Smudge (replace placeholders with sensitive data)
sed -e 's/{API_KEY_PLACEHOLDER}/XXXXXXXXX/g' \
-e 's/{SENDING_API_KEY_PLACEHOLDER}/YYYYYYYYY/g' \
-e 's/{SMTP_PASSWORD_PLACEHOLDER}/ZZZZZZZZZ/g' \
-e 's/{POSTGRES_PASSWORD_PLACEHOLDER}/AAAAAAAAA/g' \
-e 's/{TWS_USERID_PLACEHOLDER}/BBBBBBBBB/g' \
-e 's/{TWS_PASSWORD_PLACEHOLDER}/CCCCCCCCCC/g'
if [ $? -ne 0 ]; then
echo "Erreur lors de l'exécution du smudge"
exit 1
fi
fi
exit 0

Ładowanie…
Anuluj
Zapisz