-
-
Save avoelkl/ede6dd57b436f6d9b4eb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Generate modman file from Magento Connect 2.0 package.xml | |
* | |
* Usage: | |
* | |
* php package2modman.php path/to/package.xml > path/to/modman | |
* | |
*/ | |
require_once(getcwd()."/app/Mage.php"); | |
$package = new Mage_Connect_Package($argv[1]); | |
$modmanDefinition = array(); | |
foreach ($package->getContents() as $path) { | |
$path = preg_replace('{^\./}', '', $path); | |
$path = preg_replace('{^app/code/(.*?)/(.*?)/(.*?)/(.*)$}', 'app/code/$1/$2/$3', $path); | |
$path = preg_replace('{^lib/(.*?)/(.*)$}', 'lib/$1', $path); | |
$path = preg_replace('{^js/(.*?)/(.*?)/(.*)$}', 'js/$1', $path); | |
$path = preg_replace('{^app/design/(.*?)/(.*?)/default/layout/(.*?)/(.*)$}', 'app/design/$1/$2/default/layout/$3', $path); | |
$path = preg_replace('{^app/design/(.*?)/(.*?)/default/template/(.*?)/(.*)$}', 'app/design/$1/$2/default/template/$3', $path); | |
$path = preg_replace('{^skin/(.*?)/(.*?)/default/(.*?)/(.*?)/(.*)$}', 'skin/$1/$2/default/$3/$4', $path); | |
$modmanDefinition[$path] = $path; | |
} | |
foreach ($modmanDefinition as $source => $target) { | |
printf("%s %s\n", $source, $target); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment