/** * This method will write the code file with all of the generated javascript objects. * * @param InputInterface $input * @param OutputInterface $output */ protected function writeCode(InputInterface $input, OutputInterface $output) { $directory = $input->getArgument('directory'); $fileName = './' . $directory . '/generatedscript.js'; $output->writeLn($fileName); $this->commandUtility->filePutContents($fileName, $this->code); }
/** * This method will run a find command and call the appropriate method to override the found classes * with a specified base class. * * @param string $findCommand * @param array $baseClassParts * @param string $searchPattern */ protected function replaceInFiles($findCommand, $searchPattern, $replace) { $fileList = []; $this->commandUtility->exec($findCommand, $fileList); $replaceCommand = "sed -i -e \"s/%s/%s/g\" %s"; foreach ($fileList as $file) { $command = sprintf($replaceCommand, $searchPattern, $replace, $file, $file); $this->commandUtility->exec($command); } }