Example #1
0
 /**
  * {@inheritDoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $session = $this->getPhpcrSession();
     $dumperHelper = $this->getPhpcrConsoleDumperHelper();
     // node to dump
     $identifier = $input->getArgument('identifier');
     // whether to dump node uuid
     $options = array();
     $options['dump_uuids'] = $input->hasParameterOption('--identifiers');
     $options['ref_format'] = $input->getOption('ref-format');
     $options['show_props'] = $input->hasParameterOption('--props');
     $options['show_sys_nodes'] = $input->hasParameterOption('--sys-nodes');
     $options['max_line_length'] = $input->getOption('max_line_length');
     if (null !== $options['ref_format'] && !in_array($options['ref_format'], array('uuid', 'path'))) {
         throw new \Exception('The ref-format option must be set to either "path" or "uuid"');
     }
     $walker = $dumperHelper->getTreeWalker($output, $options);
     try {
         if (UUIDHelper::isUUID($identifier)) {
             $node = $session->getNodeByIdentifier($identifier);
         } else {
             $node = $session->getNode($identifier);
         }
         $walker->traverse($node, $input->getOption('depth'));
     } catch (RepositoryException $e) {
         if ($e instanceof PathNotFoundException || $e instanceof ItemNotFoundException) {
             $output->writeln("<error>Path '{$identifier}' does not exist</error>");
         } else {
             throw $e;
         }
         return 1;
     }
     return 0;
 }
Example #2
0
 /**
  * Executes the current command.
  *
  * @param InputInterface  $input  An InputInterface instance
  * @param OutputInterface $output An OutputInterface instance
  * @return null|int null or 0 if everything went fine, or an error code
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $configNames = $input->getArgument('name');
     $configName = array_shift($configNames);
     $defaultValue = $input->getOption('default-value');
     if (!in_array($configName, $this->systemConfig->getKeys()) && !$input->hasParameterOption('--default-value')) {
         return 1;
     }
     if (!in_array($configName, $this->systemConfig->getKeys())) {
         $configValue = $defaultValue;
     } else {
         $configValue = $this->systemConfig->getValue($configName);
         if (!empty($configNames)) {
             foreach ($configNames as $configName) {
                 if (isset($configValue[$configName])) {
                     $configValue = $configValue[$configName];
                 } else {
                     if (!$input->hasParameterOption('--default-value')) {
                         return 1;
                     } else {
                         $configValue = $defaultValue;
                         break;
                     }
                 }
             }
         }
     }
     $this->writeMixedInOutputFormat($input, $output, $configValue);
     return 0;
 }
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     self::$label = $input->getOption('label');
     // tricky test, as hasOption( 'env' ) always returns true
     if ($input->hasParameterOption('--env') || $input->hasParameterOption('-e')) {
         self::$forcedEnv = $input->getOption('env');
     }
     $driverName = $input->getOption('driver');
     $debug = $input->getOption('debug');
     $timeout = $input->getOption('timeout');
     $this->driver = $this->getContainer()->get('kaliop_queueing.drivermanager')->getDriver($driverName);
     if ($debug !== null) {
         $this->driver->setDebug($debug);
     }
     // reimplementation of parent::execute($input, $output); to add timeout, let consumers handle signals better
     // this is now handled by the driver
     //if (defined('AMQP_DEBUG') === false) {
     //    define('AMQP_DEBUG', (bool) $input->getOption('debug'));
     //}
     $this->amount = $input->getOption('messages');
     if (0 > $this->amount) {
         throw new \InvalidArgumentException("The -m option should be null or greater than 0");
     }
     $this->initConsumer($input);
     try {
         $this->consumer->consume($this->amount, $timeout);
     } catch (ForcedStopException $e) {
         // exit gracefully with a message
         $output->writeln("Stopped because: " . $e->getMessage());
     }
     // end reimplementation
     // reset label after execution is done, in case of weird usage patterns
     self::$label = null;
 }
Example #4
0
 /**
  * @param InputInterface $input
  * @param OutputInterface $output
  *
  * @throws \InvalidArgumentException
  * @return int|null|void
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->helper = $this->getHelper('resource');
     $mapmode = strtolower($input->getOption('mapmode'));
     if (!in_array($mapmode, array('world', 'server'))) {
         throw new \InvalidArgumentException("--mapmode must be 'world' or 'server'");
     }
     $mapname = $input->getOption('mapname');
     $this->mapdir = $input->getOption('mapdir');
     $lang = $input->getOption('lang');
     if ($this->mapdir[0] != '/') {
         $this->mapdir = $this->helper->get('app.path') . '/' . $this->mapdir;
     }
     $withMap = $input->hasParameterOption('--with-map');
     $withCity = $input->hasParameterOption('--with-city');
     $withRegionColor = $input->hasParameterOption('--with-region-color');
     $output->writeln("=======================");
     $output->writeln("mode = <info>{$mapmode}</info>");
     $output->writeln("mapdir = <info>{$this->mapdir}</info>");
     if (!$withMap && !$withCity && empty($lang)) {
         throw new \InvalidArgumentException("Use --with-map, --with-city, --lang options\n");
     }
     $config = $this->helper->get('map-config');
     $this->proj = new MapProjection();
     $this->proj->setServerZones($this->helper->get('server.json.array'));
     $maps = $config['maps'];
     if ($mapmode == 'world') {
         $this->proj->setWorldZones($this->helper->get('world.json.array'));
     } else {
         // include individual zone map
         $maps = array_merge($maps, $config['zones']);
         unset($maps['world']);
         $this->proj->setWorldZones(array('grid' => array(array(0, 47520), array(108000, 0))));
     }
     $this->mapmode = $mapmode;
     $this->mapname = $mapname;
     $this->tileStorage = $this->helper->get('tilestorage');
     // map tiles
     $minMapZoom = 1;
     $maxMapZoom = 11;
     // city map on world image
     $minCityZoom = 10;
     $maxCityZoom = 11;
     // text tiles
     $minTextZoom = 5;
     $maxTextZoom = 12;
     // generate tiles for world map zone placement
     if ($withMap) {
         $this->doMaps($maps, $minMapZoom, $maxMapZoom, $output);
     }
     if ($withCity) {
         $this->doMaps($config['cities'], $minCityZoom, $maxCityZoom, $output);
     }
     if (!empty($lang)) {
         $languages = explode(',', $lang);
         foreach ($languages as $l) {
             $this->doTextTiles($l, $minTextZoom, $maxTextZoom, $output);
         }
     }
 }
Example #5
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $configNames = $input->getArgument('name');
     $configName = $configNames[0];
     if (sizeof($configNames) > 1) {
         if ($input->hasParameterOption('--error-if-not-exists') && !in_array($configName, $this->systemConfig->getKeys())) {
             $output->writeln('<error>System config ' . implode(' => ', $configNames) . ' could not be deleted because it did not exist</error>');
             return 1;
         }
         $value = $this->systemConfig->getValue($configName);
         try {
             $value = $this->removeSubValue(array_slice($configNames, 1), $value, $input->hasParameterOption('--error-if-not-exists'));
         } catch (\UnexpectedValueException $e) {
             $output->writeln('<error>System config ' . implode(' => ', $configNames) . ' could not be deleted because it did not exist</error>');
             return 1;
         }
         $this->systemConfig->setValue($configName, $value);
         $output->writeln('<info>System config value ' . implode(' => ', $configNames) . ' deleted</info>');
         return 0;
     } else {
         if ($input->hasParameterOption('--error-if-not-exists') && !in_array($configName, $this->systemConfig->getKeys())) {
             $output->writeln('<error>System config ' . $configName . ' could not be deleted because it did not exist</error>');
             return 1;
         }
         $this->systemConfig->deleteValue($configName);
         $output->writeln('<info>System config value ' . $configName . ' deleted</info>');
         return 0;
     }
 }
Example #6
0
 /**
  * @see Console\Command\Command
  */
 protected function initialize(InputInterface $input, OutputInterface $output)
 {
     $project = $this->getApplication()->getProject();
     if (true === $input->hasParameterOption(array('--path', '-p'))) {
         #switch path to the argument
         $project->getPath()->parse((string) $input->getOption('path'));
         # change the extension directories
         $project['loader']->setExtensionNamespace('Faker\\Extension', $project->getPath()->get());
     }
     #try and detect if path exits
     $path = $project->getPath()->get();
     if ($path === false) {
         throw new \RuntimeException('Project Folder does not exist');
     }
     # path exists does it have a project
     if (Project::detect((string) $path) === false && $this->getName() !== 'faker:init') {
         throw new \RuntimeException('Project Folder does not contain the correct folder heirarchy');
     }
     # load the extension bootstrap the path has been verifed to contain an extension folder
     if ($this->getName() !== 'faker:init') {
         $project->getPath()->loadExtensionBootstrap();
     }
     if (true === $input->hasParameterOption(array('--schema'))) {
         #switch path to the argument
         $project['schema_name'] = $input->getOption('schema');
     }
     # Test for DSN
     if (true === $input->hasParameterOption(array('--dsn'))) {
         $project['dsn_command'] = $input->getOption('dsn');
     }
     parent::initialize($input, $output);
 }
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->setOutput($output);
     $this->writeln("Watchdog started at " . $this->formatDate(), OutputInterface::VERBOSITY_VERY_VERBOSE);
     $command = $input->getArgument('action');
     if (!in_array($command, array('start', 'stop', 'check'))) {
         throw new \InvalidArgumentException("Action '{$command}' is not valid");
     }
     // by default we do not force an environment on the commands we ant to execute.
     // We do if we have been invoked with one - which is checked using the tricky test below here
     $env = null;
     if ($input->hasParameterOption('--env') || $input->hasParameterOption('-e')) {
         $env = $input->getOption('env');
     }
     $manager = $this->getContainer()->get('kaliop_queueing.worker_manager');
     $commandList = $manager->getWorkersCommands($env);
     $this->writeln("Checking " . count($commandList) . " worker processes", OutputInterface::VERBOSITY_VERBOSE);
     $watchdog = $this->getContainer()->get('kaliop_queueing.watchdog');
     foreach ($commandList as $workerName => $cmd) {
         // To see if the command is executing, we need to retrieve a version of it which was not escaped for the shell
         // NB: this is most likely NOT failproof!
         $workerCommand = $manager->getWorkerCommand($workerName, $env, true);
         $this->writeln("Looking for process with command line: {$workerCommand}", OutputInterface::VERBOSITY_VERBOSE);
         $pids = $watchdog->getProcessPidByCommand($workerCommand);
         if (count($pids)) {
             $pids = array_keys($pids);
             switch ($command) {
                 case 'start':
                     $this->writeln("Worker: {$workerName}, found pid: " . implode(',', $pids), OutputInterface::VERBOSITY_VERBOSE);
                     break;
                 case 'stop':
                     $this->writeln("Stopping process: " . implode(',', $pids));
                     $watchdog->stopProcesses($pids);
                     break;
                 case 'check':
                     $this->writeln("Worker: {$workerName}, found pid: " . implode(',', $pids), OutputInterface::VERBOSITY_NORMAL);
             }
         } else {
             switch ($command) {
                 case 'start':
                     $this->writeln("Starting worker: {$workerName}", OutputInterface::VERBOSITY_VERBOSE);
                     try {
                         $this->writeln("Command: {$cmd}");
                         $watchdog->startProcess($cmd);
                     } catch (RuntimeException $e) {
                         $output->writeln("Process can not be started! Reason: " . $e->getMessage());
                     }
                     break;
                 case 'check':
                     $this->writeln("Worker: {$workerName}: not started");
                     break;
             }
         }
     }
     $this->writeln("Watchdog ended at " . $this->formatDate(), OutputInterface::VERBOSITY_VERY_VERBOSE);
 }
