protected function configure() { $this->addArgument('package', InputArgument::OPTIONAL, self::ARG_PACKAGE_DESC, '*'); $this->addArgument('group', InputArgument::OPTIONAL, self::ARG_GROUP_DESC, '*'); $this->addOption('publishPath', 'p', InputOption::VALUE_OPTIONAL, self::ARG_PUBLISH_PATH_DESC, getcwd()); $this->addOption('configPath', 'c', InputOption::VALUE_OPTIONAL, self::OPT_OPTIONS_PATH, getcwd()); $description = sprintf("Publishes assets, provided in .publisher.{%s}", implode(',', $this->publisherScanner->getSupportedExtensions())); $this->setDescription($description); }
protected function execute(InputInterface $input, OutputInterface $output) { $path = $input->getArgument('initPath'); $type = $input->getArgument('publisherType'); /** * @var IPublisherHandler $handler */ $handler = $this->publisherScanner->setPath($path)->scan(true, $type); $this->publisherScanner->mergeComposerPackages($handler); $handler->write(); }
/** * Sets up the fixture, for example, open a network connection. * This method is called before a test is executed. * */ protected function setUp() { parent::setUp(); $this->prepareFolder(); $this->inputMock = $this->getMock(InputInterface::class); $this->inputMock->expects($this->any())->method('isInteractive')->will($this->returnValue(true)); $this->outputMock = $this->getMock(OutputInterface::class); $this->publisherScanner = new PublisherScanner(); $this->publisherScanner->registerTypeHandler('php', \Dubpub\Publisher\Handlers\PHPHandler::class); $this->publisherScanner->registerTypeHandler('json', \Dubpub\Publisher\Handlers\JSONHandler::class); $this->publisherScanner->registerTypeHandler('ini', \Dubpub\Publisher\Handlers\INIHandler::class); $yamlHandler = new \Dubpub\Publisher\Handlers\YAMLHandler(new \Symfony\Component\Yaml\Parser(), new \Symfony\Component\Yaml\Dumper()); $this->publisherScanner->registerTypeHandler('yml', $yamlHandler); $this->publisherScanner->registerTypeHandler('yaml', $yamlHandler); $this->testInstance = $this->getCommand($this->publisherScanner); }