protected function execute(InputInterface $input, OutputInterface $output) { $this->stepHook('pre'); //Load Magento core $mageFile = realpath(getcwd() . '/../../app/Mage.php'); if (!@(include_once $mageFile)) { throw new \Exception('Can\'t find Mage.php. Are you running this from your `.modman` directory?'); } else { require_once $mageFile; } //Boilerplate umask(0); \Mage::app(); $output->write('Generating XML... '); // Generate a package XML file from our template and modman file $packageXmlFile = $this->_generatePackageXmlFile($input->getOption('package-template-xml-file'), $input->getOption('modman-file')); $packageXmlFile = getcwd() . '/' . $packageXmlFile; $output->writeln('<info>Done.</info>'); //Build package $output->write('Building package... '); chdir('../../'); $package = new \Mage_Connect_Package($packageXmlFile); $package->save($input->getOption('output-directory')); $output->writeln('<info>Done.</info>'); $this->stepHook('post'); }
/** * Package command callback * @param string $command * @param array $options * @param array $params * @return void */ public function doPackage($command, $options, $params) { $this->cleanupParams($params); if (count($params) < 1) { return $this->doError($command, "Parameters count should be >= 1"); } $file = strtolower($params[0]); $file = realpath($file); if (!file_exists($file)) { return $this->doError($command, "File {$params[0]} doesn't exist"); } try { $packager = new Mage_Connect_Package($file); $res = $packager->validate(); if (!$res) { $this->doError($command, implode("\n", $packager->getErrors())); return; } $packager->save(dirname($file)); $this->ui()->output('Done building package'); } catch (Exception $e) { $this->doError($command, $e->getMessage()); } }