-
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.
- Loading branch information
1 parent
27d5a51
commit 3b340e5
Showing
2 changed files
with
49 additions
and
0 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
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,44 @@ | ||
<?php | ||
|
||
namespace MiraCommand; | ||
|
||
use Symfony\Component\Console\Command\Command; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
use Symfony\Component\Console\Input\InputArgument; | ||
|
||
class InstallApp extends Command | ||
{ | ||
public function configure() | ||
{ | ||
$this->setName("new:install") | ||
->setDescription('Install an app from github') | ||
->addArgument('github', InputArgument::REQUIRED, "Github account e.x: account/repo"); | ||
} | ||
|
||
public function execute(InputInterface $input, OutputInterface $output) | ||
{ | ||
$github = $input->getArgument('github'); | ||
|
||
$this->new($github, $output); | ||
} | ||
|
||
public static function new($github, OutputInterface $output) | ||
{ | ||
$created = true; | ||
$github = explode("/", $github); | ||
|
||
$github_account = $github[0]; | ||
$github_repo = ucwords($github[1]); | ||
|
||
$github_url = "https://github.com/$github_account/$github_repo.git"; | ||
|
||
exec("cd application/App && git clone $github_url $github_repo"); | ||
|
||
if ($created) { | ||
$output->writeln("App Successfully Created!"); | ||
} else { | ||
$output->writeln("App could not be created ..."); | ||
} | ||
} | ||
} |