Example #8
0
 public function doRun(InputInterface $input, OutputInterface $output)
 {
     if (!$input->hasParameterOption('--quiet')) {
         $output->write(sprintf("phpqa %s by Rodrigo Moyle.\n\n", $this->getVersion()));
     }
     if ($input->hasParameterOption('--version') || $input->hasParameterOption('-V')) {
         exit;
     }
     return parent::doRun($input, $output);
 }
Example #9
0
 /**
  * Runs the current application.
  *
  * @param InputInterface  $input  An Input instance
  * @param OutputInterface $output An Output instance
  *
  * @return int 0 if everything went fine, or an error code
  */
 public function doRun(InputInterface $input, OutputInterface $output)
 {
     if (!$input->hasParameterOption('--quiet')) {
         $output->write(sprintf("phpcov-runner %s by Levi Govaerts.\n\n", $this->getVersion()));
     }
     if ($input->hasParameterOption('--version') || $input->hasParameterOption('-V')) {
         exit;
     }
     parent::doRun($input, $output);
 }
 /**
  * Runs the current application.
  *
  * @param InputInterface  $input  An Input instance
  * @param OutputInterface $output An Output instance
  *
  * @return integer 0 if everything went fine, or an error code
  */
 public function doRun(InputInterface $input, OutputInterface $output)
 {
     if (!$input->hasParameterOption('--quiet')) {
         $output->write(sprintf("phpunit-skelgen %s by Sebastian Bergmann.\n\n", $this->getVersion()));
     }
     if ($input->hasParameterOption('--version') || $input->hasParameterOption('-V')) {
         exit;
     }
     parent::doRun($input, $output);
 }
