Skip to content

Commit

Permalink
added install app command
Browse files Browse the repository at this point in the history
  • Loading branch information
josephmancuso committed Jul 24, 2017
1 parent 27d5a51 commit 3b340e5
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CreateEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ private function new($eventName, OutputInterface $output)
$output->writeln("Event already exists. Try renaming this event.");
return false;
}

if (!file_exists("application/App/Providers/Events")) {
mkdir("application/App/Providers/Events");
}

$output->writeln("Creating Event ... ");
if (fopen("application/Providers/Events/$eventName.php", "a")) {
$startevent = "<?php\n\n";
Expand Down
44 changes: 44 additions & 0 deletions InstallApp.php
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 ...");
}
}
}

0 comments on commit 3b340e5

Please sign in to comment.