Skip to content

Commit

Permalink
Merge pull request #57 from simde-utc/develop
Browse files Browse the repository at this point in the history
Ajout de la migration de l'ancien vers le nouveau Portail et mise à jour
  • Loading branch information
NastuzziSamy authored Feb 3, 2019
2 parents 0162455 + 802342c commit ac8a5d8
Show file tree
Hide file tree
Showing 28 changed files with 13,641 additions and 92 deletions.
9 changes: 8 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ APP_NAME="Portail des Assos"
APP_ENV=develop
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost
APP_URL=http://localhost:8000
APP_ASSO=simde

LOG_CHANNEL=stack
Expand All @@ -14,6 +14,13 @@ DB_DATABASE=portail
DB_USERNAME=portail
DB_PASSWORD=portail

OLD_DB_CONNECTION=mysql
OLD_DB_HOST=127.0.0.1
OLD_DB_PORT=3306
OLD_DB_DATABASE=portail-old
OLD_DB_USERNAME=portail-old
OLD_DB_PASSWORD=portail-old

BROADCAST_DRIVER=log
CACHE_DRIVER=redis
SESSION_DRIVER=database
Expand Down
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ before_script:
- npm -g i npm
- npm i
- npm run prod
- php artisan quick:clear
- php artisan portail:clear

script:
- php artisan quick:test
- php artisan portail:test
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ Nouvelle API du [Portail des Assos](https://assos.utc.fr), construite avec [Lara
- Créer la base de données `portail` à la mano
- Installer les packages avec `composer install` (attention à être dans le bon dossier)

- Lancer l'installation et la préparation du serveur: `php artisan quick:install`
- Lancer l'installation et la préparation du serveur: `php artisan portail:install`
- OU Lancer les commances suivantes :
+ Suppression du cache : `php artisan quick:clear`
+ Suppression du cache : `php artisan portail:clear`
+ Création de la clé : `php artisan key:generate`
+ Création des tables et des données : `php artisan migrate:fresh --seed`
+ Installation des dépendances JS : `npm install --production` (assez long)
Expand All @@ -41,7 +41,7 @@ Nouvelle API du [Portail des Assos](https://assos.utc.fr), construite avec [Lara

## Mettre à jour

- Lancer `php artisan quick:update`
- Lancer `php artisan portail:update`
- Lancer `npm run prod` ou `npm run watch`
- Tout est bon

Expand All @@ -59,7 +59,7 @@ Nouvelle API du [Portail des Assos](https://assos.utc.fr), construite avec [Lara

- Respecter le linter imposé pour le PHP mais aussi pour le JS
- Commenter en français
- Lancer `php artisan quick:test` pour vérifier que tout est bon avant de push son code
- Lancer `php artisan portail:test` pour vérifier que tout est bon avant de push son code


## Documentation
Expand Down
4 changes: 2 additions & 2 deletions app/Console/Commands/Clear.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Fichier générant la commande quick:clear.
* Fichier générant la commande portail:clear.
* Efface le cache de l'application.
*
* @author Alexandre Brasseur <[email protected]>
Expand All @@ -19,7 +19,7 @@ class Clear extends Command
/**
* @var string
*/
protected $signature = 'quick:clear';
protected $signature = 'portail:clear';

/**
* @var string
Expand Down
41 changes: 22 additions & 19 deletions app/Console/Commands/Install.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Fichier générant la commande quick:install.
* Fichier générant la commande portail:install.
* Installe l'application.
*
* @author Alexandre Brasseur <[email protected]>
Expand All @@ -20,7 +20,7 @@ class Install extends Command
/**
* @var string
*/
protected $signature = 'quick:install';
protected $signature = 'portail:install';

/**
* @var string
Expand Down Expand Up @@ -59,16 +59,16 @@ public function handle()
$bar = $this->output->createProgressBar(9);
$bar->advance();

$this->info(' [Quick Install] Preparation');
$this->info(' [Quick Install] Preparation - Portail');
$this->info(' [Portail Install] Préparation');
$this->info(' [Portail Install] Préparation - Portail');
$subBar = $this->output->createProgressBar(14);
$subBar->advance();
$editEnv = true;

if (file_exists('.env')) {
$this->info(' /!\ An .env file already exists /!\\ ');
$this->info(' /!\ Le fichier .env existe déjà /!\\ ');

if ($this->confirm('Edit over it ?')) {
if ($this->confirm('Le remplacer (ancienne version déplacée en .env.last) ?')) {
shell_exec('cp .env .env.last');
} else {
$editEnv = false;
Expand All @@ -84,48 +84,51 @@ public function handle()
$bar->advance();

// Installation.
$this->info(' [Quick Install] Installing Composer dependencies');
$this->info(' [Portail Install] Installation des dépendances Composer');
shell_exec('composer install');
$bar->advance();

// Configuration.
$this->info(' [Quick Install] Setting keys');
$this->info(' [Portail Install] Définition des clés');
$this->call('key:generate');
$this->call('passport:keys');
$bar->advance();

$this->info(' [Quick Install] Installing Node dependencies');
$this->info(' [Portail Install] Installation des dépendances NodeJS');
shell_exec('npm install');
shell_exec('npm run dev');
$bar->advance();

// Migration.
$this->info(' [Quick Install] Migrating');
if ($this->confirm('Erase the database ?')) {
$this->info(' [Portail Install] Migration');
if ($this->confirm('Supprimer la base de données ?')) {
$this->call('migrate:fresh');
} else {
$this->call('migrate');
}

if ($this->confirm('Seed the database ?')) {
if ($this->confirm('Remplir la base de données ?')) {
$this->call("db:seed");

if (config('app.env') === 'production' && $this->confirm('Ajouter les données de l\'ancien Portail ?')) {
$this->call("portail:old-to-new");
}
}

$bar->advance();

// Effacement.
$this->info(' [Quick Install] Cleaning');
$this->call('quick:clear');
$this->info(' [Portail Install] Nettoyage');
$this->call('portail:clear');
$bar->advance();

// Optimisation.
$this->info(' [Quick Install] Optimizing');
$this->call('quick:optimize');
$this->info(' [Portail Install] Optimisation');
$this->call('portail:optimize');
$bar->advance();

// Fin.
$bar->finish();
$this->info(' [Quick Install] Installation finished !');
$this->info(' [Portail Install] Installation finie !');
}

/**
Expand Down Expand Up @@ -161,7 +164,7 @@ private function editEnv(ProgressBar $bar, ProgressBar $subBar)
$this->changeEnv('GINGER_KEY', $value);
$subBar->advance();

$this->info(' [Quick Install] Preparation - Database');
$this->info(' [Portail Install] Préparation - Base de données');
$subBar->advance();

$value = $this->choice('Type ?', ['mysql', 'pgsql', 'sqlite'], 'mysql');
Expand Down
Loading

0 comments on commit ac8a5d8

Please sign in to comment.