Example #11
0
 public function doRun(InputInterface $input, OutputInterface $output)
 {
     if (!$input->hasParameterOption('--quiet')) {
         $output->write(sprintf("<info>%s</info> <comment>v%s</comment> by <comment>%s</comment> <%s>\n\n", self::APP_NAME, $this->getVersion(), self::AUTHOR_NAME, self::AUTHOR_EMAIL));
     }
     if ($input->hasParameterOption('--version') || $input->hasParameterOption('-V')) {
         return 0;
     }
     return parent::doRun($input, $output);
 }
Example #12
0
 public function doRun(InputInterface $input, OutputInterface $output)
 {
     if (true === $input->hasParameterOption(array('--shell', '-s'))) {
         $shell = new Shell($this);
         $shell->setProcessIsolation($input->hasParameterOption(array('--process-isolation')));
         $shell->run();
         return 0;
     }
     return parent::doRun($input, $output);
 }
 /**
  * Runs the current application.
  *
  * @param InputInterface  $input  An Input instance
  * @param OutputInterface $output An Output instance
  *
  * @return integer 0 if everything went fine, or an error code
  */
 public function doRun(InputInterface $input, OutputInterface $output)
 {
     $this->registerCommands();
     $this->setDispatcher($this->kernel->getContainer()->get('event_dispatcher'));
     if (true === $input->hasParameterOption(array('--shell', '-s'))) {
         $shell = new Shell($this);
         $shell->setProcessIsolation($input->hasParameterOption(array('--process-isolation')));
         $shell->run();
         return 0;
     }
     return parent::doRun($input, $output);
 }
