Added root package to ComposerManager->getPackages()

This commit is contained in:
Vassyli
2016-07-27 08:57:10 +02:00
parent da5445db48
commit ba855d9b56
4 changed files with 10 additions and 7 deletions
+3 -4
View File
@@ -20,7 +20,6 @@ use Symfony\Component\Console\Application;
use LotGD\Core\ {
ComposerManager,
BootstrapInterface,
Exceptions\ArgumentException,
Exceptions\InvalidConfigurationException
};
@@ -47,7 +46,7 @@ class Bootstrap
public function getGame(): Game
{
$composer = $this->createComposerManager();
$this->bootstrapClasses = $this->getBootstrapClasses($composer);
$this->bootstrapClasses = $this->initPackageBootstraps($composer);
$config = $this->createConfiguration();
$logger = $this->createLogger($config, "lotgd");
@@ -114,7 +113,7 @@ class Bootstrap
* @return array
* @throws \Exception
*/
protected function getBootstrapClasses(ComposerManager $composer): array
protected function initPackageBootstraps(ComposerManager $composer): array
{
$packages = $composer->getPackages();
$classes = [];
@@ -223,7 +222,7 @@ class Bootstrap
*/
public function addDaenerysCommands(Application $application)
{
foreach($this->bootstrapClasses as $bootstrap)
foreach ($this->bootstrapClasses as $bootstrap)
{
$bootstrap->addDaenerysCommand($this->game, $application);
}
+1 -1
View File
@@ -9,5 +9,5 @@ interface BootstrapInterface
{
public function hasEntityPath(): bool;
public function getEntityPath(): string;
public function addDaenerysCommand(Application $application);
public function addDaenerysCommand(Game $game, Application $application);
}
+4 -1
View File
@@ -71,7 +71,10 @@ class ComposerManager
*/
public function getPackages(): array
{
return $this->getComposer()->getRepositoryManager()->getLocalRepository()->getPackages();
return array_merge(
[$this->getComposer()->getPackage()],
$this->getComposer()->getRepositoryManager()->getLocalRepository()->getPackages()
);
}
/**
+2 -1
View File
@@ -5,6 +5,7 @@ namespace LotGD\Core\Tests\FakeModule;
use Symfony\Component\Console\Application;
use LotGD\Core\BootstrapInterface;
use LotGD\Core\Game;
class Bootstrap implements BootstrapInterface
{
@@ -18,7 +19,7 @@ class Bootstrap implements BootstrapInterface
return __DIR__ . "/Models";
}
public function addDaenerysCommand(Application $application)
public function addDaenerysCommand(Game $game, Application $application)
{
}