From 62aa825c0fdc0b0a16538ab996e2e23a973f2b81 Mon Sep 17 00:00:00 2001 From: Nabeel Shahzad Date: Thu, 10 May 2018 10:17:41 -0500 Subject: [PATCH] Use artisan for the reload-db dev command --- Makefile | 6 +----- app/Console/Commands/DevInstall.php | 21 ++++++++++++++------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index e9c06964..9f46b63d 100644 --- a/Makefile +++ b/Makefile @@ -58,11 +58,7 @@ reset: cleanapp/Models/Traits/JournalTrait.php .PHONY: reload-db reload-db: - @php artisan database:create --reset - @php artisan migrate:fresh --seed - @php artisan phpvms:yaml-import app/Database/seeds/sample.yml - @php artisan phpvms:yaml-import app/Database/seeds/acars.yml - #php artisan phpvms:navdata + @php artisan phpvms:dev-install --reset-db .PHONY: tests tests: test diff --git a/app/Console/Commands/DevInstall.php b/app/Console/Commands/DevInstall.php index 0537e7a6..e24abed7 100644 --- a/app/Console/Commands/DevInstall.php +++ b/app/Console/Commands/DevInstall.php @@ -14,6 +14,14 @@ class DevInstall extends Command protected $signature = 'phpvms:dev-install {--reset-db}'; protected $description = 'Run a developer install and run the sample migration'; + /** + * The YAML files with sample data to import + */ + protected $yaml_imports = [ + 'sample.yml', + 'acars.yml', + ]; + /** * Run dev related commands * @throws \Symfony\Component\HttpFoundation\File\Exception\FileException @@ -34,9 +42,6 @@ class DevInstall extends Command $this->info(\Artisan::output()); - # - # - $this->info('Running migrations'); \Artisan::call('migrate:fresh', [ '--seed' => true, @@ -48,11 +53,13 @@ class DevInstall extends Command # $this->info('Importing sample data'); - \Artisan::call('phpvms:yaml-import', [ - 'files' => ['app/Database/seeds/sample.yml'], - ]); + foreach($this->yaml_imports as $yml) { + \Artisan::call('phpvms:yaml-import', [ + 'files' => ['app/Database/seeds/' . $yml], + ]); - $this->info(\Artisan::output()); + $this->info(\Artisan::output()); + } $this->info('Done!'); }