Example #14
0
 /**
  * @param InputInterface $input
  *
  * @return array
  * @throws \Exception
  */
 public static function findFiles(InputInterface $input)
 {
     if ($input->hasParameterOption('--config-file')) {
         $file = $input->getParameterOption('--config-file');
         if (file_exists($file)) {
             return [$file];
         }
         throw new ConfigurationFileNotFoundException(sprintf("Couldn't find the configuration file: %s", $file));
     }
     $format = $input->hasParameterOption('--config-format') ? $input->getParameterOption('--config-format') : static::$DEFAULT_TYPE;
     return [sprintf("%s.%s", static::$NAME, $format), sprintf("%s.%s.dist", static::$NAME, $format)];
 }
Example #15
0
 public function doRun(InputInterface $input, OutputInterface $output)
 {
     if (!$input->hasParameterOption('--quiet')) {
         $output->write(sprintf("<info>%s</info> by <comment>%s</comment> <%s>\n\n", self::APP_NAME, self::AUTHOR_NAME, self::AUTHOR_EMAIL));
     }
     if ($input->hasParameterOption('--version') || $input->hasParameterOption('-V')) {
         return 0;
     }
     if (!$input->getFirstArgument()) {
         $input = new ArrayInput(['list']);
     }
     return parent::doRun($input, $output);
 }
