示例#1
1
 public function execute(InputInterface $input, OutputInterface $output)
 {
     $options = $input->getOptions();
     if ($input->getArgument('test')) {
         $options['steps'] = true;
     }
     $suite = $input->getArgument('suite');
     $test = $input->getArgument('test');
     $codecept = new \Codeception\Codecept((array) $options);
     $suites = $suite ? array($suite) : \Codeception\Configuration::suites();
     $output->writeln(\Codeception\Codecept::versionString() . "\nPowered by " . \PHPUnit_Runner_Version::getVersionString());
     if ($suite and $test) {
         $codecept->runSuite($suite, $test);
     }
     if (!$test) {
         foreach ($suites as $suite) {
             $codecept->runSuite($suite);
         }
     }
     $codecept->printResult();
     if (!$input->getOption('no-exit')) {
         if ($codecept->getResult()->failureCount() or $codecept->getResult()->errorCount()) {
             exit(1);
         }
     }
 }
 /**
  * Get the value of a command option.
  *
  * @param  string  $key
  * @return string|array
  */
 public function option($key = null)
 {
     if (is_null($key)) {
         return $this->input->getOptions();
     }
     return $this->input->getOption($key);
 }
示例#3
0
 protected function interact(InputInterface $input, OutputInterface $output)
 {
     //    if (!$input->getOption('init'))
     return;
     $options = array($this->getDefinition()->getOption('website-name'), $this->getDefinition()->getOption('web-source-dir'), $this->getDefinition()->getOption('web-prod-dir'), $this->getDefinition()->getOption('web-user'), $this->getDefinition()->getOption('exclude-file'), $this->getDefinition()->getOption('include-file'), $this->getDefinition()->getOption('backup-sources'), $this->getDefinition()->getOption('backup-destination'), $this->getDefinition()->getOption('db-name'), $this->getDefinition()->getOption('db-user'), $this->getDefinition()->getOption('db-pass'));
     $dialog = $this->getDialogHelper();
     foreach ($options as $option) {
         $name = $option->getName();
         $value = $input->getOption($name);
         if (!$value) {
             $value = $option->getDefault();
         }
         $value = $dialog->ask($output, $dialog->getQuestion($name, $value), $value);
         if ($option->isArray()) {
             $array = array($value);
             while ('y' == $dialog->ask($output, $dialog->getQuestion('Do you want to add another?', 'Y/n'), 'y')) {
                 $temp = $dialog->ask($output, $dialog->getQuestion($name, null), null);
                 if (!is_null($temp)) {
                     $array[] = $temp;
                 }
             }
             $value = $array;
         }
         $input->setOption($name, $value);
     }
     fputs(fopen('../config2.yml', 'w'), Yaml::dump($input->getOptions()));
 }
示例#4
0
 /**
  * Execute command
  *
  * @param InputInterface  $input
  * @param OutputInterface $output
  * @throws \RuntimeException
  * @return null
  */
 public function execute(InputInterface $input, OutputInterface $output)
 {
     // checking config
     if ($this->isConfigExist() === false) {
         throw new \RuntimeException('Configuration file does not exist! Run `xmail init`');
     }
     // get requested data
     $request = $input->getOptions();
     $serviceManager = $this->getAppServiceManager();
     foreach ($request['queues'] as $queue) {
         $this->logOutput($output, sprintf($this->prompt['START_PROCESS'], $queue['pid'], $request['subscribersTotal']), "<bg=white;options=bold>%s</>");
         // get queue by process id
         $serviceManager->getQueueData($queue['pid'], function ($processData) use($output, $request, $serviceManager) {
             foreach ($processData as $data) {
                 // create progress instance with total of subscribers
                 $progress = $this->getProgress($output, $request['subscribersTotal'], 'debug');
                 $progress->start();
                 $i = 0;
                 while ($i++ < $request['subscribersTotal']) {
                     // send message
                     $serviceManager->sendMessage($request['subscribers'][$i], $data);
                     $progress->advance();
                 }
                 $progress->finish();
                 $progress->getMessage();
                 $this->logOutput($output, sprintf($this->prompt['DONE_PROCESS'], $data['list_id']), " <bg=white;options=bold>%s</>");
             }
         });
         // remove waste processes from storage
         $serviceManager->removeQueue($queue['pid']);
     }
     // final message
     $this->logOutput($output, $this->prompt['DONE_ALL'], "<fg=white;bg=magenta>%s</fg=white;bg=magenta>");
 }
