Skip to content

Commit

Permalink
Merge pull request magento#3 from bibumathew/master
Browse files Browse the repository at this point in the history
Fix : magento-root-dir provided via composer.json
  • Loading branch information
maksek committed Nov 19, 2014
2 parents a4bbfb9 + ff6ee63 commit 5d7e846
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/MagentoHackathon/Composer/Magento/Installer.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,10 @@ public function __construct(IOInterface $io, Composer $composer, $type = 'magent

$dir = rtrim(trim($extra['magento-root-dir']), '/\\');
$this->magentoRootDir = new \SplFileInfo($dir);
if (!is_dir($dir) && $io->askConfirmation('magento root dir "' . $dir . '" missing! create now? [Y,n] ')) {
$this->initializeMagentoRootDir($dir);
$io->write('magento root dir "' . $dir . '" created');
}

if (!is_dir($dir)) {
$dir = $this->vendorDir . "/$dir";
Expand Down Expand Up @@ -209,6 +213,26 @@ public function getDeployManager()
return $this->deployManager;
}

/**
* Create base requrements for project installation
*/
protected function initializeMagentoRootDir() {
if (!$this->magentoRootDir->isDir()) {
$magentoRootPath = $this->magentoRootDir->getPathname();
$pathParts = explode(DIRECTORY_SEPARATOR, $magentoRootPath);
$baseDir = explode(DIRECTORY_SEPARATOR, $this->vendorDir);
array_pop($baseDir);
$pathParts = array_merge($baseDir, $pathParts);
$directoryPath = '';
foreach ($pathParts as $pathPart) {
$directoryPath .= $pathPart . DIRECTORY_SEPARATOR;
$this->filesystem->ensureDirectoryExists($directoryPath);
}
}

// $this->getSourceDir($package);
}


/**
*
Expand Down

0 comments on commit 5d7e846

Please sign in to comment.