Example #16
0
 /**
  * {@inheritdoc}
  */
 public function doRun(InputInterface $input, OutputInterface $output)
 {
     // Set the input to non-interactive if the yes or no options are used.
     if ($input->hasParameterOption(array('--yes', '-y')) || $input->hasParameterOption(array('--no', '-n'))) {
         $input->setInteractive(false);
     } elseif ($input->hasParameterOption(array('--shell', '-s'))) {
         $shell = new Shell($this);
         $shell->run();
         return 0;
     }
     $this->output = $output;
     return parent::doRun($input, $output);
 }
 /**
  * Runs the current application.
  *
  * @param InputInterface  $input  An Input instance
  * @param OutputInterface $output An Output instance
  *
  * @return int 0 if everything went fine, or an error code
  */
 public function doRun(InputInterface $input, OutputInterface $output)
 {
     if (!$input->hasParameterOption('--quiet')) {
         $output->write(sprintf("bugminer %s by Sebastian Bergmann.\n\n", $this->getVersion()));
     }
     if ($input->hasParameterOption('--version') || $input->hasParameterOption('-V')) {
         exit;
     }
     if (!$input->getFirstArgument()) {
         $input = new ArrayInput(array('--help'));
     }
     parent::doRun($input, $output);
 }
 /**
  * Runs the current application.
  *
  * @param InputInterface  $input  An Input instance
  * @param OutputInterface $output An Output instance
  *
  * @return int 0 if everything went fine, or an error code
  */
 public function doRun(InputInterface $input, OutputInterface $output)
 {
     $this->disableXdebug();
     if (!$input->hasParameterOption('--quiet')) {
         $output->write(sprintf("phar-site-generator %s by Sebastian Bergmann.\n\n", $this->getVersion()));
     }
     if ($input->hasParameterOption('--version') || $input->hasParameterOption('-V')) {
         exit;
     }
     if (!$input->getFirstArgument()) {
         $input = new ArrayInput(['--help']);
     }
     parent::doRun($input, $output);
 }
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     MinkContext::$allowed = array('servers' => $this->getContainer()->getParameter('behat.servers'), 'locales' => $this->getContainer()->getParameter('behat.locales'));
     MinkContext::$options = $this->getContainer()->getParameter('behat.options');
     foreach (self::$options as $option) {
         if ($input->hasParameterOption('--' . $option)) {
             MinkContext::$options[$option] = $input->getParameterOption('--' . $option);
         }
     }
     $args = array();
     if ($input->hasParameterOption('--suite')) {
         $args['--suite'] = $input->getParameterOption('--suite');
     }
     $this->runBehatCommand($args);
 }
Example #20
0
 protected function optionOrConfigValue(InputInterface $input, $name, $config)
 {
     if ($input->hasParameterOption('--' . $name)) {
         return $input->getOption($name);
     }
     return isset($config[$name]) ? $config[$name] : $input->getOption($name);
 }