示例#5
0
 /**
  * Executes the current command.
  *
  * @param InputInterface  $input  An InputInterface instance
  * @param OutputInterface $output An OutputInterface instance
  *
  * @return integer 0 if everything went fine, or an error code
  *
  * @throws \LogicException When this abstract class is not implemented
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     // check command is valid
     $call = strtolower($input->getArgument('call'));
     $argStr = $input->getArgument('args');
     $options = $input->getOptions();
     parse_str($argStr, $args);
     $apiclient = $this->getClient();
     /* @var $apiclient \ServerGrove\APIClient */
     if ($options['url']) {
         $apiclient->setUrl($options['url']);
     }
     if ($options['verbose']) {
         $output->writeln("Calling: <info>" . $apiclient->getFullUrl($call, $args) . "</info>");
     }
     if ($apiclient->call($call, $args)) {
         if ($options['verbose']) {
             $output->writeln("Response: <info>" . print_r($apiclient->getResponse(), true) . "</info>");
         } else {
             $output->writeln($apiclient->getRawResponse());
         }
         return 0;
     } else {
         if ($options['verbose']) {
             $output->writeln("<error>" . $apiclient->getError() . "</error>");
         } else {
             $output->writeln($apiclient->getRawResponse());
         }
         return 1;
     }
 }
示例#6
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     /** @var ApplicationInterface $application */
     $application = $this->getContainer()->get('net_tomas_kadlec_d2s.service.application');
     $outputFormat = $input->getOption('output');
     if (!$application->isOutput($outputFormat)) {
         throw new \RuntimeException('Supported output formats: ' . join(', ', $application->getOutputs()));
     }
     // output options (prefixed with $outputFormat)
     $options = [];
     foreach ($input->getOptions() as $option => $value) {
         if (preg_match("/^{$outputFormat}-/", $option)) {
             $option = preg_replace("/^{$outputFormat}-/", '', $option);
             if (!empty($value)) {
                 $options[$option] = $value;
             }
         }
     }
     if ($input->getOption('all')) {
         $restaurantIds = $application->getRestaurants();
     } else {
         $restaurantIds = $input->getArgument('restaurants');
         if (empty($restaurantIds)) {
             throw new \RuntimeException('Provide one restaurant ID at least or use --all option');
         }
     }
     foreach ($restaurantIds as $restaurantId) {
         if (!$application->isRestaurant($restaurantId)) {
             continue;
         }
         $application->output($restaurantId, $outputFormat, $options);
     }
 }
示例#7
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->directory = getcwd();
     $this->package = strtolower($input->getArgument('package'));
     if (!in_array($this->package, $this->packages)) {
         throw new RuntimeException('The package does not exist!');
     }
     $output->writeln('<info>Crafting application...</info>');
     if (!in_array(1, $input->getOptions()) || $input->getOption("all")) {
         $this->all($input, $output);
     } else {
         if ($input->getOption("models")) {
             $this->models($input, $output);
         }
         if ($input->getOption("views")) {
             $this->views($input, $output);
         }
         if ($input->getOption("controllers")) {
             $this->controllers($input, $output);
         }
         if ($input->getOption("libraries")) {
             $this->library($input, $output);
         }
     }
     $output->writeln("All Done");
 }
