Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions src/Cli.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,22 @@
* EPV :: The phpBB Forum Extension Pre Validator.
*
* @copyright (c) 2014 phpBB Limited <https://www.phpbb.com>
* @license GNU General Public License, version 2 (GPL-2.0)
* @license GNU General Public License, version 2 (GPL-2.0)
*
*/
namespace Phpbb\Epv;

use Phpbb\Epv\Command\ValidateCommand;
use Symfony\Component\Console\Application;

class Cli extends Application {
class Cli extends Application
{

protected function getDefaultCommands()
{
$commands = parent::getDefaultCommands();
$commands[] = new ValidateCommand();
return $commands;
}
protected function getDefaultCommands()
{
$commands = parent::getDefaultCommands();
$commands[] = new ValidateCommand();

return $commands;
}
}
109 changes: 54 additions & 55 deletions src/Command/ValidateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,81 +4,80 @@
* EPV :: The phpBB Forum Extension Pre Validator.
*
* @copyright (c) 2014 phpBB Limited <https://www.phpbb.com>
* @license GNU General Public License, version 2 (GPL-2.0)
* @license GNU General Public License, version 2 (GPL-2.0)
*
*/
namespace Phpbb\Epv\Command;

use Phpbb\Epv\Output\Output;
use Phpbb\Epv\Output\OutputFormatter;
use Phpbb\Epv\Tests\Exception\TestException;
use Phpbb\Epv\Tests\TestStartup;
use Phpbb\Epv\Output\OutputFormatter;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Tests\Input\InputOptionTest;


class ValidateCommand extends Command{
class ValidateCommand extends Command
{

protected function configure()
{
$this
->setName('run')
->setDescription('Run the Extension Pre Validator on your extension.')
//->addArgument('dir', InputArgument::OPTIONAL, 'The directory the extension is in.')
//->addArgument('git', InputArgument::OPTIONAL, 'A git repository with the extension.')
->addOption('dir', null, InputOption::VALUE_OPTIONAL, 'The directory the extension is in.')
->addOption('git', null, InputOption::VALUE_OPTIONAL, 'A git repository with the extension.')
->addOption('github', null, InputOption::VALUE_OPTIONAL, 'Shortname (like phpbb/phpbb) to github with the extension.')
->addOption('branch', null, InputOption::VALUE_OPTIONAL, 'A branch for the git repo')
protected function configure()
{
$this
->setName('run')
->setDescription('Run the Extension Pre Validator on your extension.')
//->addArgument('dir', InputArgument::OPTIONAL, 'The directory the extension is in.')
//->addArgument('git', InputArgument::OPTIONAL, 'A git repository with the extension.')
->addOption('dir', null, InputOption::VALUE_OPTIONAL, 'The directory the extension is in.')
->addOption('git', null, InputOption::VALUE_OPTIONAL, 'A git repository with the extension.')
->addOption('github', null, InputOption::VALUE_OPTIONAL, 'Shortname (like phpbb/phpbb) to github with the extension.')
->addOption('branch', null, InputOption::VALUE_OPTIONAL, 'A branch for the git repo')
->addOption('debug', null, InputOption::VALUE_NONE, "Run in debug");
}

->addOption('debug', null, InputOption::VALUE_NONE, "Run in debug")
protected function execute(InputInterface $input, OutputInterface $output)
{
$dir = $input->getOption("dir");
$git = $input->getOption('git');
$github = $input->getOption('github');
$branch = $input->getOption('branch');
$type = null;
$loc = null;

;
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$dir = $input->getOption("dir");
$git = $input->getOption('git');
$github = $input->getOption('github');
$branch = $input->getOption('branch');
$type = null;
$loc = null;
if (!empty($github))
{
$type = TestStartup::TYPE_GITHUB;
$loc = $github;
}
else if (!empty($git))
{
$type = TestStartup::TYPE_GIT;
$loc = $git;
}
else if (!empty($dir))
{
$type = TestStartup::TYPE_DIRECTORY;
$loc = $dir;
}
else
{
throw new TestException("Or the git or the dir parameter are required");
}

if (!empty($github))
{
$type = TestStartup::TYPE_GITHUB;
$loc = $github;
}
else if (!empty($git))
{
$type = TestStartup::TYPE_GIT;
$loc = $git;
}
else if (!empty($dir))
{
$type = TestStartup::TYPE_DIRECTORY;
$loc = $dir;
}
else
{
throw new TestException("Or the git or the dir parameter are required");
}
$debug = $input->getOption("debug");

$debug = $input->getOption("debug");
$output = new Output($output, $debug);
$output->setFormatter(new OutputFormatter(true));

$output = new Output($output, $debug);
$output->setFormatter(new OutputFormatter(true));
$test = new TestStartup($output, $type, $loc, $debug, $branch);

$test = new TestStartup($output, $type, $loc, $debug, $branch);
if ($output->getFatalCount() > 0)
{
return 1;
}

if ($output->getFatalCount() > 0)
{
return 1;
}
return 0;
}
return 0;
}
}
10 changes: 5 additions & 5 deletions src/EPV.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,25 @@
* EPV :: The phpBB Forum Extension Pre Validator.
*
* @copyright (c) 2014 phpBB Limited <https://www.phpbb.com>
* @license GNU General Public License, version 2 (GPL-2.0)
* @license GNU General Public License, version 2 (GPL-2.0)
*
*/

if (file_exists(__DIR__ . '/../vendor/autoload.php'))
{
require __DIR__ . '/../vendor/autoload.php';
require __DIR__ . '/../vendor/autoload.php';
}
else if (file_exists(__DIR__ . '/../../../vendor/autoload.php'))
{
require __DIR__ . '/../../../vendor/autoload.php';
require __DIR__ . '/../../../vendor/autoload.php';
}
else if (file_exists(__DIR__ . '/../../../../vendor/autoload.php'))
{
require __DIR__ . '/../../../../vendor/autoload.php';
require __DIR__ . '/../../../../vendor/autoload.php';
}
else
{
exit('Composer autoloading seems to be missing. Did you run composer.phar install?');
exit('Composer autoloading seems to be missing. Did you run composer.phar install?');
}

$app = new Phpbb\Epv\Cli();
Expand Down
Loading