Example #21
0
 protected function initialize(InputInterface $input, OutputInterface $output)
 {
     if (true === $input->hasParameterOption(array('--no-ansi')) && $input->hasOption('no-progress')) {
         $input->setOption('no-progress', true);
     }
     parent::initialize($input, $output);
 }
Example #22
0
 /**
  * Runs the current application.
  *
  * @param InputInterface  $input  An Input instance
  * @param OutputInterface $output An Output instance
  *
  * @return int 0 if everything went fine, or an error code
  */
 public function doRun(InputInterface $input, OutputInterface $output)
 {
     if (true === $input->hasParameterOption(array('--version', '-V'))) {
         $output->writeln($this->getLongVersion());
         return 0;
     }
     $name = $this->getCommandName($input);
     if (true === $input->hasParameterOption(array('--help', '-h'))) {
         if (!$name) {
             $name = 'help';
             $input = new ArrayInput(array('command' => 'help'));
         } else {
             $this->wantHelps = true;
         }
     }
     try {
         // the command name MUST be the first element of the input
         $command = $this->find($name);
     } catch (\InvalidArgumentException $e) {
         //if no command is found , let the application handel it
         $command = $this->find($this->defaultCommand);
         $input = new ArrayInput(array('command' => $this->defaultCommand, 'url' => $name));
     }
     $this->runningCommand = $command;
     $exitCode = $this->doRunCommand($command, $input, $output);
     $this->runningCommand = null;
     return $exitCode;
 }
Example #23
0
 protected function getCommandName(InputInterface $input)
 {
     if (!$input->hasParameterOption(array('--config', '-c')) && !$input->getFirstArgument()) {
         return 'list';
     }
     return 'logfilter';
 }
 function it_should_pre_load_configuration_properly(GenericEvent $event, ContainerInterface $container, PhpGuard $guard, InputInterface $input)
 {
     $input->hasParameterOption(Argument::cetera())->willReturn(false);
     $container->get('phpguard')->willReturn($guard);
     $guard->setOptions(array())->shouldBeCalled();
     $this->preLoad($event);
 }
 protected function processOptions()
 {
     if (!isset($this->options['environment'])) {
         $this->options['environment'] = getenv('SYMFONY_ENV') ?: 'prod';
     }
     if (null !== $this->input) {
         $this->options['environment'] = $this->input->getParameterOption(['--env', '-e'], $this->options['environment']);
     }
     if (!isset($this->options['localhost_only']) || $this->options['environment'] == 'prod') {
         $this->options['localhost_only'] = false;
     }
     if (getenv('SYMFONY_DEBUG') === '0' || null !== $this->input && $this->input->hasParameterOption(['--no-debug', ''])) {
         $this->options['debug'] = false;
     }
     if (!isset($this->options['debug'])) {
         $this->options['debug'] = $this->options['environment'] == 'dev';
     }
     $this->options['umask_fix'] = isset($this->options['umask_fix']) ? (bool) $this->options['umask_fix'] : false;
     if (empty($this->options['apc_cache_id']) || $this->options['environment'] != 'prod') {
         $this->options['apc_cache_id'] = false;
     }
     if (!isset($this->options['http_cache']) || $this->options['environment'] != 'prod') {
         $this->options['http_cache'] = false;
     }
 }
Example #26
0
 /**
  * Runs the current application.
  *
  * Always show the version information except when the user invokes the help
  * command as that already does it
  *
  * @param InputInterface $input An Input instance
  * @param OutputInterface $output An Output instance
  * @return integer 0 if everything went fine, or an error code otherwise
  */
 public function doRun(InputInterface $input, OutputInterface $output)
 {
     if ($this->showWelcomeMessage && $input->hasParameterOption(array('--help', '-h')) === false && $input->getFirstArgument() !== null) {
         $output->writeln($this->getLongVersion());
         $output->writeln('');
     }
     return parent::doRun($input, $output);
 }