示例#8
0
 public function execute(InputInterface $input, OutputInterface $output)
 {
     $suiteName = $input->getArgument('suite');
     $this->output = $output;
     $config = \Codeception\Configuration::config($input->getOption('config'));
     $settings = \Codeception\Configuration::suiteSettings($suiteName, $config);
     $options = $input->getOptions();
     $options['debug'] = true;
     $options['steps'] = true;
     $this->codecept = new \Codeception\Codecept($options);
     $dispatcher = $this->codecept->getDispatcher();
     $suiteManager = new SuiteManager($dispatcher, $suiteName, $settings);
     $this->suite = $suiteManager->getSuite();
     $this->test = new Cept($dispatcher, array('name' => 'interactive', 'file' => 'interactive'));
     $guy = $settings['class_name'];
     $scenario = new Scenario($this->test);
     $I = new $guy($scenario);
     $this->listenToSignals();
     $output->writeln("<info>Interactive console started for suite {$suiteName}</info>");
     $output->writeln("<info>Try Codeception commands without writing a test</info>");
     $output->writeln("<info>type 'exit' to leave console</info>");
     $output->writeln("<info>type 'actions' to see all available actions for this suite</info>");
     $dispatcher->dispatch('suite.before', new Suite($this->suite, $this->codecept->getResult(), $settings));
     $dispatcher->dispatch('test.parsed', new \Codeception\Event\Test($this->test));
     $dispatcher->dispatch('test.before', new \Codeception\Event\Test($this->test));
     $output->writeln("\n\n\$I = new {$settings['class_name']}(\$scenario);");
     $scenario->run();
     $this->executeCommands($output, $I, $settings['bootstrap']);
     $dispatcher->dispatch('test.after', new \Codeception\Event\Test($this->test));
     $dispatcher->dispatch('suite.after', new Suite($this->suite));
     $output->writeln("<info>Bye-bye!</info>");
 }
示例#9
0
 protected function install(InputInterface $input, OutputInterface $output)
 {
     $options = $input->getOptions();
     $composer = isset($options['composer']) ? $options['composer'] : 'composer';
     $this->installDependencies(getcwd(), $output, $composer);
     $this->installMigrations($output, $composer);
 }
示例#10
0
 protected function getSymfonyCommandOptions(InputInterface $input)
 {
     $commandOptions = [];
     foreach ($input->getOptions() as $name => $value) {
         if ($value === false) {
             continue;
         }
         switch ($name) {
             case 'symfony-env':
             case 'verbose':
             case 'profile':
             case 'working-dir':
             case 'project-name':
             case 'cache-dir':
                 break;
             default:
                 if ($value === true) {
                     $commandOptions[] = sprintf('--%s', $name);
                     continue;
                 }
                 if (!empty($value)) {
                     $commandOptions[] = sprintf('--%s=%s', $name, $value);
                 }
                 break;
         }
     }
     return $commandOptions;
 }
