Skip to content

Instantly share code, notes, and snippets.

@rskuipers
Last active August 29, 2015 14:02
Show Gist options
  • Save rskuipers/87ba0e0daede7ce24e7c to your computer and use it in GitHub Desktop.
Save rskuipers/87ba0e0daede7ce24e7c to your computer and use it in GitHub Desktop.
Magento CLI create package
<?php
require_once 'abstract.php';
class RSKuipers_Shell_Packager extends Mage_Shell_Abstract
{
public function run()
{
$package = $this->getArg('package');
$outputDir = $this->getArg('output');
$root = $this->getArg('root');
if (!$package || !$outputDir) {
die($this->usageHelp());
}
if ($root) {
chdir($root);
}
$package = new Mage_Connect_Package($package);
$package->save($outputDir);
}
public function usageHelp()
{
return <<<USAGE
Usage: php -f packager.php -- [options]
--root <dir> Root directory where the files to package are
--package <file> package.xml to use
--output <dir> directory to output the .tgz
USAGE;
}
}
$shell = new RSKuipers_Shell_Packager();
$shell->run();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment