diff options
author | Ludovic Pouzenc <ludovic@pouzenc.fr> | 2016-03-12 00:20:18 +0100 |
---|---|---|
committer | Ludovic Pouzenc <ludovic@pouzenc.fr> | 2016-03-12 00:20:18 +0100 |
commit | 37a67ea723bb6d93421591b8f3ed15738f53ed9e (patch) | |
tree | 38b58703b82eaab20975d6e648533eb44598938e /generator/make.sh | |
parent | a6104f47f7a0534664f8f3740f303f01e7e7399e (diff) | |
download | chd_gestion-37a67ea723bb6d93421591b8f3ed15738f53ed9e.zip chd_gestion-37a67ea723bb6d93421591b8f3ed15738f53ed9e.tar.gz chd_gestion-37a67ea723bb6d93421591b8f3ed15738f53ed9e.tar.bz2 |
First import.
Diffstat (limited to 'generator/make.sh')
-rwxr-xr-x | generator/make.sh | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/generator/make.sh b/generator/make.sh new file mode 100755 index 0000000..fed4a03 --- /dev/null +++ b/generator/make.sh @@ -0,0 +1,78 @@ +#!/bin/bash -x +# Copyright 2016 Ludovic Pouzenc <ludovic@pouzenc.fr> +# Copyright 2016 Nicolas Goaziou <mail@nicolasgoaziou.fr> +# +# This file is part of CHD Gestion. +# +# CHD Gestion is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# CHD Gestion is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with CHD Gestion. If not, see <http://www.gnu.org/licenses/>. +# +cd /var/www + +# Sauver la précédente fournée +if [ -d chd_gestion ] +then [ -d chd_gestion.bkp ] && rm -r chd_gestion.bkp/ + mv chd_gestion chd_gestion.bkp +fi + +# Installer un nouveau CakePHP ( http://book.cakephp.org/3.0/en/quickstart.html#getting-cakephp ) +[ -f composer.phar ] || wget https://getcomposer.org/composer.phar + +mkdir chd_gestion +cd chd_gestion || exit + +ln -s ../composer.phar +# Personnaliser les dépendances (forcer CakePHP 3.1.10) +cp -a /root/chd_gestion_generator/composer.json . +# Deployer un squellette d'appli (avec les dépendances) +yes | php composer.phar create-project +# Cakephp/app nous sert de base, mais a été installé comme dépendance à cause de l'utilisation du composer.json +rsync -ai --exclude **/empty ./vendor/cakephp/app/ . + +# Ajouter PHPUnit ( http://book.cakephp.org/3.0/en/development/testing.html#installing-phpunit ) +#php composer.phar require --dev phpunit/phpunit:5.* +# Ajouter le plugin Search ( https://github.com/FriendsOfCake/search ) +#php composer.phar require friendsofcake/search "dev-master" + +# Ajouter un theme pour altérer le comportement de bake (http://book.cakephp.org/3.0/en/bake/development.html#creating-a-bake-theme ) +yes | bin/cake bake plugin CustomTheme + +# Paramétrer le français en langue par défaut ( http://book.cakephp.org/3.0/en/core-libraries/internationalization-and-localization.html#setting-the-default-locale ) +sed --in-place -e "s/ini_set('intl.default_locale', '[^']*')/ini_set('intl.default_locale', 'fr_FR')/" config/bootstrap.php + +# Page d'accueil = Liste des adhérents (http://book.cakephp.org/3.0/en/development/routing.html#quick-tour ) +sed --in-place -e "s#connect('/', [^)]\\+)#connect('/', ['controller' => 'Adherents', 'action' => 'index'])#" config/routes.php + +cat >> config/bootstrap.php <<"EOT" +# Ajouter des pluriel irréguliers vu de la langue anglaise +# http://book.cakephp.org/3.0/en/core-libraries/inflector.html#loading-custom-inflections +Inflector::rules('uninflected', ['ipmgmt']); +Inflector::rules('uninflected', ['relais']); +Inflector::rules('irregular', ['interesse' => 'interesses']); + +# Ne pas afficher les heures par défaut +use Cake\I18n\Time; +Time::setToStringFormat([IntlDateFormatter::SHORT, -1]); +EOT + +# Ajout des personnalisations qui s'expriment pas facilement dans un script +rsync -ai /root/chd_gestion_generator/before-bake/ ./ + +# Génération de l'ensemble du CRUD ( http://book.cakephp.org/3.0/en/bake/usage.html ) +for table in $(bin/cake bake all | sed -ne 's/^- \(.*\)$/\1/p' | grep -vE '^v_') +do + yes | bin/cake bake all --theme=CustomTheme $table +done + +# Ecarsement de certains modèles générés +rsync -aib --backup-dir=../src.orig /root/chd_gestion_generator/after-bake/src/ ./src/ |