示例#11
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $dialog = $this->getHelperSet()->get('dialog');
     $whitelist = array('name', 'description', 'author', 'require');
     $options = array_filter(array_intersect_key($input->getOptions(), array_flip($whitelist)));
     if (isset($options['author'])) {
         $options['authors'] = $this->formatAuthors($options['author']);
         unset($options['author']);
     }
     $options['require'] = isset($options['require']) ? $this->formatRequirements($options['require']) : new \stdClass();
     $file = new JsonFile('composer.json');
     $json = $file->encode($options);
     if ($input->isInteractive()) {
         $output->writeln(array('', $json, ''));
         if (!$dialog->askConfirmation($output, $dialog->getQuestion('Do you confirm generation', 'yes', '?'), true)) {
             $output->writeln('<error>Command aborted</error>');
             return 1;
         }
     }
     $file->write($options);
     if ($input->isInteractive()) {
         $ignoreFile = realpath('.gitignore');
         if (false === $ignoreFile) {
             $ignoreFile = realpath('.') . '/.gitignore';
         }
         if (!$this->hasVendorIgnore($ignoreFile)) {
             $question = 'Would you like the <info>vendor</info> directory added to your <info>.gitignore</info> [<comment>yes</comment>]?';
             if ($dialog->askConfirmation($output, $question, true)) {
                 $this->addVendorIgnore($ignoreFile);
             }
         }
     }
 }
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->factory = $this->getContainer()->get('mautic.factory');
     $queueMode = $this->factory->getParameter('queue_mode');
     // check to make sure we are in queue mode
     if ($queueMode != 'command_process') {
         $output->writeLn('Webhook Bundle is in immediate process mode. To use the command function change the command mode.');
         return 0;
     }
     $options = $input->getOptions();
     /** @var \Mautic\WebhookBundle\Model\WebhookModel $model */
     $model = $this->factory->getModel('webhook.webhook');
     // make sure we only get published webhook entities
     $webhooks = $model->getEntities(array('filter' => array('force' => array(array('column' => 'e.isPublished', 'expr' => 'eq', 'value' => 1)))));
     if (!count($webhooks)) {
         $output->writeln('<error>No published webhooks found. Try again later.</error>');
         return;
     }
     $output->writeLn('<info>Processing Webhooks</info>');
     try {
         $model->processWebhooks($webhooks);
     } catch (\Exception $e) {
         $output->writeLn('<error>' . $e->getMessage() . '</error>');
     }
     $output->writeLn('<info>Webhook Processing Complete</info>');
 }
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $options = array_merge($input->getArguments(), $input->getOptions());
     var_dump($options);
     $this->getClient()->updateAutoScalingGroup($options);
     return self::COMMAND_SUCCESS;
 }
 /**
  * @SuppressWarnings(PHPMD.NPathComplexity)
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  */
 protected function setupStep(InputInterface $input, OutputInterface $output)
 {
     $output->writeln('<info>Setting up database.</info>');
     $dialog = $this->getHelperSet()->get('dialog');
     $container = $this->getContainer();
     $options = $input->getOptions();
     $input->setInteractive(false);
     $this->runCommand('oro:entity-extend:clear', $input, $output)->runCommand('doctrine:schema:drop', $input, $output, array('--force' => true, '--full-database' => true))->runCommand('doctrine:schema:create', $input, $output)->runCommand('oro:entity-config:init', $input, $output)->runCommand('oro:entity-extend:init', $input, $output)->runCommand('oro:entity-extend:update-config', $input, $output, array('--process-isolation' => true))->runCommand('doctrine:schema:update', $input, $output, array('--process-isolation' => true, '--force' => true, '--no-interaction' => true))->runCommand('doctrine:fixtures:load', $input, $output, array('--process-isolation' => true, '--no-interaction' => true, '--append' => true));
     $output->writeln('');
     $output->writeln('<info>Administration setup.</info>');
     $user = $container->get('oro_user.manager')->createUser();
     $role = $container->get('doctrine.orm.entity_manager')->getRepository('OroUserBundle:Role')->findOneBy(array('role' => 'ROLE_ADMINISTRATOR'));
     $businessUnit = $container->get('doctrine.orm.entity_manager')->getRepository('OroOrganizationBundle:BusinessUnit')->findOneBy(array('name' => 'Main'));
     $passValidator = function ($value) {
         if (strlen(trim($value)) < 2) {
             throw new \Exception('The password must be at least 2 characters long');
         }
         return $value;
     };
     $userName = isset($options['user-name']) ? $options['user-name'] : $dialog->ask($output, '<question>Username:</question> ');
     $userEmail = isset($options['user-email']) ? $options['user-email'] : $dialog->ask($output, '<question>Email:</question> ');
     $userFirstName = isset($options['user-firstname']) ? $options['user-firstname'] : $dialog->ask($output, '<question>First name:</question> ');
     $userLastName = isset($options['user-lastname']) ? $options['user-lastname'] : $dialog->ask($output, '<question>Last name:</question> ');
     $userPassword = isset($options['user-password']) ? $options['user-password'] : $dialog->askHiddenResponseAndValidate($output, '<question>Password:</question> ', $passValidator);
     $user->setUsername($userName)->setEmail($userEmail)->setFirstName($userFirstName)->setLastName($userLastName)->setPlainPassword($userPassword)->setEnabled(true)->addRole($role)->setOwner($businessUnit)->addBusinessUnit($businessUnit);
     $container->get('oro_user.manager')->updateUser($user);
     $demo = isset($options['sample-data']) ? strtolower($options['sample-data']) == 'y' : $dialog->askConfirmation($output, '<question>Load sample data (y/n)?</question> ', false);
     // load demo fixtures
     if ($demo) {
         $this->runCommand('oro:demo:fixtures:load', $input, $output, array('--process-isolation' => true, '--process-timeout' => 300));
     }
     $output->writeln('');
     return $this;
 }
