Skip to content

Commit

Permalink
Tweak cli scripts to run composer dump-autoload upon successful compl…
Browse files Browse the repository at this point in the history
…etion
  • Loading branch information
rotimi committed May 26, 2024
1 parent 85189f6 commit a27e0b1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/scripts/smvc-create-controller
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,19 @@ if( !\SlimMvcTools\Functions\CliHelpers\isPhpRunningInCliMode() ) {
} else {

try {
$current_directory = getcwd();
echo "Current working directory: " . getcwd() . PHP_EOL;
$result = \SlimMvcTools\Functions\CliHelpers\createController($argc, $argv);

\SlimMvcTools\Functions\CliHelpers\printType(
$result->getReturnCode(), $result->getReturnMessage(), true
);

if($result->getReturnCode() === \SlimMvcTools\Functions\CliHelpers\CliExitCodes::SUCCESS_EXIT) {

passthru("cd {$current_directory} && composer dump-autoload -o");
}

exit($result->getReturnCode());

} catch(\Exception $e) {
Expand Down
8 changes: 8 additions & 0 deletions src/scripts/smvc-create-controller-wizard
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ if( !\SlimMvcTools\Functions\CliHelpers\isPhpRunningInCliMode() ) {
} else {

try {
$current_directory = getcwd();
echo "Current working directory: " . getcwd() . PHP_EOL;

// we are going to mimic $argc and $argv
$psuedo_argv = [];

Expand Down Expand Up @@ -103,6 +106,11 @@ if( !\SlimMvcTools\Functions\CliHelpers\isPhpRunningInCliMode() ) {
true
);

if($result->getReturnCode() === \SlimMvcTools\Functions\CliHelpers\CliExitCodes::SUCCESS_EXIT) {

passthru("cd {$current_directory} && composer dump-autoload -o");
}

exit($result->getReturnCode());

} catch(\Exception $e) {
Expand Down

0 comments on commit a27e0b1

Please sign in to comment.