protected function execute(InputInterface $input, OutputInterface $output) { $io = new SymfonyStyle($input, $output); $name = str_replace('/', '\\', $input->getArgument('name')); $this->migrator->set_output_handler(new log_wrapper_migrator_output_handler($this->language, new console_migrator_output_handler($this->user, $output), $this->phpbb_root_path . 'store/migrations_' . time() . '.log', $this->filesystem)); $this->cache->purge(); if (!in_array($name, $this->load_migrations())) { $io->error($this->language->lang('MIGRATION_NOT_VALID', $name)); return 1; } else { if ($this->migrator->migration_state($name) === false) { $io->error($this->language->lang('MIGRATION_NOT_INSTALLED', $name)); return 1; } } try { while ($this->migrator->migration_state($name) !== false) { $this->migrator->revert($name); } } catch (\phpbb\db\migration\exception $e) { $io->error($e->getLocalisedMessage($this->user)); $this->finalise_update(); return 1; } $this->finalise_update(); $io->success($this->language->lang('INLINE_UPDATE_SUCCESSFUL')); }
protected function execute(InputInterface $input, OutputInterface $output) { mb_internal_encoding('UTF-8'); try { list($line, $colonne) = explode("x", $input->getOption("size")); $symfonyStyle = new SymfonyStyle($input, $output); $symfonyStyle->title("IA"); $mapRender = !$input->getOption("curse") ? new ConsoleMapRender($output, true) : new NCurseRender($line, $colonne); if (!$input->getOption("load-dump")) { $sizeMap = $mapRender->getSize(); $mapProvider = $input->getOption("map") ? new FileMapProvider($input->getOption("map")) : new RandomMapProvider($sizeMap["y"], $sizeMap["x"]); $map = new MapBuilder($mapProvider->getMap()); $world = new World($map, array($this->addChat(5, 5), $this->addChat(10, 10))); } else { $file = $input->getOption("load-dump"); if (!file_exists($file)) { if (extension_loaded("ncurses") && $mapRender instanceof NCurseRender) { ncurses_end(); } $symfonyStyle->error("le fichier {$file} n'existe pas"); return; } $world = unserialize(file_get_contents($file))->getFlashMemory()->all()[0]->getData(); } while (1) { $this->render($mapRender, $world); } } catch (\Exception $e) { if (extension_loaded("ncurses") && $mapRender instanceof NCurseRender) { ncurses_end(); } $symfonyStyle->error($e->getMessage()); return; } }
/** * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { $io = new SymfonyStyle($input, $output); $io->title('Pre-commit delete'); $git = new GitVersionControl(); $projectBase = $git->getProjectBase(); $hookDir = $projectBase . '/.git/hooks'; if (!$io->confirm('Are you sure to remove Pre-commit hooks on this project?', true)) { exit(0); } $output->writeln(''); if (!is_dir($hookDir)) { $io->error(sprintf('The git hook directory does not exist (%s)', $hookDir)); exit(1); } $target = $hookDir . '/pre-commit'; $fs = new Filesystem(); if (is_file($target)) { $fs->remove($target); $io->success('pre-commit was deleted'); exit(0); } $io->error(sprintf('pre-commit file does\'nt exist (%s)', $target)); exit(1); }
protected function error($message) { if ($this->verbose) { $this->io->error($message); } else { $this->output->writeln('[ERROR]' . $message); } die; }
/** * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { $this->input = $input; $this->output = new SymfonyStyle($input, $output); $this->environment = new Environment(getcwd(), new Git()); if (!$this->environment->isInRepository()) { $this->output->error('Versioner needs to run in a folder with Git'); return 1; } $this->fire(); }
protected function execute(InputInterface $input, OutputInterface $output) { $this->io = new SymfonyStyle($input, $output); $this->sort = $input->getOption('sort'); $this->sleepTime = $input->getOption('sleepTime'); if (!$input->hasOption('sleepTime') && $output->getVerbosity() >= OutputInterface::VERBOSITY_NORMAL) { $this->sleepTime = 25; } // Transform milliseconds in microseconds for usleep() $this->sleepTime = $this->sleepTime * 1000; $this->numberOfCodesToGenerate = $input->getOption('amount'); // The length of each outputted code $this->codeLength = $input->getOption('length'); // All possible chars. By default, 'A' to 'Z' and '0' to '9' $this->possibleChars = str_split($input->getOption('characters')); $baseNumberOfChars = count($this->possibleChars); $this->possibleChars = array_unique($this->possibleChars); // If there's an error here, we'll say it later $maxPossibleNumberOfCombinations = pow(count($this->possibleChars), $this->codeLength); if ($maxPossibleNumberOfCombinations < $this->numberOfCodesToGenerate) { $this->io->error(sprintf('Cannot generate %s combinations because there are only %s combinations possible', number_format($this->numberOfCodesToGenerate, 0, '', ' '), number_format($maxPossibleNumberOfCombinations, 0, '', ' '))); return 1; } else { $this->io->block(sprintf('Generating %s combinations.', number_format($this->numberOfCodesToGenerate, 0, '', ' ')), null, 'info'); if ($maxPossibleNumberOfCombinations > $this->numberOfCodesToGenerate) { $this->io->block(sprintf('Note: If you need you can generate %s more combinations (with a maximum of %s).', number_format($maxPossibleNumberOfCombinations - $this->numberOfCodesToGenerate, 0, '', ' '), number_format($maxPossibleNumberOfCombinations, 0, '', ' ')), null, 'comment'); } } $this->io->block('Available characters:'); $this->io->block(implode('', $this->possibleChars), null, 'info'); $codesList = $this->doGenerate(); $outputFile = $input->getOption('output'); if ($outputFile) { $save = true; if (file_exists($outputFile)) { $save = $this->io->confirm(sprintf('File %s exists. Erase it?', $outputFile), false); } if ($save) { $this->io->block(sprintf('Output results to %s', $outputFile), null, 'info'); if (!file_put_contents($outputFile, implode("\n", $codesList))) { throw new \Exception(sprintf('Could not write to %s...', $outputFile)); } } } else { $this->io->text($codesList); } if ($baseNumberOfChars !== count($this->possibleChars)) { $this->io->warning(sprintf('We detected that there were duplicate characters in "%s", so we removed them.', $input->getOption('characters'))); } return 0; }
protected function execute(InputInterface $input, OutputInterface $output) { // throw new \Exception('boo'); $directory = realpath($input->getArgument('directory')); $directoryOutput = $input->getArgument('outputdirectory'); /* @var $logger Psr\Log\LoggerInterface */ $this->logger = $this->getContainer()->get('logger'); $io = new SymfonyStyle($input, $output); $io->title('DDD Model Generation'); $clean = $input->hasOption('clean'); if ($clean) { $io->section('Clean output directoty'); $fs = new \Symfony\Component\Filesystem\Filesystem(); try { $fs->remove($directoryOutput); } catch (IOExceptionInterface $e) { $io->error($e->getMessage()); } $io->text('clean of ' . $directoryOutput . ' completed'); } if (is_dir($directory)) { $finder = new Finder(); $finder->search($directory); foreach ($finder->getFindedFiles() as $file) { if (pathinfo($file, PATHINFO_FILENAME) == 'model.yml') { $io->text('Analizzo model.yml in ' . pathinfo($file, PATHINFO_DIRNAME)); $dddGenerator = new DDDGenerator(); $dddGenerator->setLogger($this->logger); $dddGenerator->analyze($file); $dddGenerator->generate($directoryOutput); } } $io->section('Php-Cs-Fixer on generated files'); $fixer = new \Symfony\CS\Console\Command\FixCommand(); $input = new ArrayInput(['path' => $directoryOutput, '--level' => 'psr2', '--fixers' => 'eof_ending,strict_param,short_array_syntax,trailing_spaces,indentation,line_after_namespace,php_closing_tag']); $output = new BufferedOutput(); $fixer->run($input, $output); $content = $output->fetch(); $io->text($content); if (count($this->errors) == 0) { $io->success('Completed generation'); } else { $io->error($this->errors); } } else { $io->caution('Directory ' . $directory . ' not valid'); } // PER I WARNING RECUPERABILI //$io->note('Generate Class'); }
protected function execute(InputInterface $input, OutputInterface $output) { $this->migrationPath = str_replace('/', DIRECTORY_SEPARATOR, $this->getContainer()->getParameter('campaignchain_update.bundle.schema_dir')); $io = new SymfonyStyle($input, $output); $io->title('Gathering migration files from CampaignChain packages'); $io->newLine(); $locator = $this->getContainer()->get('campaignchain.core.module.locator'); $bundleList = $locator->getAvailableBundles(); if (empty($bundleList)) { $io->error('No CampaignChain Module found'); return; } $migrationsDir = $this->getContainer()->getParameter('doctrine_migrations.dir_name'); $fs = new Filesystem(); $table = []; foreach ($bundleList as $bundle) { $packageSchemaDir = $this->getContainer()->getParameter('kernel.root_dir') . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . $bundle->getName() . $this->migrationPath; if (!$fs->exists($packageSchemaDir)) { continue; } $migrationFiles = new Finder(); $migrationFiles->files()->in($packageSchemaDir)->name('Version*.php'); $files = []; /** @var SplFileInfo $migrationFile */ foreach ($migrationFiles as $migrationFile) { $fs->copy($migrationFile->getPathname(), $migrationsDir . DIRECTORY_SEPARATOR . $migrationFile->getFilename(), true); $files[] = $migrationFile->getFilename(); } $table[] = [$bundle->getName(), implode(', ', $files)]; } $io->table(['Module', 'Versions'], $table); if (!$input->getOption('gather-only')) { $this->getApplication()->run(new ArrayInput(['command' => 'doctrine:migrations:migrate', '--no-interaction' => true]), $output); } }
/** * Executes the command. * * Checks if an update is available. * If at least one is available, a message is printed and if verbose mode is set the list of possible updates is printed. * If their is none, nothing is printed unless verbose mode is set. * * @param InputInterface $input Input stream, used to get the options. * @param OutputInterface $output Output stream, used to print messages. * @return int 0 if the board is up to date, 1 if it is not and 2 if an error occured. * @throws \RuntimeException */ protected function execute(InputInterface $input, OutputInterface $output) { $io = new SymfonyStyle($input, $output); $recheck = true; if ($input->getOption('cache')) { $recheck = false; } $stability = null; if ($input->getOption('stability')) { $stability = $input->getOption('stability'); if (!($stability == 'stable') && !($stability == 'unstable')) { $io->error($this->language->lang('CLI_ERROR_INVALID_STABILITY', $stability)); return 3; } } $ext_name = $input->getArgument('ext-name'); if ($ext_name != null) { if ($ext_name == 'all') { return $this->check_all_ext($io, $stability, $recheck); } else { return $this->check_ext($input, $io, $stability, $recheck, $ext_name); } } else { return $this->check_core($input, $io, $stability, $recheck); } }
/** * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { $model = $input->getArgument('model'); $seeds = $input->getArgument('seeds'); $io = new SymfonyStyle($input, $output); if (!class_exists($model)) { $io->error(array('The model you specified does not exist.', 'You can create a model with the "model:create" command.')); return 1; } $this->dm = $this->createDocumentManager($input->getOption('server')); $faker = Faker\Factory::create(); AnnotationRegistry::registerAutoloadNamespace('Hive\\Annotations', dirname(__FILE__) . '/../../'); $reflectionClass = new \ReflectionClass($model); $properties = $reflectionClass->getProperties(\ReflectionProperty::IS_PUBLIC); $reader = new AnnotationReader(); for ($i = 0; $i < $seeds; $i++) { $instance = new $model(); foreach ($properties as $property) { $name = $property->getName(); $seed = $reader->getPropertyAnnotation($property, 'Hive\\Annotations\\Seed'); if ($seed !== null) { $fake = $seed->fake; if (class_exists($fake)) { $instance->{$name} = $this->createFakeReference($fake); } else { $instance->{$name} = $faker->{$seed->fake}; } } } $this->dm->persist($instance); } $this->dm->flush(); $io->success(array("Created {$seeds} seeds for {$model}")); }
/** * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { $io = new SymfonyStyle($input, $output); $fileInput = trim($input->getArgument('file')); $pathInfoFile = pathinfo(realpath($fileInput)); $file = new File('', realpath($fileInput), $pathInfoFile['dirname']); $fileCollection = new FileCollection(); $fileCollection = $fileCollection->append($file); $reporter = new Reporter($output, 1); $review = new StaticReview($reporter); $review->addReview(new PhpCsFixerReview(self::AUTO_ADD_GIT)); // Review the staged files. $review->files($fileCollection); // Check if any matching issues were found. if ($reporter->hasIssues()) { $reporter->displayReport(); } if ($reporter->hasIssueLevel(Issue::LEVEL_ERROR)) { $io->error('✘ Please fix the errors above.'); exit(1); } else { $io->success('✔ Looking good.'); exit(0); } }
/** * @return Changelog */ protected function updateChangelog() { // If the release already exists and we don't want to overwrite it, cancel $question = 'Version <comment>' . $this->version . '</comment> already exists, create anyway?'; if ($this->changelog->hasRelease($this->version) && !$this->output->confirm($question, false)) { return false; } // Summarize commits $this->summarizeCommits(); // Gather changes for new version $this->output->section('Gathering changes for <comment>' . $this->version . '</comment>'); $changes = $this->gatherChanges(); if (!$changes) { $this->output->error('No changes to create version with'); return false; } if ($this->from) { $from = $this->changelog->getRelease($this->from); $this->changelog->removeRelease($this->from); $changes = array_merge_recursive($from['changes'], $changes); } // Add to changelog $this->changelog->addRelease(['name' => $this->version, 'date' => date('Y-m-d'), 'changes' => $changes]); // Show to user and confirm $preview = $this->changelog->toMarkdown(); $this->output->note($preview); if (!$this->output->confirm('This is your new CHANGELOG.md, all good?')) { return false; } // Write out to CHANGELOG.md $this->changelog->save(); return $this->changelog; }
protected function execute(InputInterface $input, OutputInterface $output) { $stdout = $output; $output = new SymfonyStyle($input, $output); if (false !== strpos($input->getFirstArgument(), ':l')) { $output->caution('The use of "twig:lint" command is deprecated since version 2.7 and will be removed in 3.0. Use the "lint:twig" instead.'); } $twig = $this->getTwigEnvironment(); if (null === $twig) { $output->error('The Twig environment needs to be set.'); return 1; } $filenames = $input->getArgument('filename'); if (0 === count($filenames)) { if (0 !== ftell(STDIN)) { throw new \RuntimeException('Please provide a filename or pipe template content to STDIN.'); } $template = ''; while (!feof(STDIN)) { $template .= fread(STDIN, 1024); } return $this->display($input, $stdout, $output, array($this->validate($twig, $template, uniqid('sf_')))); } $filesInfo = $this->getFilesInfo($twig, $filenames); return $this->display($input, $stdout, $output, $filesInfo); }
protected function execute(InputInterface $input, OutputInterface $output) { $io = new SymfonyStyle($input, $output); $entityManager = $this->getContainer()->get('doctrine.orm.entity_manager'); $groupRepository = $entityManager->getRepository('OctavaAdministratorBundle:Group'); $resourceRepository = $entityManager->getRepository('OctavaAdministratorBundle:Resource'); $groupNames = $input->getOption('group'); foreach ($groupNames as $groupName) { /** @var Group $group */ $group = $groupRepository->findOneBy(['name' => $groupName]); if (!$group) { $io->error(sprintf('Group "%s" not found', $groupName)); continue; } $rows = []; $existsResources = $group->getResources(); /** @var \Octava\Bundle\AdministratorBundle\Entity\Resource $resource */ foreach ($resourceRepository->findAll() as $resource) { if ($existsResources->contains($resource)) { continue; } $group->addResource($resource); $rows[] = [$resource->getResource(), $resource->getAction()]; } if ($rows) { $io->section($groupName); $headers = ['Resource', 'Action']; $io->table($headers, $rows); $entityManager->persist($group); $entityManager->flush(); } } }
/** * @param string $cmd * @param bool $ignoreErrors * * @throws Exception */ private function execCmd($cmd, $ignoreErrors = false) { $cmd = 'cd ' . $this->workspacePath . ' && ' . $cmd; if ($this->io->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) { $this->io->comment($cmd); } $process = new Process($cmd); $process->run(function ($type, $buffer) use($ignoreErrors) { if (Process::ERR === $type) { if ($ignoreErrors) { if ($this->io->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) { $this->io->comment($buffer); } } else { $this->io->error($buffer); } } else { if ($this->io->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) { $this->io->comment($buffer); } } }); if (!$ignoreErrors && !$process->isSuccessful()) { throw new Exception($process->getOutput() . $process->getErrorOutput()); } }
/** * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { $io = new SymfonyStyle($input, $output); $io->title('Pre-commit install'); $git = new GitVersionControl(); $projectBase = $git->getProjectBase(); $phpunit = $io->confirm('Enable PhpUnit ?', true); $source = realpath($projectBase); $hookDir = $source . '/.git/hooks'; $defaultPhpUnitConfFile = $source . '/' . self::PHPUNIT_DEFAULT_CONF_FILENAME; $precommitCommand = sprintf('precommit check%s', $phpunit ? ' --phpunit true' : ''); if ($phpunit) { $phpunitPath = $io->ask('Specify Phpunit bin path [example: vendor/bin/phpunit] ? : ', 'phpunit'); $phpunitConfFile = $io->ask('Specify Phpunit config file path ? : ', $defaultPhpUnitConfFile); if ($phpunitPath != '') { if (strpos($phpunitPath, '/') !== false) { $phpunitPath = $source . '/' . $phpunitPath; if (!is_file($phpunitPath)) { $io->error(sprintf('No phpunit bin found "%s"', $phpunitPath)); exit(1); } } } if (!is_file($phpunitConfFile)) { $io->error(sprintf('No phpunit conf file found "%s"', $phpunitConfFile)); exit(1); } $precommitCommand .= $phpunitPath != 'phpunit' ? ' --phpunit-bin-path ' . $phpunitPath : ''; $precommitCommand .= $phpunitConfFile != $defaultPhpUnitConfFile ? ' --phpunit-conf ' . $phpunitConfFile : ''; } if (!is_dir($hookDir)) { $io->error(sprintf('The git hook directory does not exist (%s)', $hookDir)); exit(1); } $target = $hookDir . '/pre-commit'; $fs = new Filesystem(); if (!is_file($target)) { $fileContent = sprintf("#!/bin/sh\n%s", $precommitCommand); $fs->dumpFile($target, $fileContent); chmod($target, 0755); $io->success('pre-commit file correctly updated'); } else { $io->note(sprintf('A pre-commit file is already exist. Please add "%s" at the end !', $precommitCommand)); } exit(0); }
/** * @param SymfonyStyle $io * @param string $address * @param string $webDir * @param string $router * * @return null|\Symfony\Component\Process\Process */ protected function createServerProcess(SymfonyStyle $io, $address, $webDir, $router) { if (!file_exists($router)) { $io->error(sprintf('The router script "%s" does not exist', $router)); return null; } $finder = new PhpExecutableFinder(); if (($binary = $finder->find()) === false) { $io->error('Unable to find PHP binary to run server.'); return null; } $builder = new ProcessBuilder([$binary, '-S', $address, '-t', $webDir, $router]); $builder->setTimeout(null); if ($io->getVerbosity() < OutputInterface::VERBOSITY_VERBOSE) { $builder->disableOutput(); } return $builder->getProcess(); }
/** * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { $io = new SymfonyStyle($input, $output); $file = $input->getOption('config') ?: sprintf('%s/pbjc.yml', getcwd()); if (!file_exists($file)) { $io->error(sprintf('File "%s" does not exists.', $file)); return; } $parser = new Parser(); $data = $parser->parse(file_get_contents($file)); if (!is_array($data['namespaces'])) { $data['namespaces'] = [$data['namespaces']]; } $io->title('Generated files for namespaces:'); $io->listing($data['namespaces']); // output callback $callback = function (OutputFile $file) use($io) { $io->text($file->getFile()); if (!is_dir(dirname($file->getFile()))) { mkdir(dirname($file->getFile()), 0777, true); } file_put_contents($file->getFile(), $file->getContents()); }; $languages = []; if (isset($data['languages'])) { $languages = $data['languages']; unset($data['languages']); } $compile = new Compiler(); foreach ($languages as $language => $options) { if ($input->getOption('language') && $input->getOption('language') != $language) { continue; } $options = array_merge($data, $options, ['callback' => $callback]); try { $io->section($language); $compile->run($language, new CompileOptions($options)); $io->success("👍"); //thumbs-up-sign } catch (\Exception $e) { $io->error($e->getMessage()); } } }
/** * Determine the absolute file path for the router script, using the * environment to choose a standard script if no custom router script is * specified. * * @param string|null $router File path of the custom router script, if * set by the user; otherwise null * @param string $context The context of the application kernel * @param SymfonyStyle $io An SymfonyStyle instance * * @return bool|string The absolute file path of the router script, or false * on failure */ private function determineRouterScript($router, $context, SymfonyStyle $io) { if (null === $router) { $router = $this->getContainer()->get('kernel')->locateResource(sprintf('@SuluCoreBundle/Resources/config/router_%s.php', $context)); } if (false === ($path = realpath($router))) { $io->error(sprintf('The given router script "%s" does not exist.', $router)); return false; } return $path; }
protected function execute(InputInterface $input, OutputInterface $output) { $io = new SymfonyStyle($input, $output); $pdoSessionHandler = $this->getContainer()->get('session.handler.pdo'); try { $pdoSessionHandler->createTable(); $io->success('Session\'s table was successfully created.'); } catch (\Exception $e) { $io->error($e->getMessage()); } }
protected function execute(InputInterface $input, OutputInterface $output) { $io = new SymfonyStyle($input, $output); $db = $this->getContainer()->get('database_connection'); try { $db->exec(sprintf('DROP TABLE %s', $this->table)); $io->success('Session\'s table was successfully dropped.'); } catch (\Exception $e) { $io->error($e->getMessage()); } }
/** * * {@inheritdoc} * */ protected function execute(InputInterface $input, OutputInterface $output) { $io = new SymfonyStyle($input, $output); $path = $this->getContainer()->getParameter('kernel.root_dir') . '/' . $input->getArgument('path'); if (!is_dir($path)) { $io->error(sprintf('The given document directory "%s" does not exist', $path)); return 1; } $io->success(sprintf('Found app here: %s', $path)); $io->comment('Quit the process with CONTROL-C.'); $process = new Process('cd ' . $path . ' && npm run tsc'); try { $process->mustRun(); $output->writeln($process->getOutput()); } catch (ProcessFailedException $e) { $io->error($e->getMessage()); return 1; } $io->success(sprintf('Successfully compiled the app.')); $output->writeln($text); }
/** * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { /** @var DefaultContext $context */ $context = $this->getContainer()->get('whte_rbt_file_inspections.default_context'); $context->execute(); $style = new SymfonyStyle($input, $output); if (!$context->hasErrors()) { $style->success('All inspections within all jobs successfully executed.'); } else { $style->error(sprintf('%d inspection error(s) within %d job(s) occurred during execution of the jobs. Please see Emails (if configured) for further information.', $context->countErroneousInspectors(), $context->countErroneousJobs())); } }
protected function execute(InputInterface $input, OutputInterface $output) { $extractor = $this->getContainer()->get('ng_symfony.extractor'); $io = new SymfonyStyle($input, $output); $io->title('Creating angular-ui status'); try { $extractor->scanByConfig(); $io->success('Angular UI States exported!'); } catch (\Exception $e) { $io->error($e->getMessage()); } }
/** * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { $io = new SymfonyStyle($input, $output); $address = $input->getArgument('address'); if (false === strpos($address, ':')) { $address = sprintf('%s:8088', $address); } $finder = new PhpExecutableFinder(); if (false === ($binary = $finder->find())) { $io->error($this->trans('commands.server.errors.binary')); return; } $io->success(sprintf($this->trans('commands.server.messages.executing'), $binary)); $processBuilder = new ProcessBuilder([$binary, '-S', $address]); $process = $processBuilder->getProcess(); $process->setWorkingDirectory($this->getDrupalHelper()->getRoot()); $process->setTty('true'); $process->run(); if (!$process->isSuccessful()) { $io->error($process->getErrorOutput()); } }
protected function execute(InputInterface $input, OutputInterface $output) { $io = new SymfonyStyle($input, $output); $io->title('Secuirty Check'); $fileName = __DIR__ . 'composer.lock'; if ($this->logger) { $this->logger->info('Start security check on ' . $fileName); } //@see: https://github.com/sensiolabs/security-checker $checker = new SecurityChecker(); $alerts = $checker->check('composer.lock'); count($alerts) > 0 ? $io->error($alerts) : $io->success('security checked!'); }
public function execute(InputInterface $input, OutputInterface $output) { /* @var Sentry $sentry */ $sentry = $this->app['sentry']; $email = $input->getArgument('email'); $io = new SymfonyStyle($input, $output); $io->title('OpenCFP'); $io->section(sprintf('Promoting account with email %s to Admin', $email)); try { $user = $sentry->getUserProvider()->findByLogin($email); } catch (UserNotFoundException $e) { $io->error(sprintf('Could not find account with email %s.', $email)); return 1; } if ($user->hasAccess('admin')) { $io->error(sprintf('Account with email %s already is in the Admin group.', $email)); return 1; } $adminGroup = $sentry->getGroupProvider()->findByName('Admin'); $user->addGroup($adminGroup); $io->success(sprintf('Added account with email %s to the Admin group', $email)); }
/** * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { $output = new SymfonyStyle($input, $output); $address = $input->getArgument('address'); if (false === strpos($address, ':')) { $address = $address . ':' . $input->getOption('port'); } $lockFile = $this->getLockFile($address); if (!file_exists($lockFile)) { $output->error(sprintf('No web server is listening on http://%s', $address)); return 1; } unlink($lockFile); $output->success(sprintf('Stopped the web server listening on http://%s', $address)); }
/** * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { $io = new SymfonyStyle($input, $output); $git = new GitVersionControl(); $stagedFiles = $git->getStagedFiles(); $projectBase = $git->getProjectBase(); $reporter = new Reporter($output, count($stagedFiles)); $review = new StaticReview($reporter); $review->addReview(new ComposerLockReview())->addReview(new ComposerLintReview())->addReview(new PhpLintReview())->addReview(new PhpStopWordsReview())->addReview(new JsStopWordsReview())->addReview(new EsLintReview(self::AUTO_ADD_GIT))->addReview(new YmlLintReview())->addReview(new JsonLintReview())->addReview(new XmlLintReview())->addReview(new GitConflictReview()); // -------------------------------------------------------- // Front Dev profile // -------------------------------------------------------- /*$review->addReview(new ScssLintReview()) ->addReview(new SassConvertFixerReview(self::AUTO_ADD_GIT));*/ // -------------------------------------------------------- // Dev PHP profile // -------------------------------------------------------- $phpCodeSniffer = new PhpCodeSnifferReview(); $phpCodeSniffer->setOption('standard', 'Pear'); $phpCodeSniffer->setOption('sniffs', 'PEAR.Commenting.FunctionComment'); $review->addReview(new PhpCPDReview())->addReview(new PhpMDReview())->addReview($phpCodeSniffer); // -------------------------------------------------------- $review->files($stagedFiles); $reporter->displayReport(); $testingReporter = new Reporter($output, 0); // -------------------------------------------------------- // Dev PHP profile // -------------------------------------------------------- if (!$reporter->hasIssueLevel(Issue::LEVEL_ERROR) && count($stagedFiles) > 0) { $testingReview = new TestingReview($testingReporter); if ($input->getOption('phpunit')) { $testingReview->addReview(new PhpUnitReview($input->getOption('phpunit-bin-path'), $input->getOption('phpunit-conf'), $projectBase)); } $testingReview->review(); $testingReporter->displayReport(); } // -------------------------------------------------------- if ($reporter->hasIssueLevel(Issue::LEVEL_ERROR) || $testingReporter->hasIssueLevel(Issue::LEVEL_ERROR)) { $io->error('✘ Please fix the errors above or use --no-verify.'); exit(1); } elseif ($reporter->hasIssueLevel(Issue::LEVEL_WARNING) || $testingReporter->hasIssueLevel(Issue::LEVEL_WARNING)) { $io->note('Try to fix warnings !'); } else { $io->success('✔ Looking good.'); } exit(0); }
protected function execute(InputInterface $input, OutputInterface $output) { $constantName = $input->getOption('constant-name'); $moduleName = $input->getOption('module-name'); $url = $input->getOption('url'); $filePath = $input->getOption('file-path'); $extractor = $this->getContainer()->get('ng_symfony.extractor'); $io = new SymfonyStyle($input, $output); $io->title('Creating angular-ui status'); try { $extractor->scanRoutesAndSaveFile($url); $extractor->saveStateFile($moduleName, $constantName, $filePath); $io->success('Angular UI States exported!' . "\n\nPath: " . $filePath); } catch (\Exception $e) { $io->error($e->getMessage()); } }