Пример #1
0
 /**
  * @param \Symfony\Component\Console\Input\InputInterface $input
  * @param \Symfony\Component\Console\Output\OutputInterface $output
  * @return int|void
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->_input = $input;
     $this->_output = $output;
     $path = $this->_input->getArgument('path');
     $saveAction = $this->_input->getArgument('type');
     if ($this->_shouldSaveAll()) {
         $saveActions = ['stores' => '00-initialize.php', 'cms' => '05-cms.php', 'system' => '10-config.php', 'agreement' => '30-agreement.php', 'block' => '30-block.php', 'taxes' => '40-taxes.php', 'featuredblock' => '50-featuredblock.php'];
     } else {
         $saveActions = [$saveAction => $path];
     }
     if ($this->_shouldDeleteFile()) {
         unlink($path);
     }
     if ($this->_shouldCreateSaveDirectory()) {
         mkdir($path);
     }
     foreach ($saveActions as $action => $fileName) {
         $file = $fileName;
         if ($this->_shouldSaveAll()) {
             $file = !$path ? null : $path . '/' . $fileName;
         }
         $entry[] = ['action' => $action . '/save', 'parameters' => ['colors' => false, 'path' => $file]];
     }
     /** @var Processor $processor */
     $processor = Processor::getInstance();
     try {
         $processor->processAll($entry);
     } catch (\Exception $error) {
         echo $error->getMessage() . "\n\n";
     }
     return true;
 }
Пример #2
0
 /**
  * Inits processor and run preprocessor tasks if any
  *
  * @return void
  */
 protected function _initProcessor()
 {
     $this->_processor = Processor::getInstance();
     $paramPath = $this->_input->getArgument('path');
     // If path cannot be loaded, exit immediately
     if (!$paramPath) {
         return;
     }
     $path = new Path($paramPath, getcwd(), $this->_baseDirectory);
     if ($path->isValid()) {
         $this->_processor->setPath($path);
         if (!$this->_input->getOption('ignore-manifest')) {
             $this->_manifest->load($path);
             // Check if we've some preprocessor task to complete
             $this->_runProcessors(Processor::PRE_PROCESSORS);
         }
     }
 }