Skip to content

Commit 4cdd02c

Browse files
committed
Merge pull request #26 from paul999/ticket/24
Check differently for packaging structure.
2 parents 7e8cc14 + eb9b1ad commit 4cdd02c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+1652
-1544
lines changed

src/Cli.php

+10-8
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,22 @@
44
* EPV :: The phpBB Forum Extension Pre Validator.
55
*
66
* @copyright (c) 2014 phpBB Limited <https://www.phpbb.com>
7-
* @license GNU General Public License, version 2 (GPL-2.0)
7+
* @license GNU General Public License, version 2 (GPL-2.0)
88
*
99
*/
1010
namespace Phpbb\Epv;
1111

1212
use Phpbb\Epv\Command\ValidateCommand;
1313
use Symfony\Component\Console\Application;
1414

15-
class Cli extends Application {
15+
class Cli extends Application
16+
{
1617

17-
protected function getDefaultCommands()
18-
{
19-
$commands = parent::getDefaultCommands();
20-
$commands[] = new ValidateCommand();
21-
return $commands;
22-
}
18+
protected function getDefaultCommands()
19+
{
20+
$commands = parent::getDefaultCommands();
21+
$commands[] = new ValidateCommand();
22+
23+
return $commands;
24+
}
2325
}

src/Command/ValidateCommand.php

+54-55
Original file line numberDiff line numberDiff line change
@@ -4,81 +4,80 @@
44
* EPV :: The phpBB Forum Extension Pre Validator.
55
*
66
* @copyright (c) 2014 phpBB Limited <https://www.phpbb.com>
7-
* @license GNU General Public License, version 2 (GPL-2.0)
7+
* @license GNU General Public License, version 2 (GPL-2.0)
88
*
99
*/
1010
namespace Phpbb\Epv\Command;
1111

1212
use Phpbb\Epv\Output\Output;
13+
use Phpbb\Epv\Output\OutputFormatter;
1314
use Phpbb\Epv\Tests\Exception\TestException;
1415
use Phpbb\Epv\Tests\TestStartup;
15-
use Phpbb\Epv\Output\OutputFormatter;
1616
use Symfony\Component\Console\Command\Command;
1717
use Symfony\Component\Console\Input\InputArgument;
1818
use Symfony\Component\Console\Input\InputInterface;
1919
use Symfony\Component\Console\Input\InputOption;
2020
use Symfony\Component\Console\Output\OutputInterface;
21-
use Symfony\Component\Console\Tests\Input\InputOptionTest;
2221

2322

24-
class ValidateCommand extends Command{
23+
class ValidateCommand extends Command
24+
{
2525

26-
protected function configure()
27-
{
28-
$this
29-
->setName('run')
30-
->setDescription('Run the Extension Pre Validator on your extension.')
31-
//->addArgument('dir', InputArgument::OPTIONAL, 'The directory the extension is in.')
32-
//->addArgument('git', InputArgument::OPTIONAL, 'A git repository with the extension.')
33-
->addOption('dir', null, InputOption::VALUE_OPTIONAL, 'The directory the extension is in.')
34-
->addOption('git', null, InputOption::VALUE_OPTIONAL, 'A git repository with the extension.')
35-
->addOption('github', null, InputOption::VALUE_OPTIONAL, 'Shortname (like phpbb/phpbb) to github with the extension.')
36-
->addOption('branch', null, InputOption::VALUE_OPTIONAL, 'A branch for the git repo')
26+
protected function configure()
27+
{
28+
$this
29+
->setName('run')
30+
->setDescription('Run the Extension Pre Validator on your extension.')
31+
//->addArgument('dir', InputArgument::OPTIONAL, 'The directory the extension is in.')
32+
//->addArgument('git', InputArgument::OPTIONAL, 'A git repository with the extension.')
33+
->addOption('dir', null, InputOption::VALUE_OPTIONAL, 'The directory the extension is in.')
34+
->addOption('git', null, InputOption::VALUE_OPTIONAL, 'A git repository with the extension.')
35+
->addOption('github', null, InputOption::VALUE_OPTIONAL, 'Shortname (like phpbb/phpbb) to github with the extension.')
36+
->addOption('branch', null, InputOption::VALUE_OPTIONAL, 'A branch for the git repo')
37+
->addOption('debug', null, InputOption::VALUE_NONE, "Run in debug");
38+
}
3739

38-
->addOption('debug', null, InputOption::VALUE_NONE, "Run in debug")
40+
protected function execute(InputInterface $input, OutputInterface $output)
41+
{
42+
$dir = $input->getOption("dir");
43+
$git = $input->getOption('git');
44+
$github = $input->getOption('github');
45+
$branch = $input->getOption('branch');
46+
$type = null;
47+
$loc = null;
3948

40-
;
41-
}
42-
protected function execute(InputInterface $input, OutputInterface $output)
43-
{
44-
$dir = $input->getOption("dir");
45-
$git = $input->getOption('git');
46-
$github = $input->getOption('github');
47-
$branch = $input->getOption('branch');
48-
$type = null;
49-
$loc = null;
49+
if (!empty($github))
50+
{
51+
$type = TestStartup::TYPE_GITHUB;
52+
$loc = $github;
53+
}
54+
else if (!empty($git))
55+
{
56+
$type = TestStartup::TYPE_GIT;
57+
$loc = $git;
58+
}
59+
else if (!empty($dir))
60+
{
61+
$type = TestStartup::TYPE_DIRECTORY;
62+
$loc = $dir;
63+
}
64+
else
65+
{
66+
throw new TestException("Or the git or the dir parameter are required");
67+
}
5068

51-
if (!empty($github))
52-
{
53-
$type = TestStartup::TYPE_GITHUB;
54-
$loc = $github;
55-
}
56-
else if (!empty($git))
57-
{
58-
$type = TestStartup::TYPE_GIT;
59-
$loc = $git;
60-
}
61-
else if (!empty($dir))
62-
{
63-
$type = TestStartup::TYPE_DIRECTORY;
64-
$loc = $dir;
65-
}
66-
else
67-
{
68-
throw new TestException("Or the git or the dir parameter are required");
69-
}
69+
$debug = $input->getOption("debug");
7070

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

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

76-
$test = new TestStartup($output, $type, $loc, $debug, $branch);
76+
if ($output->getFatalCount() > 0)
77+
{
78+
return 1;
79+
}
7780

78-
if ($output->getFatalCount() > 0)
79-
{
80-
return 1;
81-
}
82-
return 0;
83-
}
81+
return 0;
82+
}
8483
}

src/EPV.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,25 @@
55
* EPV :: The phpBB Forum Extension Pre Validator.
66
*
77
* @copyright (c) 2014 phpBB Limited <https://www.phpbb.com>
8-
* @license GNU General Public License, version 2 (GPL-2.0)
8+
* @license GNU General Public License, version 2 (GPL-2.0)
99
*
1010
*/
1111

1212
if (file_exists(__DIR__ . '/../vendor/autoload.php'))
1313
{
14-
require __DIR__ . '/../vendor/autoload.php';
14+
require __DIR__ . '/../vendor/autoload.php';
1515
}
1616
else if (file_exists(__DIR__ . '/../../../vendor/autoload.php'))
1717
{
18-
require __DIR__ . '/../../../vendor/autoload.php';
18+
require __DIR__ . '/../../../vendor/autoload.php';
1919
}
2020
else if (file_exists(__DIR__ . '/../../../../vendor/autoload.php'))
2121
{
22-
require __DIR__ . '/../../../../vendor/autoload.php';
22+
require __DIR__ . '/../../../../vendor/autoload.php';
2323
}
2424
else
2525
{
26-
exit('Composer autoloading seems to be missing. Did you run composer.phar install?');
26+
exit('Composer autoloading seems to be missing. Did you run composer.phar install?');
2727
}
2828

2929
$app = new Phpbb\Epv\Cli();

0 commit comments

Comments
 (0)