protected function execute(InputInterface $input, OutputInterface $output) { $helper = $this->getHelper('package'); Util\TmpDir::set($input->getOption('tmp-dir')); /* TODO Rework this to use the Info package command */ $cb = function (Interfaces\Package $package) use($helper, $output) { $helper->showInfo($output, $package); }; $path = rtrim($input->getArgument('path'), '/\\'); /* Getting package unpacked first, then use the path*/ $package = $this->getHelper('package')->convey($input, $output, $path); $release = Release::factory($package->getRootDir(), $cb, $input->getOption('no-convert'), $input->getOption('binary')); if ($input->getOption('binary')) { list($optionsValue, $force_opts) = $this->buildOptions($package, $input, $output); $build = \Pickle\Package\Command\Build::factory($package, $optionsValue); try { $build->prepare(); $build->createTempDir($package->getUniqueNameForFs()); $build->configure($force_opts); $build->make(); $this->saveBuildLogs($input, $build); } catch (\Exception $e) { if ($input->getOption('pack-logs')) { $release->packLog($build); } else { $this->saveBuildLogs($input, $build); } $output->writeln('The following error(s) happened: ' . $e->getMessage()); } $args = array('build' => $build); try { $release->create($args); if ($input->getOption('pack-logs')) { $release->packLog(); } } catch (Exception $e) { if ($input->getOption('pack-logs')) { $release->packLog(); } $build->cleanup(); throw new \Exception($e->getMessage()); } } else { /* imply --source */ try { $release->create(); if ($input->getOption('pack-logs')) { $release->packLog(); } } catch (Exception $e) { if ($input->getOption('pack-logs')) { $release->packLog(); } throw new \Exception($e->getMessage()); } } }
protected function sourceInstall($package, InputInterface $input, OutputInterface $output, $optionsValue = [], $force_opts = '') { $helper = $this->getHelperSet()->get('question'); $build = \Pickle\Package\Command\Build::factory($package, $optionsValue); try { $build->prepare(); $build->createTempDir($package->getUniqueNameForFs()); $build->configure($force_opts); $build->make(); $build->install(); $this->saveBuildLogs($input, $build); } catch (\Exception $e) { $this->saveBuildLogs($input, $build); $output->writeln('The following error(s) happened: ' . $e->getMessage()); $prompt = new ConfirmationQuestion('Would you like to read the log?', true); if ($helper->ask($input, $output, $prompt)) { $output->write($build->getLog()); } } $build->cleanup(); }