diff --git a/.env.example.php b/.env.example.php new file mode 100644 index 00000000..6b3e9c98 --- /dev/null +++ b/.env.example.php @@ -0,0 +1,9 @@ + 'mysql', + 'DB_HOST' => 'localhost', + 'DB_DATABASE' => 'cachet', + 'DB_USERNAME' => 'homestead', + 'DB_PASSWORD' => 'secret', +]; diff --git a/.gitignore b/.gitignore index 290dae62..23dc9251 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ .env.php config.codekit !.env.heroku.php +!.env.example.php # Assets development /node_modules diff --git a/app/config/app.php b/app/config/app.php index 15f6db4b..db422d9c 100644 --- a/app/config/app.php +++ b/app/config/app.php @@ -127,6 +127,7 @@ return [ 'CachetHQ\Cachet\Providers\RepositoryServiceProvider', 'CachetHQ\Cachet\Providers\RoutingServiceProvider', + 'CachetHQ\Cachet\Providers\ConsoleServiceProvider', ], diff --git a/app/start/artisan.php b/app/start/artisan.php deleted file mode 100644 index 409e9adb..00000000 --- a/app/start/artisan.php +++ /dev/null @@ -1,12 +0,0 @@ -migrate = $migrate; + + parent::__construct(); + } + + /** + * Execute the console command. + * + * @return int|null + */ + public function fire() + { + if ($this->migrate) { + return $this->runMigrations(); + } + + $this->info('Please run "php artisan migrate" to finish the installation.'); + } + + /** + * Run the migrations. + * + * @return int|null + */ + protected function runMigrations() + { + $options = [ + '--database' => $this->input->getOption('database'), + '--force' => $this->input->getOption('force'), + '--seed' => $this->input->getOption('seed'), + ]; + + return $this->call('migrate', $options); + } + + /** + * Get the console command options. + * + * @return array + */ + protected function getOptions() + { + return [ + ['database', null, InputOption::VALUE_OPTIONAL, 'The database connection to use.'], + ['force', null, InputOption::VALUE_NONE, 'Force the operation to run when in production.'], + ['seed', null, InputOption::VALUE_NONE, 'Indicates if the seed task should be re-run.'], + ]; + } +} diff --git a/src/Providers/ConsoleServiceProvider.php b/src/Providers/ConsoleServiceProvider.php new file mode 100644 index 00000000..368c78a1 --- /dev/null +++ b/src/Providers/ConsoleServiceProvider.php @@ -0,0 +1,31 @@ +commands('CachetHQ\Cachet\Commands\OneClickDeployCommand'); + } + + /** + * Register the service provider. + * + * @return void + */ + public function register() + { + $this->app->singleton('CachetHQ\Cachet\Commands\OneClickDeployCommand', function ($app) { + return new OneClickDeployCommand($app->environment('heroku')); + }); + } +}