Skip to content

Commit

Permalink
Merge pull request #26 from paul999/ticket/24
Browse files Browse the repository at this point in the history
Check differently for packaging structure.
  • Loading branch information
paul999 committed Oct 22, 2014
2 parents 7e8cc14 + eb9b1ad commit 4cdd02c
Show file tree
Hide file tree
Showing 59 changed files with 1,652 additions and 1,544 deletions.
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

0 comments on commit 4cdd02c

Please sign in to comment.