Example #27
0
 /**
  * Get an option value, adjusted for given reparser
  *
  * Will use the last saved value if --resume is set and the option was not specified
  * on the command line
  *
  * @param  string  $option_name   Option name
  * @return integer
  */
 protected function get_option($option_name)
 {
     // Return the option from the resume_data if applicable
     if ($this->input->getOption('resume') && isset($this->resume_data[$option_name]) && !$this->input->hasParameterOption('--' . $option_name)) {
         return $this->resume_data[$option_name];
     }
     return $this->input->getOption($option_name);
 }
Example #28
0
 /**
  * Gets the name of the command based on input.
  *
  * @param InputInterface $input The input interface
  *
  * @return string The command name
  */
 protected function getCommandName(InputInterface $input)
 {
     if ($input->getFirstArgument() === null && !$input->hasParameterOption(array('--help', '-h'))) {
         $this->isDefault = true;
         return $this->getDefaultCommandName();
     }
     return parent::getCommandName($input);
 }
 public function doRun(InputInterface $input, OutputInterface $output)
 {
     // introspect input without definition
     $config = $input->getParameterOption(array('--config', '-c'));
     $verbose = $input->getParameterOption(array('--verbose', '-v'));
     $bootstrap = $input->getParameterOption(array('--bootstrap', '-b'));
     $profile = $input->getParameterOption(array('--profile', '-p'));
     if (true == $verbose) {
         $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE);
     }
     $container = $this->getContainer();
     // event dispatcher
     $container['dispatcher'] = new EventDispatcher();
     $container['input'] = $input;
     $container['output'] = $output;
     // config
     /**
      * Process options
      */
     $this->register(new ConfigServiceProvider(), array('config.path' => $config));
     if ($profile) {
         $container['config.profile'] = $profile;
     }
     $overrides = array();
     if ($input->hasParameterOption(array('--verbose', '-v'))) {
         $overrides['verbose'] = true;
     }
     if ($bootstrap) {
         $overrides['bootstrap'] = $bootstrap;
     }
     $container['config.overrides'] = $overrides;
     /**
      * Should overwrite the profile with command line options here
      */
     $profile = $container['profile'];
     if ($profile->bootstrap) {
         $inc = function () use($profile) {
             require $profile->bootstrap;
         };
         $inc();
     }
     // extensions
     foreach ($profile->extensions as $name => $options) {
         $class = "\\DSpec\\Provider\\" . ucfirst($name) . "ServiceProvider";
         if (!class_exists($class)) {
             $class = $name;
             if (!class_exists($class)) {
                 throw new \InvalidArgumentException("class:{$class} not found");
             }
         }
         $this->register(new $class(), (array) $options);
     }
     $container['dspec.command'] = new DSpecCommand($container);
     $this->bootProviders();
     $this->add($container['dspec.command']);
     return parent::doRun($input, $output);
 }
Example #30
0
 /**
  * Runs the current application.
  *
  * @param InputInterface  $input  An Input instance
  * @param OutputInterface $output An Output instance
  *
  * @return int 0 if everything went fine, or an error code
  */
 public function doRun(InputInterface $input, OutputInterface $output)
 {
     $this->kernel->boot();
     $container = $this->kernel->getContainer();
     foreach ($this->all() as $command) {
         if ($command instanceof ContainerAwareInterface) {
             $command->setContainer($container);
         }
     }
     $this->setDispatcher($container->get('event_dispatcher'));
     if (true === $input->hasParameterOption(array('--shell', '-s'))) {
         $shell = new Shell($this);
         $shell->setProcessIsolation($input->hasParameterOption(array('--process-isolation')));
         $shell->run();
         return 0;
     }
     return parent::doRun($input, $output);
 }