/** * Generates composer manifest data out of a MetaData object. * * @param string $packageType * @param MetaData|null $packageMetaData * @return array manifest data generated from the MetaData object * @deprecated This method will be removed with Flow 4.0 together with the MetaData model */ protected function generateManifestFromMetaDataAndType($packageType, \TYPO3\Flow\Package\MetaData $packageMetaData = null) { $manifest = ['type' => $packageType, 'description' => 'Add description here', 'require' => ['typo3/flow' => '*']]; if ($packageMetaData === null) { return $manifest; } if ($packageMetaData->getPackageType() !== null) { $manifest['type'] = $packageMetaData->getPackageType(); } $manifest['description'] = $packageMetaData->getDescription() ?: $manifest['description']; if ($packageMetaData->getVersion()) { $manifest['version'] = $packageMetaData->getVersion(); } $dependsConstraints = $this->getComposerManifestConstraints(MetaDataInterface::CONSTRAINT_TYPE_DEPENDS, $packageMetaData); if ($dependsConstraints !== []) { $manifest['require'] = $dependsConstraints; } $suggestsConstraints = $this->getComposerManifestConstraints(MetaDataInterface::CONSTRAINT_TYPE_SUGGESTS, $packageMetaData); if ($suggestsConstraints !== []) { $manifest['suggest'] = $suggestsConstraints; } $conflictsConstraints = $this->getComposerManifestConstraints(MetaDataInterface::CONSTRAINT_TYPE_CONFLICTS, $packageMetaData); if ($conflictsConstraints !== []) { $manifest['conflict'] = $conflictsConstraints; } return $manifest; }
/** * Write a composer manifest for the package. * * @param string $manifestPath * @param string $packageKey * @param MetaData $packageMetaData * @return void */ protected function writeComposerManifest($manifestPath, $packageKey, \TYPO3\Flow\Package\MetaData $packageMetaData = NULL) { $manifest = array(); $nameParts = explode('.', $packageKey); $vendor = array_shift($nameParts); $manifest['name'] = strtolower($vendor . '/' . implode('-', $nameParts)); if ($packageMetaData !== NULL) { $manifest['type'] = $packageMetaData->getPackageType(); $manifest['description'] = $packageMetaData->getDescription(); $manifest['version'] = $packageMetaData->getVersion(); } else { $manifest['type'] = 'typo3-flow-package'; $manifest['description'] = ''; } $manifest['require'] = array('typo3/flow' => '*'); $manifest['autoload'] = array('psr-0' => array(str_replace('.', '\\', $packageKey) => 'Classes')); if (defined('JSON_PRETTY_PRINT')) { file_put_contents(Files::concatenatePaths(array($manifestPath, 'composer.json')), json_encode($manifest, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT)); } else { file_put_contents(Files::concatenatePaths(array($manifestPath, 'composer.json')), json_encode($manifest)); } }
/** * Write a composer manifest for the package. * * @param string $manifestPath * @param string $packageKey * @param MetaData $packageMetaData * @return void */ protected function writeComposerManifest($manifestPath, $packageKey, \TYPO3\Flow\Package\MetaData $packageMetaData = null) { $manifest = array('name' => $this->getComposerPackageNameFromPackageKey($packageKey)); if ($packageMetaData !== null) { $manifest['type'] = $packageMetaData->getPackageType(); $manifest['description'] = $packageMetaData->getDescription() ?: 'Add description here'; if ($packageMetaData->getVersion()) { $manifest['version'] = $packageMetaData->getVersion(); } $dependsConstraints = $this->getComposerManifestConstraints(MetaDataInterface::CONSTRAINT_TYPE_DEPENDS, $packageMetaData); if ($dependsConstraints !== array()) { $manifest['require'] = $dependsConstraints; } $suggestsConstraints = $this->getComposerManifestConstraints(MetaDataInterface::CONSTRAINT_TYPE_SUGGESTS, $packageMetaData); if ($suggestsConstraints !== array()) { $manifest['suggest'] = $suggestsConstraints; } $conflictsConstraints = $this->getComposerManifestConstraints(MetaDataInterface::CONSTRAINT_TYPE_CONFLICTS, $packageMetaData); if ($conflictsConstraints !== array()) { $manifest['conflict'] = $conflictsConstraints; } } else { $manifest['type'] = 'typo3-flow-package'; $manifest['description'] = ''; } if (!isset($manifest['require']) || empty($manifest['require'])) { $manifest['require'] = array('typo3/flow' => '*'); } $manifest['autoload'] = array('psr-0' => array(str_replace('.', '\\', $packageKey) => 'Classes')); if (defined('JSON_PRETTY_PRINT')) { file_put_contents(Files::concatenatePaths(array($manifestPath, 'composer.json')), json_encode($manifest, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT)); } else { file_put_contents(Files::concatenatePaths(array($manifestPath, 'composer.json')), json_encode($manifest)); } }
/** * Write a composer manifest for the package. * * @param string $manifestPath * @param string $packageKey * @param MetaData $packageMetaData * @return void */ protected function writeComposerManifest($manifestPath, $packageKey, \TYPO3\Flow\Package\MetaData $packageMetaData = NULL) { $manifest = array(); $nameParts = explode('.', $packageKey); $vendor = array_shift($nameParts); $manifest['name'] = strtolower($vendor . '/' . implode('-', $nameParts)); if ($packageMetaData !== NULL) { $manifest['type'] = $packageMetaData->getPackageType(); $manifest['description'] = $packageMetaData->getDescription() ?: 'Add description here'; if ($packageMetaData->getVersion()) { $manifest['version'] = $packageMetaData->getVersion(); } $manifest['require'] = array(); $dependencies = $packageMetaData->getConstraintsByType(MetaDataInterface::CONSTRAINT_TYPE_DEPENDS); foreach ($dependencies as $dependencyConstraint) { if ($dependencyConstraint instanceof \TYPO3\Flow\Package\MetaData\PackageConstraint) { if (isset($this->packageStatesConfiguration['packages'][$dependencyConstraint->getValue()]['composerName'])) { $manifest['require'][$this->packageStatesConfiguration['packages'][$dependencyConstraint->getValue()]['composerName']] = '*'; } } } } else { $manifest['type'] = 'typo3-flow-package'; $manifest['description'] = ''; } if (!isset($manifest['require']) || empty($manifest['require'])) { $manifest['require'] = array('typo3/flow' => '*'); } $manifest['autoload'] = array('psr-0' => array(str_replace('.', '\\', $packageKey) => 'Classes')); if (defined('JSON_PRETTY_PRINT')) { file_put_contents(Files::concatenatePaths(array($manifestPath, 'composer.json')), json_encode($manifest, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT)); } else { file_put_contents(Files::concatenatePaths(array($manifestPath, 'composer.json')), json_encode($manifest)); } }