Skip to content

Commit

Permalink
feat: move rockshell init in a dedicated file to support rockmigratio…
Browse files Browse the repository at this point in the history
…ns rockshell api
  • Loading branch information
BernhardBaumrock committed Feb 11, 2024
1 parent 5f637e5 commit cca1fcb
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 17 deletions.
18 changes: 1 addition & 17 deletions rock
Original file line number Diff line number Diff line change
@@ -1,19 +1,3 @@
#!/usr/bin/env php
<?php

use Symfony\Component\Console\Output\ConsoleOutput;

require __DIR__ . '/vendor/autoload.php';
$app = new \RockShell\Application();
$app->registerCommands();
try {
if (version_compare(phpversion(), '8.0', '<')) {
throw new Exception(
"PHP Version must be at least 8.0 - your version is " . phpversion()
);
}
$app->run();
} catch (\Throwable $th) {
$output = new ConsoleOutput();
$output->writeln("<bg=red;options=bold>" . $th->getMessage() . "</>");
}
include __DIR__ . "/rock.php";
22 changes: 22 additions & 0 deletions rock.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

use Symfony\Component\Console\Output\ConsoleOutput;

/**
* This is a separate file to keep DRY for RockMigrations rockshell() method
*/

require __DIR__ . '/vendor/autoload.php';
$app = new \RockShell\Application();
$app->registerCommands();
try {
if (version_compare(phpversion(), '8.0', '<')) {
throw new Exception(
"PHP Version must be at least 8.0 - your version is " . phpversion()
);
}
$app->run();
} catch (\Throwable $th) {
$output = new ConsoleOutput();
$output->writeln("<bg=red;options=bold>" . $th->getMessage() . "</>");
}

0 comments on commit cca1fcb

Please sign in to comment.