示例#15
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $config = new Config();
     $config->setBasePath(getcwd());
     $config->setFromArray($input->getArguments());
     $config->setFromArray($input->getOptions());
     $moduleConfig = new ConfigWriter($config);
     $state = new State($moduleConfig);
     $builder = new OptionsContainer($config);
     $builder->addBuilder(new ExceptionContainer($config));
     $builder->prepare($state);
     $builder->build($state);
     $writeState = new State($moduleConfig);
     $models = array('options' => $state->getModel('options'), 'factory' => $state->getModel('options-factory'), 'trait' => $state->getModel('options-trait'));
     foreach (array_keys($models) as $key) {
         if ($input->getOption('no-' . $key)) {
             $models[$key] = false;
         }
         if ($input->getOption('only-' . $key)) {
             foreach (array_keys($models) as $index) {
                 if ($key != $index) {
                     $models[$index] = false;
                 }
             }
         }
     }
     foreach ($models as $model) {
         if ($model) {
             $writeState->addModel($model);
         }
     }
     $writer = new ModelWriter($config);
     $writer->write($writeState, $output);
     $moduleConfig->save($output);
 }
示例#16
0
 /**
  * Executes the current command
  *
  * @param use Symfony\Component\Console\Input\InputInterface $input
  * @param use Symfony\Component\Console\Input\OutputIterface $output
  *
  * @return null|int null or 0 if everything went fine, or an error code
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->arguments = $input->getArguments();
     $this->options = $input->getOptions();
     $files = $this->collectFiles($this->arguments['source']);
     if (!count($files)) {
         $output->writeln('<comment>No task found! Please check your source path.</comment>');
         exit;
     }
     // List of schedules
     $schedules = [];
     foreach ($files as $file) {
         $schedule = (require $file->getRealPath());
         if (!$schedule instanceof Schedule) {
             continue;
         }
         // We keep the events which are due and dismiss the rest.
         $schedule->events($schedule->dueEvents());
         if (count($schedule->events())) {
             $schedules[] = $schedule;
         }
     }
     if (!count($schedules)) {
         $output->writeln('<comment>No event is due!</comment>');
         exit;
     }
     // Running the events
     (new EventRunner())->handle($schedules);
 }
 /**
  * @see Symfony\Component\Console\Command\Command::execute()
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $index = $input->getOption('index');
     $type = $input->getOption('type');
     $reset = !$input->getOption('no-reset');
     $options = $input->getOptions();
     $options['ignore-errors'] = $input->hasOption('ignore-errors');
     if ($input->isInteractive() && $reset && $input->getOption('offset')) {
         /** @var DialogHelper $dialog */
         $dialog = $this->getHelperSet()->get('dialog');
         if (!$dialog->askConfirmation($output, '<question>You chose to reset the index and start indexing with an offset. Do you really want to do that?</question>', true)) {
             return;
         }
     }
     if (null === $index && null !== $type) {
         throw new \InvalidArgumentException('Cannot specify type option without an index.');
     }
     if (null !== $index) {
         if (null !== $type) {
             $this->populateIndexType($output, $index, $type, $reset, $options);
         } else {
             $this->populateIndex($output, $index, $reset, $options);
         }
     } else {
         $indexes = array_keys($this->indexManager->getAllIndexes());
         foreach ($indexes as $index) {
             $this->populateIndex($output, $index, $reset, $options);
         }
     }
 }
示例#18
0
 /**
  * Retrieves option value
  *
  * @param string|null $key The key
  *
  * @return string|array
  */
 public function option(string $key = null)
 {
     if ($key === null) {
         return $this->input->getOptions();
     }
     return $this->input->getOption($key);
 }
示例#19
0
文件: Config.php 项目: tedivm/spark
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $path = $_SERVER['HOME'] . '/.spark.json';
     if ($input->getOption('clear')) {
         if (file_exists($path)) {
             if (!is_writable($path)) {
                 throw new RuntimeException('Need write permission to erase file ' . $path);
             }
             unlink($path);
             $output->writeln('Configuration deleted from ' . $path);
         } else {
             $output->writeln('Configuration was not present at ' . $path);
         }
         return;
     }
     $rawOptions = $input->getOptions();
     $options = array();
     foreach ($rawOptions as $name => $value) {
         if (!in_array($name, $this->ignoreOptions) && !is_null($value) && $value !== '') {
             $options[$name] = $value;
         }
     }
     $jsonSettings = 0;
     if (defined('JSON_PRETTY_PRINT')) {
         $jsonSettings = $jsonSettings | JSON_PRETTY_PRINT;
     }
     if (file_put_contents($path, json_encode($options, $jsonSettings))) {
         $output->writeln('Configuration saved to ' . $path);
     } else {
         $output->writeln('Unable to save configuration to ' . $path);
     }
 }
