Пример #1
0
 public function testFailPaths()
 {
     $this->prepareInput();
     $model = new PublishModel($this->inputMock);
     $this->assertSame('*', $model->getPackageEntry());
     $this->assertSame('*', $model->getGroupEntry());
     $this->assertSame(getcwd(), $model->getConfigPath());
     $this->assertSame(getcwd(), $model->getPublishPath());
 }
Пример #2
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $model = new PublishModel($input);
     // setting path to scan for .publisher.* config file
     $this->publisherScanner->setPath($model->getConfigPath());
     /**
      * @var IPublisherHandler $handler
      */
     $handler = $this->publisherScanner->scan(false);
     // if handler is null, throwing an exception
     // with message
     if (!$handler) {
         // retrieving available extensions
         // and making mask-like string
         $extensions = implode('|', $this->publisherScanner->getSupportedExtensions());
         throw new \Exception('You have to create .publisher.(' . $extensions . ') file first.');
     }
     $publisherHandler = new PublisherHandler($model, $handler, $this->fileSystem);
     $publisherHandler->setOutput($output)->process();
 }
Пример #3
0
 /**
  * @param   Models\PublishModel $model
  * @return  PublisherHandler
  * @throws  \Exception
  */
 public function setModel(Models\PublishModel $model)
 {
     $this->model = $model;
     // checking if vendor folder is available
     // if not - throwing an exception
     if (!($this->vendorPath = realpath($model->getConfigPath() . '/vendor'))) {
         throw new \Exception("Unable to locate \"vendor\" folder. Try to run \"composer update\"");
     }
     if ($model->getPackageEntry() == '*') {
         $this->packageList = $this->handler->getPackageNames();
     } else {
         // if package name is specified
         // adding it into package list
         $this->packageList = explode(',', $model->getPackageEntry());
     }
     if (($this->groupList = $model->getGroupEntry()) != '*') {
         $this->groupList = explode(',', $model->getGroupEntry());
     }
     $this->groupList = (array) $this->groupList;
     return $this;
 }