Skip to content

Fix for marshalling magento modules #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
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
38 changes: 1 addition & 37 deletions src/MagentoHackathon/Composer/Magento/DeployManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,6 @@ class DeployManager
*/
protected $sortPriority = array();

/**
* @var Installer
*/
private $installer;

public function __construct(IOInterface $io)
{
$this->io = $io;
Expand All @@ -54,18 +49,6 @@ public function setSortPriority($priorities)
$this->sortPriority = $priorities;
}


public function setInstaller(Installer $installer)
{
$this->installer = $installer;
}

public function getInstaller()
{
return $this->installer;
}


/**
* uses the sortPriority Array to sort the packages.
* Highest priority first.
Expand Down Expand Up @@ -98,35 +81,16 @@ function ($a, $b) use ($getPriorityValue) {
);
}


public function doDeploy($installedLocalPackages = array())
public function doDeploy()
{
$this->sortPackages();
$packageCount = count($this->packages);
$installedLocalPackagesCount = count($installedLocalPackages);
$installedPackages = [];

/** @var Entry $package */
foreach ($this->packages as $package) {
if ($this->io->isDebug()) {
$this->io->write('start magento deploy for ' . $package->getPackageName());
}
$package->getDeployStrategy()->deploy();
$installedPackages [$package->getPackageName()] = $package->getPackageName();
}
if (!empty($installedLocalPackages) && $packageCount !== $installedLocalPackagesCount) {
$packageTypes = PackageTypes::$packageTypes;
foreach ($installedLocalPackages as $package) {
if (!isset($installedPackages[$package->getName()]) && isset($packageTypes[$package->getType()])) {
if ($this->io->isDebug()) {
$this->io->write('Updating missing packages ' . $package->getName());
}
$strategy = $this->getInstaller()->getDeployStrategy($package);
$strategy->setMappings($this->getInstaller()->getParser($package)->getMappings());
$strategy->deploy();
}
}

}
}
}
11 changes: 2 additions & 9 deletions src/MagentoHackathon/Composer/Magento/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,6 @@ class Plugin implements PluginInterface, EventSubscriberInterface
*/
protected $filesystem;

/**
* @var array PackageInterface
*/
protected $installedPackages = [];

protected function initDeployManager(Composer $composer, IOInterface $io)
{
$this->deployManager = new DeployManager($io);
Expand Down Expand Up @@ -145,10 +140,8 @@ public function onNewCodeEvent(\Composer\Script\CommandEvent $event)
if ($this->io->isDebug()) {
$this->io->write('start magento deploy via deployManager');
}
$command = $event->getName();
$this->installedPackages = $event->getComposer()->getRepositoryManager()->getLocalRepository()->getPackages();
$this->deployManager->setInstaller($this->installer);
$this->deployManager->doDeploy($this->installedPackages);

$this->deployManager->doDeploy();
$this->deployLibraries();
$this->saveVendorDirPath($event->getComposer());
}
Expand Down