示例#20
0
 public function execute(InputInterface $input, OutputInterface $output)
 {
     $suiteName = $input->getArgument('suite');
     $this->output = $output;
     $config = Configuration::config($input->getOption('config'));
     $settings = Configuration::suiteSettings($suiteName, $config);
     $options = $input->getOptions();
     $options['debug'] = true;
     $options['steps'] = true;
     $this->codecept = new Codecept($options);
     $dispatcher = $this->codecept->getDispatcher();
     $this->test = (new Cept())->configDispatcher($dispatcher)->configName('interactive')->config('file', 'interactive')->initConfig();
     $suiteManager = new SuiteManager($dispatcher, $suiteName, $settings);
     $suiteManager->initialize();
     $this->suite = $suiteManager->getSuite();
     $scenario = new Scenario($this->test);
     $actor = $settings['class_name'];
     $I = new $actor($scenario);
     $this->listenToSignals();
     $output->writeln("<info>Interactive console started for suite {$suiteName}</info>");
     $output->writeln("<info>Try Codeception commands without writing a test</info>");
     $output->writeln("<info>type 'exit' to leave console</info>");
     $output->writeln("<info>type 'actions' to see all available actions for this suite</info>");
     $suiteEvent = new SuiteEvent($this->suite, $this->codecept->getResult(), $settings);
     $dispatcher->dispatch(Events::SUITE_BEFORE, $suiteEvent);
     $dispatcher->dispatch(Events::TEST_PARSED, new TestEvent($this->test));
     $dispatcher->dispatch(Events::TEST_BEFORE, new TestEvent($this->test));
     $output->writeln("\n\n\$I = new {$settings['class_name']}(\$scenario);");
     $scenario->run();
     $this->executeCommands($output, $I, $settings['bootstrap']);
     $dispatcher->dispatch(Events::TEST_AFTER, new TestEvent($this->test));
     $dispatcher->dispatch(Events::SUITE_AFTER, new SuiteEvent($this->suite));
     $output->writeln("<info>Bye-bye!</info>");
 }
