-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from ristekusdi/console-command
Console command
- Loading branch information
Showing
4 changed files
with
65 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/usr/bin/env php | ||
<?php | ||
|
||
$root = dirname(__DIR__); | ||
|
||
if (! is_file(sprintf('%s/vendor/autoload.php', $root))) { | ||
$root = dirname(__DIR__, 4); | ||
} | ||
|
||
require sprintf('%s/vendor/autoload.php', $root); | ||
|
||
use RistekUSDI\SSO\Commands\Copy; | ||
use Symfony\Component\Console\Application; | ||
|
||
$application = new Application(); | ||
|
||
$application->add(new Copy()); | ||
|
||
$application->run(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
namespace RistekUSDI\SSO\Commands; | ||
|
||
use Symfony\Component\Console\Command\Command; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
use Illuminate\Filesystem\Filesystem; | ||
|
||
class Copy extends Command | ||
{ | ||
/** | ||
* The name of the command (the part after "bin/sso"). | ||
* | ||
* @var string | ||
*/ | ||
protected static $defaultName = 'copy:ci3'; | ||
|
||
/** | ||
* The command description shown when running "php bin/sso list". | ||
* | ||
* @var string | ||
*/ | ||
protected static $defaultDescription = 'Copy SSO files for CodeIgniter 3.x!'; | ||
|
||
/** | ||
* Execute the command | ||
* | ||
* @param InputInterface $input | ||
* @param OutputInterface $output | ||
* @return int 0 if everything went fine, or an exit code. | ||
*/ | ||
protected function execute(InputInterface $input, OutputInterface $output): int | ||
{ | ||
(new Filesystem)->copyDirectory(__DIR__.'/../../stubs/ci3', 'application'); | ||
$output->writeln('Copy success!'); | ||
return Command::SUCCESS; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters