templates/install/projects.list.sh.twig line 1

Open in your IDE?
  1. terminal-switch-second
  2. options=({% for project in projects %} "{{ project.name }} ({{ project.projectType.type }})" {% endfor %} "Autre" )
  3. # check if a parameter with requested project have been asked
  4. skippAsking=0
  5. if [ ! -z "$PROJECT" ]
  6. then
  7.     echo
  8.     echo "Vous avez demandé à installer le projet $PROJECT"
  9.     echo
  10.     # Verify if request project in list
  11.     if [[ " ${options[*]} " =~ " $PROJECT " ]]; then
  12.         opt="$PROJECT"
  13.         skippAsking=1
  14.     else
  15.         echo -e "\033[1;31mErreur\033[0m, le projet demandé '$PROJECT' est introuvable."
  16.         sleep 2
  17.     fi
  18. fi
  19. if [ $skippAsking = 0 ]
  20. then
  21.     echo "Voici la liste des projets récents sur https://gitlab.cosavostra.com/"
  22.     echo
  23.     echo -e "\e[4mSélectionnez un projet que vous souhaitez installer.\e[0m"
  24.     PS3='Sélectionnez le numéro d''un site à installer: '
  25.     set -o posix
  26.     select opt in "${options[@]}"
  27.     do
  28.       case $opt in
  29.     {% for project in projects %}
  30.         "{{ project.name }} ({{ project.projectType.type }})")
  31.             break
  32.             ;;
  33.     {% endfor %}
  34.         "Autre")
  35.             echo
  36.             echo "Les projets présents ici sont les projets ayant eut une activité récente sur gitlab."
  37.             echo "Contactez un administrateur si vous pensez qu'il manque un projet"
  38.             echo
  39.             exit 1
  40.             ;;
  41.         *) echo "Réponse invalide $REPLY";;
  42.       esac
  43.     done
  44.     set +o posix
  45. fi
  46. # 0 if git root, 1 if git WP theme
  47. projectGitLevel="0";
  48. case $opt in
  49. {% for project in projects %}
  50. {% set projectDevPath = project.config(constant('App\\Service\\ProjectManager::CONFIG_PATH_DEV')) %}
  51.     "{{ project.name }} ({{ project.projectType.type }})")
  52.         projectName="{{ project.name }}"
  53.         projectShortName="{{ project.name|slug|lower }}"
  54.         projectType="{{ project.projectType.type }}"
  55. {# Si le projet n'est pa défini, son chemin est vide ou invalide (<10 char) #}
  56. {% if projectDevPath|length > 10 %}
  57.         projectDevPath="{{ project.config(constant('App\\Service\\ProjectManager::CONFIG_PATH_DEV')) }}/"
  58. {% endif %}
  59. {% if project.projectType.type == 'wordpress' %}
  60.         projectTheme="{{ project.config(constant('App\\Service\\ProjectManager::CONFIG_WP_PATH_THEME')) }}"
  61.         projectGitLevel="{{ project.config(constant('App\\Service\\ProjectManager::CONFIG_WP_GIT_ONLY_THEME')) }}"
  62. {% endif %}
  63.         projectGit="{{ project.gitlabUrl }}"
  64. {% set forcePhpVersion = project.config(constant('App\\Service\\ProjectManager::CONFIG_PHP_VERSION')) %}
  65. {% if forcePhpVersion is not empty %}
  66.         projectPhpForceVersion="{{ forcePhpVersion }}"
  67. {% endif %}
  68. {% set forceNodeVersion = project.config(constant('App\\Service\\ProjectManager::CONFIG_NODE_VERSION')) %}
  69. {% if forceNodeVersion is not empty %}
  70.         projectNodeForceVersion="{{ forceNodeVersion }}"
  71. {% endif %}
  72.         ;;
  73. {% endfor %}
  74.     *) echo "Réponse invalide $REPLY";;
  75. esac
  76. if [ "$projectDevPath" == "" ]; then
  77.     echo
  78.     echo -e "\033[1;31m ERREUR : Le chemin du serveur de dev n'est pas (encore) configuré pour ce site. Contactez un administrateur \033[0m"
  79.     echo
  80.     exit 1
  81. fi
  82. terminal-switch-first
  83. echo
  84. echo "Installation de $opt en local"
  85. echo