示例#21
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $args = $input->getArguments();
     $first = array_shift($args);
     // If the first argument is an alias, assign the next argument as the
     // command.
     if (strpos($first, '@') === 0) {
         $alias = $first;
         $command = array_shift($args);
     } else {
         $alias = '@self';
         $command = $first;
     }
     $options = $input->getOptions();
     // Force the 'backend' option to TRUE.
     $options['backend'] = TRUE;
     $return = drush_invoke_process($alias, $command, array_values($args), $options, ['interactive' => TRUE]);
     if ($return['error_status'] > 0) {
         foreach ($return['error_log'] as $error_type => $errors) {
             $output->write($errors);
         }
         // Add a newline after so the shell returns on a new line.
         $output->writeln('');
     } else {
         $output->page(drush_backend_get_result());
     }
 }
 /**
  * Executes command.
  * @param InputInterface $input
  * @param OutputInterface $output
  * @return bool|void
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->detectMagento($output);
     if (!$this->initMagento()) {
         return;
     }
     // setting the options - hypernode demands it
     $this->_options = $input->getOptions();
     // finding the effective url e.g. store.nl -> https://www.store.nl
     if ($this->_options['current-url'] && $this->_options['compare-url']) {
         $this->_options['current-url'] = $this->getEffectiveUrl($this->_options['current-url']);
         $this->_options['compare-url'] = $this->getEffectiveUrl($this->_options['compare-url']);
     }
     // get sitemaps to process
     if (!$this->_options['sitemap']) {
         $this->_sitemaps = $this->askSitemapsToProcess($input, $output);
     } else {
         $sitemapFromInput = $this->getSitemapFromInput($this->_options);
         if (!$sitemapFromInput && !$this->_options['silent']) {
             $output->writeln('<error>Could not fetch specified sitemap: ' . $this->_options['sitemap'] . '</error>');
         } else {
             $this->_sitemaps = $sitemapFromInput;
         }
     }
     // prepare the requests
     if ($this->_sitemaps) {
         $this->_batches = $this->prepareRequests($input, $output);
     }
     // execute the requests
     if ($this->_batches) {
         $this->_results = $this->executeBatches($input, $output);
     }
     // serve the results
     if ($this->_results) {
         if ($this->_options['silent'] && !$this->_options['format']) {
             $output->write(json_encode($this->_results) . PHP_EOL);
             // hypernode internal
         } else {
             $tableHelper = $this->getHelper('table');
             if ($this->_options['format']) {
                 // user specified format
                 $tableData = $this->generateTablesDataForFormat($this->_results);
             } else {
                 $tableData = $this->generateTablesData($this->_results);
             }
             foreach ($tableData as $data) {
                 if (!$this->_options['silent']) {
                     $this->writeSection($output, "Performance status report - [Byte Hypernode]");
                 }
                 $tableHelper->setHeaders($data['headers']);
                 if ($this->_options['format']) {
                     $tableHelper->renderByFormat($output, $data['requests'], $this->_options['format']);
                 } else {
                     $tableHelper->renderByFormat($output, $data['requests']);
                 }
             }
         }
     }
 }
 /**
  * {@inheritdoc}
  */
 protected function initialize(InputInterface $input, OutputInterface $output)
 {
     foreach ($input->getOptions() as $key => $option) {
         if (array_key_exists($key, $this->validators)) {
             call_user_func_array($this->validators[$key], [$input->getOption($key), $input, $output]);
         }
     }
 }
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $configuration = array_merge($input->getArguments(), $input->getOptions());
     $this->routeService->configureRouteObject($configuration);
     $message = $this->routeService->executeCommand();
     // I want to move this into the service so that I can just throw the $message into writeln and forget about it
     $output->writeln("<info>Route Updated in -- {$this->routeService->getRouteObject()->get('module')} Module Config File --</info>");
 }
 /**
  * {@inheritDoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $options = array_merge($input->getArguments(), $input->getOptions());
     $options['BlockDeviceMappings'] = json_decode($options['BlockDeviceMappings']);
     $result = $this->getClient()->createImage($options);
     $output->writeln('AMI Image created with id ' . $result->get('ImageId'));
     return self::COMMAND_SUCCESS;
 }
示例#26
0
 /**
  * Prepare config
  *
  * @param InputInterface $input
  */
 protected function prepareConfig(InputInterface $input)
 {
     $this->config = new Config();
     $this->config->setBasePath(getcwd());
     $this->config->setFromArray($input->getArguments());
     $this->config->setFromArray($input->getOptions());
     $this->configWriter = new ConfigWriter($this->config);
 }
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $configuration = array_merge($input->getArguments(), $input->getOptions());
     $this->routeService->configureRouteObject($configuration);
     $message = $this->routeService->executeCommand();
     $output->writeln("<info>Route Added to -- {$this->routeService->getRouteObject()->get('module')} Module Config File --</info>");
     $output->writeln("<comment>{$message}</comment>");
 }
示例#28
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->options = $input->getOptions();
     $this->setInput($input);
     $this->setOutput($output);
     $this->git = new Gitorade($this->getContainer());
     $this->setDialog($this->getHelperSet()->get('dialog'));
 }
 /**
  * {@inheritdoc}
  */
 protected function interact(InputInterface $input, OutputInterface $output)
 {
     foreach ($input->getOptions() as $option => $value) {
         if ($value === null) {
             $input->setOption($option, $this->io->ask(sprintf('%s', ucfirst($option))));
         }
     }
 }
示例#30
0
文件: Command.php 项目: vvval/spiral
 /**
  * {@inheritdoc}
  */
 public function run(InputInterface $input, OutputInterface $output)
 {
     $this->input = $input;
     $this->output = $output;
     //We can refill internal options as we don't need them at this stage
     $this->options = $this->input->getOptions();
     $this->arguments = $this->input->getArguments();
     return parent::run($input, $output);
 }