/** * Execute command * * @param InputInterface $input Input instance * @param OutputInterface $output Output instance * * @return int|null|void */ public function execute(InputInterface $input, OutputInterface $output) { $paramList = $this->getFullParameterList(); $path = UnixUtility::findFileInDirectortyTree('Makefile'); if (!empty($path)) { $path = dirname($path); $this->output->writeln('<comment>Found Makefile directory: ' . $path . '</comment>'); // Switch to directory of docker-compose.yml PhpUtility::chdir($path); $command = new CommandBuilder('make'); if (!empty($paramList)) { $command->setArgumentList($paramList); } $command->executeInteractive(); } else { $this->output->writeln('<error>No Makefile found in tree</error>'); return 1; } return 0; }
/** * Execute command * * @param InputInterface $input Input instance * @param OutputInterface $output Output instance * * @return int|null|void */ public function execute(InputInterface $input, OutputInterface $output) { $composerCmd = $this->getApplication()->getConfigValue('bin', 'composer'); $paramList = $this->getFullParameterList(); $composerJsonPath = UnixUtility::findFileInDirectortyTree('composer.json'); if (!empty($composerJsonPath)) { $path = dirname($composerJsonPath); $this->output->writeln('<comment>Found composer.json directory: ' . $path . '</comment>'); // Switch to directory of docker-compose.yml PhpUtility::chdir($path); $command = new CommandBuilder(); $command->parse($composerCmd); if (!empty($paramList)) { $command->setArgumentList($paramList); } $command->executeInteractive(); } else { $this->output->writeln('<error>No composer.json found in tree</error>'); return 1; } return 0; }
/** * Find configuration file in current path */ protected function findConfigurationInPath() { $confFileList = array(self::CONFIG_FILE, '.' . self::CONFIG_FILE); // Find configuration file $this->confFilePath = UnixUtility::findFileInDirectortyTree($confFileList); if (empty($this->confFilePath)) { $this->output->writeln('<p-error>No ' . self::CONFIG_FILE . ' found in tree</p-error>'); throw new \CliTools\Exception\StopException(1); } $this->workingPath = dirname($this->confFilePath); $this->output->writeln('<comment>Found ' . self::CONFIG_FILE . ' directory: ' . $this->workingPath . '</comment>'); }
/** * Search docker-compose.yml recursive * * @param NULL|string $path Docker path * * @return bool|string */ public static function searchDockerDirectoryRecursive($path = null) { return UnixUtility::findFileInDirectortyTree('docker-compose.yml', $path); }