Skip to content

Commit

Permalink
Remove the eject command from MakeCommands.php
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanNerd committed Jun 13, 2021
1 parent 39cad73 commit 44a65ca
Showing 1 changed file with 0 additions and 42 deletions.
42 changes: 0 additions & 42 deletions app/Robo/Plugin/Commands/MakeCommands.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,46 +222,4 @@ final public function reset(): void {
RoboBase::showThrowableAndDie($e);
}
}

/**
* Remove Sample controller, routes, & other artifacts from the project
*/
final public function eject(): void {
$cli = $this->cli;
$cli->br();
$cli
->bold()
->backgroundLightRed()
->white()
->border('*');
$cli
->bold()
->backgroundLightRed()
->white('eject is a destructive operation. It removes the Sample controller, route, etc.');
$cli
->bold()
->backgroundLightRed()
->white('It will also overwrite the RegisterControllers.php file.');
$cli
->bold()
->backgroundLightRed()
->white()
->border('*');
$cli->br();
/** @var Input $input */
$input = $cli->bold()->lightGray()->confirm('Are you sure you want to proceed?');
if (!$input->confirmed()) {
die();
}

$sampleDirPath = __DIR__ . '/../../../Controllers/Sample';
array_map('unlink', glob("$sampleDirPath/*.*"));
unlink($sampleDirPath);

// Rebuild RegisterControllers.php
$loader = new FilesystemLoader(__DIR__ . '/Templates');
$twig = new Twig($loader);
$registerControllers = new RegisterForge($twig);
$registerControllers->forgeRegisterControllers();
}
}

0 comments on commit 44a65ca

Please sign in to comment.