Issue #3076234 by greg.1.anderson, Mile23: Relocate Scaffold plugin outside of 'core' directory

merge-requests/55/head
Lee Rowlands 2019-08-22 12:45:53 +10:00
parent cf5ad5feba
commit 3a4092e3fd
No known key found for this signature in database
GPG Key ID: 2B829A3DF9204DC4
96 changed files with 169 additions and 164 deletions

View File

@ -58,6 +58,11 @@
"Drupal\\Core\\Composer\\": "core/lib/Drupal/Core/Composer"
}
},
"autoload-dev": {
"psr-4": {
"Drupal\\Composer\\": "composer"
}
},
"scripts": {
"pre-install-cmd": "Drupal\\Core\\Composer\\Composer::ensureComposerVersion",
"pre-update-cmd": "Drupal\\Core\\Composer\\Composer::ensureComposerVersion",

View File

@ -1,6 +1,6 @@
<?php
namespace Drupal\Component\Scaffold;
namespace Drupal\Composer\Plugin\Scaffold;
use Composer\Composer;
use Composer\Installer\PackageEvent;
@ -32,7 +32,7 @@ class AllowedPackages implements PostPackageEventListenerInterface {
/**
* Manager of the options in the top-level composer.json's 'extra' section.
*
* @var \Drupal\Component\Scaffold\ManageOptions
* @var \Drupal\Composer\Plugin\Scaffold\ManageOptions
*/
protected $manageOptions;
@ -50,7 +50,7 @@ class AllowedPackages implements PostPackageEventListenerInterface {
* The composer object.
* @param \Composer\IO\IOInterface $io
* IOInterface to write to.
* @param \Drupal\Component\Scaffold\ManageOptions $manage_options
* @param \Drupal\Composer\Plugin\Scaffold\ManageOptions $manage_options
* Manager of the options in the top-level composer.json's 'extra' section.
*/
public function __construct(Composer $composer, IOInterface $io, ManageOptions $manage_options) {

View File

@ -1,6 +1,6 @@
<?php
namespace Drupal\Component\Scaffold;
namespace Drupal\Composer\Plugin\Scaffold;
use Composer\Plugin\Capability\CommandProvider as CommandProviderCapability;

View File

@ -1,6 +1,6 @@
<?php
namespace Drupal\Component\Scaffold;
namespace Drupal\Composer\Plugin\Scaffold;
use Composer\Command\BaseCommand;
use Symfony\Component\Console\Input\InputInterface;

View File

@ -1,10 +1,10 @@
<?php
namespace Drupal\Component\Scaffold;
namespace Drupal\Composer\Plugin\Scaffold;
use Composer\IO\IOInterface;
use Composer\Util\Filesystem;
use Drupal\Component\Scaffold\Operations\ScaffoldResult;
use Drupal\Composer\Plugin\Scaffold\Operations\ScaffoldResult;
/**
* Generates an 'autoload.php' that includes the autoloader created by Composer.
@ -33,7 +33,7 @@ final class GenerateAutoloadReferenceFile {
* @param string $vendor
* The path to the vendor directory.
*
* @return \Drupal\Component\Scaffold\Operations\ScaffoldResult
* @return \Drupal\Composer\Plugin\Scaffold\Operations\ScaffoldResult
* The result of the autoload file generation.
*/
public static function generateAutoload(IOInterface $io, $package_name, $web_root, $vendor) {
@ -78,7 +78,7 @@ final class GenerateAutoloadReferenceFile {
* @param string $web_root
* The path to the web root.
*
* @return \Drupal\Component\Scaffold\ScaffoldFilePath
* @return \Drupal\Composer\Plugin\Scaffold\ScaffoldFilePath
* Object wrapping the relative and absolute path to the destination file.
*/
protected static function autoloadPath($package_name, $web_root) {

View File

@ -1,6 +1,6 @@
<?php
namespace Drupal\Component\Scaffold;
namespace Drupal\Composer\Plugin\Scaffold;
use Composer\IO\IOInterface;
use Composer\Util\ProcessExecutor;

View File

@ -1,6 +1,6 @@
<?php
namespace Drupal\Component\Scaffold;
namespace Drupal\Composer\Plugin\Scaffold;
use Composer\Composer;
use Composer\EventDispatcher\EventDispatcher;
@ -9,9 +9,9 @@ use Composer\IO\IOInterface;
use Composer\Package\PackageInterface;
use Composer\Plugin\CommandEvent;
use Composer\Util\Filesystem;
use Drupal\Component\Scaffold\Operations\OperationData;
use Drupal\Component\Scaffold\Operations\OperationFactory;
use Drupal\Component\Scaffold\Operations\ScaffoldFileCollection;
use Drupal\Composer\Plugin\Scaffold\Operations\OperationData;
use Drupal\Composer\Plugin\Scaffold\Operations\OperationFactory;
use Drupal\Composer\Plugin\Scaffold\Operations\ScaffoldFileCollection;
/**
* Core class of the plugin.
@ -48,21 +48,21 @@ class Handler {
/**
* The scaffold options in the top-level composer.json's 'extra' section.
*
* @var \Drupal\Component\Scaffold\ManageOptions
* @var \Drupal\Composer\Plugin\Scaffold\ManageOptions
*/
protected $manageOptions;
/**
* The manager that keeps track of which packages are allowed to scaffold.
*
* @var \Drupal\Component\Scaffold\AllowedPackages
* @var \Drupal\Composer\Plugin\Scaffold\AllowedPackages
*/
protected $manageAllowedPackages;
/**
* The list of listeners that are notified after a package event.
*
* @var \Drupal\Component\Scaffold\PostPackageEventListenerInterface[]
* @var \Drupal\Composer\Plugin\Scaffold\PostPackageEventListenerInterface[]
*/
protected $postPackageListeners = [];
@ -120,7 +120,7 @@ class Handler {
* The package file mappings array keyed by destination path and the values
* are operation metadata arrays.
*
* @return \Drupal\Component\Scaffold\Operations\OperationInterface[]
* @return \Drupal\Composer\Plugin\Scaffold\Operations\OperationInterface[]
* A list of scaffolding operation objects
*/
protected function createScaffoldOperations(PackageInterface $package, array $package_file_mappings) {
@ -199,7 +199,7 @@ class Handler {
* A multidimensional array of file mappings, as returned by
* self::getAllowedPackages().
*
* @return \Drupal\Component\Scaffold\Operations\OperationInterface[]
* @return \Drupal\Composer\Plugin\Scaffold\Operations\OperationInterface[]
* An array of destination paths => scaffold operation objects.
*/
protected function getFileMappingsFromPackages(array $allowed_packages) {
@ -216,7 +216,7 @@ class Handler {
* @param \Composer\Package\PackageInterface $package
* The Composer package from which to get the file mappings.
*
* @return \Drupal\Component\Scaffold\Operations\OperationInterface[]
* @return \Drupal\Composer\Plugin\Scaffold\Operations\OperationInterface[]
* An array of destination paths => scaffold operation objects.
*/
protected function getPackageFileMappings(PackageInterface $package) {

View File

@ -1,6 +1,6 @@
<?php
namespace Drupal\Component\Scaffold;
namespace Drupal\Composer\Plugin\Scaffold;
/**
* Injects config values from an associative array into a string.

View File

@ -1,6 +1,6 @@
<?php
namespace Drupal\Component\Scaffold;
namespace Drupal\Composer\Plugin\Scaffold;
use Composer\IO\IOInterface;
@ -37,10 +37,10 @@ class ManageGitIgnore {
/**
* Manages gitignore files.
*
* @param \Drupal\Component\Scaffold\Operations\ScaffoldResult[] $files
* @param \Drupal\Composer\Plugin\Scaffold\Operations\ScaffoldResult[] $files
* A list of scaffold results, each of which holds a path and whether
* or not that file is managed.
* @param \Drupal\Component\Scaffold\ScaffoldOptions $options
* @param \Drupal\Composer\Plugin\Scaffold\ScaffoldOptions $options
* Configuration options from the composer.json extras section.
*/
public function manageIgnored(array $files, ScaffoldOptions $options) {
@ -72,7 +72,7 @@ class ManageGitIgnore {
/**
* Determines whether we should manage gitignore files.
*
* @param \Drupal\Component\Scaffold\ScaffoldOptions $options
* @param \Drupal\Composer\Plugin\Scaffold\ScaffoldOptions $options
* Configuration options from the composer.json extras section.
*
* @return bool

View File

@ -1,6 +1,6 @@
<?php
namespace Drupal\Component\Scaffold;
namespace Drupal\Composer\Plugin\Scaffold;
use Composer\Composer;
use Composer\Package\PackageInterface;
@ -35,7 +35,7 @@ class ManageOptions {
/**
* Gets the root-level scaffold options for this project.
*
* @return \Drupal\Component\Scaffold\ScaffoldOptions
* @return \Drupal\Composer\Plugin\Scaffold\ScaffoldOptions
* The scaffold options object.
*/
public function getOptions() {
@ -48,7 +48,7 @@ class ManageOptions {
* @param \Composer\Package\PackageInterface $package
* The package to fetch the scaffold options from.
*
* @return \Drupal\Component\Scaffold\ScaffoldOptions
* @return \Drupal\Composer\Plugin\Scaffold\ScaffoldOptions
* The scaffold options object.
*/
public function packageOptions(PackageInterface $package) {
@ -63,7 +63,7 @@ class ManageOptions {
*
* Note that only the root package may define locations.
*
* @return \Drupal\Component\Scaffold\Interpolator
* @return \Drupal\Composer\Plugin\Scaffold\Interpolator
* Interpolator that will do replacements in a string using tokens in
* 'locations' element.
*/

View File

@ -1,10 +1,10 @@
<?php
namespace Drupal\Component\Scaffold\Operations;
namespace Drupal\Composer\Plugin\Scaffold\Operations;
use Composer\IO\IOInterface;
use Drupal\Component\Scaffold\ScaffoldFilePath;
use Drupal\Component\Scaffold\ScaffoldOptions;
use Drupal\Composer\Plugin\Scaffold\ScaffoldFilePath;
use Drupal\Composer\Plugin\Scaffold\ScaffoldOptions;
/**
* Scaffold operation to add to the beginning and/or end of a scaffold file.
@ -19,23 +19,23 @@ class AppendOp implements OperationInterface, ConjoinableInterface {
/**
* Path to the source file to prepend, if any.
*
* @var \Drupal\Component\Scaffold\ScaffoldFilePath
* @var \Drupal\Composer\Plugin\Scaffold\ScaffoldFilePath
*/
protected $prepend;
/**
* Path to the source file to append, if any.
*
* @var \Drupal\Component\Scaffold\ScaffoldFilePath
* @var \Drupal\Composer\Plugin\Scaffold\ScaffoldFilePath
*/
protected $append;
/**
* Constructs an AppendOp.
*
* @param \Drupal\Component\Scaffold\ScaffoldFilePath $prepend_path
* @param \Drupal\Composer\Plugin\Scaffold\ScaffoldFilePath $prepend_path
* The relative path to the prepend file.
* @param \Drupal\Component\Scaffold\ScaffoldFilePath $append_path
* @param \Drupal\Composer\Plugin\Scaffold\ScaffoldFilePath $append_path
* The relative path to the append file.
*/
public function __construct(ScaffoldFilePath $prepend_path = NULL, ScaffoldFilePath $append_path = NULL) {

View File

@ -1,6 +1,6 @@
<?php
namespace Drupal\Component\Scaffold\Operations;
namespace Drupal\Composer\Plugin\Scaffold\Operations;
/**
* Marker interface indicating that operation is conjoinable.

View File

@ -1,10 +1,10 @@
<?php
namespace Drupal\Component\Scaffold\Operations;
namespace Drupal\Composer\Plugin\Scaffold\Operations;
use Composer\IO\IOInterface;
use Drupal\Component\Scaffold\ScaffoldFilePath;
use Drupal\Component\Scaffold\ScaffoldOptions;
use Drupal\Composer\Plugin\Scaffold\ScaffoldFilePath;
use Drupal\Composer\Plugin\Scaffold\ScaffoldOptions;
/**
* Joins two operations on the same file into a single operation.
@ -14,22 +14,22 @@ class ConjunctionOp implements OperationInterface {
/**
* The first operation.
*
* @var \Drupal\Component\Scaffold\Operations\OperationInterface
* @var \Drupal\Composer\Plugin\Scaffold\Operations\OperationInterface
*/
protected $firstOperation;
/**
* The second operation.
*
* @var \Drupal\Component\Scaffold\Operations\OperationInterface
* @var \Drupal\Composer\Plugin\Scaffold\Operations\OperationInterface
*/
protected $secondOperation;
/**
* ConjunctionOp constructor.
*
* @param \Drupal\Component\Scaffold\Operations\OperationInterface $first_operation
* @param \Drupal\Component\Scaffold\Operations\OperationInterface $second_operation
* @param \Drupal\Composer\Plugin\Scaffold\Operations\OperationInterface $first_operation
* @param \Drupal\Composer\Plugin\Scaffold\Operations\OperationInterface $second_operation
*/
public function __construct(OperationInterface $first_operation, OperationInterface $second_operation) {
$this->firstOperation = $first_operation;

View File

@ -1,6 +1,6 @@
<?php
namespace Drupal\Component\Scaffold\Operations;
namespace Drupal\Composer\Plugin\Scaffold\Operations;
/**
* Holds parameter data for operation objects during operation creation only.

View File

@ -1,10 +1,10 @@
<?php
namespace Drupal\Component\Scaffold\Operations;
namespace Drupal\Composer\Plugin\Scaffold\Operations;
use Composer\Composer;
use Composer\Package\PackageInterface;
use Drupal\Component\Scaffold\ScaffoldFilePath;
use Drupal\Composer\Plugin\Scaffold\ScaffoldFilePath;
/**
* Create Scaffold operation objects based on provided metadata.
@ -38,7 +38,7 @@ class OperationFactory {
* @param OperationData $operation_data
* The parameter data for this operation object; varies by operation type.
*
* @return \Drupal\Component\Scaffold\Operations\OperationInterface
* @return \Drupal\Composer\Plugin\Scaffold\Operations\OperationInterface
* The scaffolding operation object (skip, replace, etc.)
*
* @throws \RuntimeException
@ -69,7 +69,7 @@ class OperationFactory {
* @param OperationData $operation_data
* The parameter data for this operation object, i.e. the relative 'path'.
*
* @return \Drupal\Component\Scaffold\Operations\OperationInterface
* @return \Drupal\Composer\Plugin\Scaffold\Operations\OperationInterface
* A scaffold replace operation object.
*/
protected function createReplaceOp(PackageInterface $package, OperationData $operation_data) {
@ -91,7 +91,7 @@ class OperationFactory {
* @param OperationData $operation_data
* The parameter data for this operation object, i.e. the relative 'path'.
*
* @return \Drupal\Component\Scaffold\Operations\OperationInterface
* @return \Drupal\Composer\Plugin\Scaffold\Operations\OperationInterface
* A scaffold replace operation object.
*/
protected function createAppendOp(PackageInterface $package, OperationData $operation_data) {

View File

@ -1,10 +1,10 @@
<?php
namespace Drupal\Component\Scaffold\Operations;
namespace Drupal\Composer\Plugin\Scaffold\Operations;
use Composer\IO\IOInterface;
use Drupal\Component\Scaffold\ScaffoldFilePath;
use Drupal\Component\Scaffold\ScaffoldOptions;
use Drupal\Composer\Plugin\Scaffold\ScaffoldFilePath;
use Drupal\Composer\Plugin\Scaffold\ScaffoldOptions;
/**
* Interface for scaffold operation objects.
@ -14,14 +14,14 @@ interface OperationInterface {
/**
* Process this scaffold operation.
*
* @param \Drupal\Component\Scaffold\ScaffoldFilePath $destination
* @param \Drupal\Composer\Plugin\Scaffold\ScaffoldFilePath $destination
* Scaffold file's destination path.
* @param \Composer\IO\IOInterface $io
* IOInterface to write to.
* @param \Drupal\Component\Scaffold\ScaffoldOptions $options
* @param \Drupal\Composer\Plugin\Scaffold\ScaffoldOptions $options
* Various options that may alter the behavior of the operation.
*
* @return \Drupal\Component\Scaffold\Operations\ScaffoldResult
* @return \Drupal\Composer\Plugin\Scaffold\Operations\ScaffoldResult
* Result of the scaffolding operation.
*/
public function process(ScaffoldFilePath $destination, IOInterface $io, ScaffoldOptions $options);

View File

@ -1,11 +1,11 @@
<?php
namespace Drupal\Component\Scaffold\Operations;
namespace Drupal\Composer\Plugin\Scaffold\Operations;
use Composer\IO\IOInterface;
use Composer\Util\Filesystem;
use Drupal\Component\Scaffold\ScaffoldFilePath;
use Drupal\Component\Scaffold\ScaffoldOptions;
use Drupal\Composer\Plugin\Scaffold\ScaffoldFilePath;
use Drupal\Composer\Plugin\Scaffold\ScaffoldOptions;
/**
* Scaffold operation to copy or symlink from source to destination.
@ -20,7 +20,7 @@ class ReplaceOp implements OperationInterface {
/**
* The relative path to the source file.
*
* @var \Drupal\Component\Scaffold\ScaffoldFilePath
* @var \Drupal\Composer\Plugin\Scaffold\ScaffoldFilePath
*/
protected $source;
@ -34,7 +34,7 @@ class ReplaceOp implements OperationInterface {
/**
* Constructs a ReplaceOp.
*
* @param \Drupal\Component\Scaffold\ScaffoldFilePath $sourcePath
* @param \Drupal\Composer\Plugin\Scaffold\ScaffoldFilePath $sourcePath
* The relative path to the source file.
* @param bool $overwrite
* Whether to allow this scaffold file to overwrite files already at
@ -72,12 +72,12 @@ class ReplaceOp implements OperationInterface {
/**
* Copies the scaffold file.
*
* @param \Drupal\Component\Scaffold\ScaffoldFilePath $destination
* @param \Drupal\Composer\Plugin\Scaffold\ScaffoldFilePath $destination
* Scaffold file to process.
* @param \Composer\IO\IOInterface $io
* IOInterface to writing to.
*
* @return \Drupal\Component\Scaffold\Operations\ScaffoldResult
* @return \Drupal\Composer\Plugin\Scaffold\Operations\ScaffoldResult
* The scaffold result.
*/
protected function copyScaffold(ScaffoldFilePath $destination, IOInterface $io) {
@ -95,12 +95,12 @@ class ReplaceOp implements OperationInterface {
/**
* Symlinks the scaffold file.
*
* @param \Drupal\Component\Scaffold\ScaffoldFilePath $destination
* @param \Drupal\Composer\Plugin\Scaffold\ScaffoldFilePath $destination
* Scaffold file to process.
* @param \Composer\IO\IOInterface $io
* IOInterface to writing to.
*
* @return \Drupal\Component\Scaffold\Operations\ScaffoldResult
* @return \Drupal\Composer\Plugin\Scaffold\Operations\ScaffoldResult
* The scaffold result.
*/
protected function symlinkScaffold(ScaffoldFilePath $destination, IOInterface $io) {

View File

@ -1,12 +1,12 @@
<?php
namespace Drupal\Component\Scaffold\Operations;
namespace Drupal\Composer\Plugin\Scaffold\Operations;
use Composer\IO\IOInterface;
use Drupal\Component\Scaffold\Interpolator;
use Drupal\Component\Scaffold\ScaffoldFileInfo;
use Drupal\Component\Scaffold\ScaffoldFilePath;
use Drupal\Component\Scaffold\ScaffoldOptions;
use Drupal\Composer\Plugin\Scaffold\Interpolator;
use Drupal\Composer\Plugin\Scaffold\ScaffoldFileInfo;
use Drupal\Composer\Plugin\Scaffold\ScaffoldFilePath;
use Drupal\Composer\Plugin\Scaffold\ScaffoldOptions;
/**
* Collection of scaffold files.
@ -20,7 +20,7 @@ class ScaffoldFileCollection implements \IteratorAggregate {
* scaffold files provided by that package. Each collection of scaffold files
* is keyed by destination path.
*
* @var \Drupal\Component\Scaffold\ScaffoldFileInfo[][]
* @var \Drupal\Composer\Plugin\Scaffold\ScaffoldFileInfo[][]
*/
protected $scaffoldFilesByProject = [];
@ -29,7 +29,7 @@ class ScaffoldFileCollection implements \IteratorAggregate {
*
* @param array $file_mappings
* A multidimensional array of file mappings.
* @param \Drupal\Component\Scaffold\Interpolator $location_replacements
* @param \Drupal\Composer\Plugin\Scaffold\Interpolator $location_replacements
* An object with the location mappings (e.g. [web-root]).
*/
public function __construct(array $file_mappings, Interpolator $location_replacements) {
@ -74,14 +74,14 @@ class ScaffoldFileCollection implements \IteratorAggregate {
/**
* Processes the iterator created by ScaffoldFileCollection::create().
*
* @param \Drupal\Component\Scaffold\Operations\ScaffoldFileCollection $collection
* @param \Drupal\Composer\Plugin\Scaffold\Operations\ScaffoldFileCollection $collection
* The iterator to process.
* @param \Composer\IO\IOInterface $io
* The Composer IO object.
* @param \Drupal\Component\Scaffold\ScaffoldOptions $scaffold_options
* @param \Drupal\Composer\Plugin\Scaffold\ScaffoldOptions $scaffold_options
* The scaffold options.
*
* @return \Drupal\Component\Scaffold\Operations\ScaffoldResult[]
* @return \Drupal\Composer\Plugin\Scaffold\Operations\ScaffoldResult[]
* The results array.
*/
public static function process(ScaffoldFileCollection $collection, IOInterface $io, ScaffoldOptions $scaffold_options) {

View File

@ -1,8 +1,8 @@
<?php
namespace Drupal\Component\Scaffold\Operations;
namespace Drupal\Composer\Plugin\Scaffold\Operations;
use Drupal\Component\Scaffold\ScaffoldFilePath;
use Drupal\Composer\Plugin\Scaffold\ScaffoldFilePath;
/**
* Record the result of a scaffold operation.
@ -12,7 +12,7 @@ class ScaffoldResult {
/**
* The path to the scaffold file that was processed.
*
* @var \Drupal\Component\Scaffold\ScaffoldFilePath
* @var \Drupal\Composer\Plugin\Scaffold\ScaffoldFilePath
*/
protected $destination;
@ -26,7 +26,7 @@ class ScaffoldResult {
/**
* ScaffoldResult constructor.
*
* @param \Drupal\Component\Scaffold\ScaffoldFilePath $destination
* @param \Drupal\Composer\Plugin\Scaffold\ScaffoldFilePath $destination
* The path to the scaffold file that was processed.
* @param bool $isManaged
* (optional) Whether this result is managed. Defaults to FALSE.
@ -49,7 +49,7 @@ class ScaffoldResult {
/**
* Gets the destination scaffold file that this result refers to.
*
* @return \Drupal\Component\Scaffold\ScaffoldFilePath
* @return \Drupal\Composer\Plugin\Scaffold\ScaffoldFilePath
* The destination path for the scaffold result.
*/
public function destination() {

View File

@ -1,10 +1,10 @@
<?php
namespace Drupal\Component\Scaffold\Operations;
namespace Drupal\Composer\Plugin\Scaffold\Operations;
use Composer\IO\IOInterface;
use Drupal\Component\Scaffold\ScaffoldFilePath;
use Drupal\Component\Scaffold\ScaffoldOptions;
use Drupal\Composer\Plugin\Scaffold\ScaffoldFilePath;
use Drupal\Composer\Plugin\Scaffold\ScaffoldOptions;
/**
* Scaffold operation to skip a scaffold file (do nothing).

View File

@ -1,6 +1,6 @@
<?php
namespace Drupal\Component\Scaffold;
namespace Drupal\Composer\Plugin\Scaffold;
use Composer\Composer;
use Composer\EventDispatcher\EventSubscriberInterface;
@ -14,7 +14,7 @@ use Composer\Plugin\PluginEvents;
use Composer\Plugin\PluginInterface;
use Composer\Script\Event;
use Composer\Script\ScriptEvents;
use Drupal\Component\Scaffold\CommandProvider as ScaffoldCommandProvider;
use Drupal\Composer\Plugin\Scaffold\CommandProvider as ScaffoldCommandProvider;
/**
* Composer plugin for handling drupal scaffold.
@ -24,7 +24,7 @@ class Plugin implements PluginInterface, EventSubscriberInterface, Capable {
/**
* The Composer Scaffold handler.
*
* @var \Drupal\Component\Scaffold\Handler
* @var \Drupal\Composer\Plugin\Scaffold\Handler
*/
protected $handler;

View File

@ -1,13 +1,13 @@
<?php
namespace Drupal\Component\Scaffold;
namespace Drupal\Composer\Plugin\Scaffold;
use Composer\Installer\PackageEvent;
/**
* Interface for post package event listeners.
*
* @see \Drupal\Component\Scaffold\Handler::onPostPackageEvent
* @see \Drupal\Composer\Plugin\Scaffold\Handler::onPostPackageEvent
*/
interface PostPackageEventListenerInterface {

View File

@ -1,9 +1,9 @@
<?php
namespace Drupal\Component\Scaffold;
namespace Drupal\Composer\Plugin\Scaffold;
use Composer\IO\IOInterface;
use Drupal\Component\Scaffold\Operations\OperationInterface;
use Drupal\Composer\Plugin\Scaffold\Operations\OperationInterface;
/**
* Data object that keeps track of one scaffold file.
@ -18,24 +18,24 @@ class ScaffoldFileInfo {
/**
* The path to the destination.
*
* @var \Drupal\Component\Scaffold\ScaffoldFilePath
* @var \Drupal\Composer\Plugin\Scaffold\ScaffoldFilePath
*/
protected $destination;
/**
* The operation used to create the destination.
*
* @var \Drupal\Component\Scaffold\Operations\OperationInterface
* @var \Drupal\Composer\Plugin\Scaffold\Operations\OperationInterface
*/
protected $op;
/**
* Constructs a ScaffoldFileInfo object.
*
* @param \Drupal\Component\Scaffold\ScaffoldFilePath $destination
* @param \Drupal\Composer\Plugin\Scaffold\ScaffoldFilePath $destination
* The full and relative paths to the destination file and the package
* defining it.
* @param \Drupal\Component\Scaffold\Operations\OperationInterface $op
* @param \Drupal\Composer\Plugin\Scaffold\Operations\OperationInterface $op
* Operations object that will handle scaffolding operations.
*/
public function __construct(ScaffoldFilePath $destination, OperationInterface $op) {
@ -46,7 +46,7 @@ class ScaffoldFileInfo {
/**
* Gets the Scaffold operation.
*
* @return \Drupal\Component\Scaffold\Operations\OperationInterface
* @return \Drupal\Composer\Plugin\Scaffold\Operations\OperationInterface
* Operations object that handles scaffolding (copy, make symlink, etc).
*/
public function op() {
@ -66,7 +66,7 @@ class ScaffoldFileInfo {
/**
* Gets the destination.
*
* @return \Drupal\Component\Scaffold\ScaffoldFilePath
* @return \Drupal\Composer\Plugin\Scaffold\ScaffoldFilePath
* The scaffold path to the destination file.
*/
public function destination() {
@ -110,11 +110,11 @@ class ScaffoldFileInfo {
*
* @param \Composer\IO\IOInterface $io
* The scaffold file to be processed.
* @param \Drupal\Component\Scaffold\ScaffoldOptions $options
* @param \Drupal\Composer\Plugin\Scaffold\ScaffoldOptions $options
* Assorted operational options, e.g. whether the destination should be a
* symlink.
*
* @return \Drupal\Component\Scaffold\Operations\ScaffoldResult
* @return \Drupal\Composer\Plugin\Scaffold\Operations\ScaffoldResult
* The scaffold result.
*/
public function process(IOInterface $io, ScaffoldOptions $options) {

View File

@ -1,6 +1,6 @@
<?php
namespace Drupal\Component\Scaffold;
namespace Drupal\Composer\Plugin\Scaffold;
/**
* Manage the path to a file to scaffold.
@ -138,7 +138,7 @@ class ScaffoldFilePath {
* The name of the package defining the destination path.
* @param string $destination
* The relative path to the destination file being scaffolded.
* @param \Drupal\Component\Scaffold\Interpolator $location_replacements
* @param \Drupal\Composer\Plugin\Scaffold\Interpolator $location_replacements
* Interpolator that includes the [web-root] and any other available
* placeholder replacements.
*
@ -153,7 +153,7 @@ class ScaffoldFilePath {
/**
* Adds data about the relative and full path to the provided interpolator.
*
* @param \Drupal\Component\Scaffold\Interpolator $interpolator
* @param \Drupal\Composer\Plugin\Scaffold\Interpolator $interpolator
* Interpolator to add data to.
* @param string $name_prefix
* (optional) Prefix to add before -rel-path and -full-path item names.
@ -178,7 +178,7 @@ class ScaffoldFilePath {
* (optional) Prefix to add before -rel-path and -full-path item names.
* Defaults to path type provided when constructing this object.
*
* @return \Drupal\Component\Scaffold\Interpolator
* @return \Drupal\Composer\Plugin\Scaffold\Interpolator
* An interpolator for making string replacements.
*/
public function getInterpolator($name_prefix = '') {

View File

@ -1,6 +1,6 @@
<?php
namespace Drupal\Component\Scaffold;
namespace Drupal\Composer\Plugin\Scaffold;
/**
* Per-project options from the 'extras' section of the composer.json file.

View File

@ -1,9 +1,9 @@
HOW-TO: Test this Drupal component
HOW-TO: Test this Drupal composer plugin
In order to test this component, you'll need to get the entire Drupal repo and
In order to test this plugin, you'll need to get the entire Drupal repo and
run the tests there.
You'll find the tests under core/tests/Drupal/Tests/Component.
You'll find the tests under core/tests/Drupal/Tests/Composer/Plugin.
You can get the full Drupal repo here:
https://www.drupal.org/project/drupal/git-instructions
@ -11,7 +11,7 @@ https://www.drupal.org/project/drupal/git-instructions
You can find more information about running PHPUnit tests with Drupal here:
https://www.drupal.org/node/2116263
Each component in the Drupal\Component namespace has its own annotated test
Each component in the Drupal\Composer\Plugin namespace has its own annotated test
group. You can use this group to run only the tests for this component. Like
this:

View File

@ -11,11 +11,11 @@
},
"autoload": {
"psr-4": {
"Drupal\\Component\\Scaffold\\": ""
"Drupal\\Composer\\Plugin\\Scaffold\\": ""
}
},
"extra": {
"class": "Drupal\\Component\\Scaffold\\Plugin",
"class": "Drupal\\Composer\\Plugin\\Scaffold\\Plugin",
"branch-alias": {
"dev-master": "1.0.x-dev"
}

View File

@ -1,6 +1,6 @@
<?php
namespace Drupal\Tests\Component\Scaffold;
namespace Drupal\Tests\Composer\Plugin\Scaffold;
/**
* Convenience class for creating fixtures.

View File

@ -1,6 +1,6 @@
<?php
namespace Drupal\Tests\Component\Scaffold;
namespace Drupal\Tests\Composer\Plugin\Scaffold;
use Symfony\Component\Process\Process;

View File

@ -1,16 +1,16 @@
<?php
namespace Drupal\Tests\Component\Scaffold;
namespace Drupal\Tests\Composer\Plugin\Scaffold;
use Composer\Console\Application;
use Composer\Factory;
use Composer\IO\BufferIO;
use Composer\Util\Filesystem;
use Drupal\Component\Scaffold\Handler;
use Drupal\Component\Scaffold\Interpolator;
use Drupal\Component\Scaffold\Operations\AppendOp;
use Drupal\Component\Scaffold\Operations\ReplaceOp;
use Drupal\Component\Scaffold\ScaffoldFilePath;
use Drupal\Composer\Plugin\Scaffold\Handler;
use Drupal\Composer\Plugin\Scaffold\Interpolator;
use Drupal\Composer\Plugin\Scaffold\Operations\AppendOp;
use Drupal\Composer\Plugin\Scaffold\Operations\ReplaceOp;
use Drupal\Composer\Plugin\Scaffold\ScaffoldFilePath;
use Symfony\Component\Console\Input\StringInput;
use Symfony\Component\Console\Output\BufferedOutput;
@ -93,7 +93,7 @@ class Fixtures {
* Path to the root of this project.
*/
public function projectRoot() {
return realpath(__DIR__) . '/../../../../../../core/lib/Drupal/Component/Scaffold';
return realpath(__DIR__) . '/../../../../../../../composer/Plugin/Scaffold';
}
/**
@ -151,10 +151,10 @@ class Fixtures {
* @param string $source
* The name of the asset; path is "assets/$source".
*
* @return \Drupal\Component\Scaffold\ScaffoldFilePath
* @return \Drupal\Composer\Plugin\Scaffold\ScaffoldFilePath
* The full and relative path to the desired asset
*
* @see \Drupal\Component\Scaffold\ScaffoldFilePath::sourcePath()
* @see \Drupal\Composer\Plugin\Scaffold\ScaffoldFilePath::sourcePath()
*/
public function sourcePath($project_name, $source) {
$package_name = "fixtures/{$project_name}";
@ -168,10 +168,10 @@ class Fixtures {
*
* Use in place of ManageOptions::getLocationReplacements().
*
* @return \Drupal\Component\Scaffold\Interpolator
* @return \Drupal\Composer\Plugin\Scaffold\Interpolator
* An interpolator with location replacements, including 'web-root'.
*
* @see \Drupal\Component\Scaffold\ManageOptions::getLocationReplacements()
* @see \Drupal\Composer\Plugin\Scaffold\ManageOptions::getLocationReplacements()
*/
public function getLocationReplacements() {
$destinationTmpDir = $this->mkTmpDir('location-replacements');
@ -189,7 +189,7 @@ class Fixtures {
* @param string $source
* The name of the asset; path is "assets/$source".
*
* @return \Drupal\Component\Scaffold\Operations\ReplaceOp
* @return \Drupal\Composer\Plugin\Scaffold\Operations\ReplaceOp
* A replace operation object.
*/
public function replaceOp($project_name, $source) {
@ -206,7 +206,7 @@ class Fixtures {
* @param string $source
* The name of the asset; path is "assets/$source".
*
* @return \Drupal\Component\Scaffold\Operations\AppendOp
* @return \Drupal\Composer\Plugin\Scaffold\Operations\AppendOp
* An append operation object.
*/
public function appendOp($project_name, $source) {
@ -223,17 +223,17 @@ class Fixtures {
* Destination path; should be in the form '[web-root]/robots.txt', where
* '[web-root]' is always literally '[web-root]', with any arbitrarily
* desired filename following.
* @param \Drupal\Component\Scaffold\Interpolator $interpolator
* @param \Drupal\Composer\Plugin\Scaffold\Interpolator $interpolator
* Location replacements. Obtain via Fixtures::getLocationReplacements()
* when creating multiple scaffold destinations.
* @param string $package_name
* (optional) The name of the fixture package that this path came from.
* Taken from interpolator if not provided.
*
* @return \Drupal\Component\Scaffold\ScaffoldFilePath
* @return \Drupal\Composer\Plugin\Scaffold\ScaffoldFilePath
* A destination scaffold file backed by temporary storage.
*
* @see \Drupal\Component\Scaffold\ScaffoldFilePath::destinationPath()
* @see \Drupal\Composer\Plugin\Scaffold\ScaffoldFilePath::destinationPath()
*/
public function destinationPath($destination, Interpolator $interpolator = NULL, $package_name = NULL) {
$interpolator = $interpolator ?: $this->getLocationReplacements();

View File

@ -1,11 +1,11 @@
<?php
namespace Drupal\Tests\Component\Scaffold\Functional;
namespace Drupal\Tests\Composer\Plugin\Scaffold\Functional;
use Composer\Util\Filesystem;
use Drupal\Tests\Component\Scaffold\AssertUtilsTrait;
use Drupal\Tests\Component\Scaffold\ExecTrait;
use Drupal\Tests\Component\Scaffold\Fixtures;
use Drupal\Tests\Composer\Plugin\Scaffold\AssertUtilsTrait;
use Drupal\Tests\Composer\Plugin\Scaffold\ExecTrait;
use Drupal\Tests\Composer\Plugin\Scaffold\Fixtures;
use PHPUnit\Framework\TestCase;
/**
@ -53,7 +53,7 @@ class ComposerHookTest extends TestCase {
/**
* The Fixtures object.
*
* @var \Drupal\Tests\Component\Scaffold\Fixtures
* @var \Drupal\Tests\Composer\Plugin\Scaffold\Fixtures
*/
protected $fixtures;

View File

@ -1,11 +1,11 @@
<?php
namespace Drupal\Tests\Component\Scaffold\Functional;
namespace Drupal\Tests\Composer\Plugin\Scaffold\Functional;
use Composer\Util\Filesystem;
use Drupal\Tests\Component\Scaffold\Fixtures;
use Drupal\Tests\Component\Scaffold\AssertUtilsTrait;
use Drupal\Tests\Component\Scaffold\ExecTrait;
use Drupal\Tests\Composer\Plugin\Scaffold\Fixtures;
use Drupal\Tests\Composer\Plugin\Scaffold\AssertUtilsTrait;
use Drupal\Tests\Composer\Plugin\Scaffold\ExecTrait;
use PHPUnit\Framework\TestCase;
/**
@ -48,7 +48,7 @@ class ManageGitIgnoreTest extends TestCase {
/**
* The Fixtures object.
*
* @var \Drupal\Tests\Component\Scaffold\Fixtures
* @var \Drupal\Tests\Composer\Plugin\Scaffold\Fixtures
*/
protected $fixtures;

View File

@ -1,11 +1,11 @@
<?php
namespace Drupal\Tests\Component\Scaffold\Functional;
namespace Drupal\Tests\Composer\Plugin\Scaffold\Functional;
use Composer\Util\Filesystem;
use Drupal\Tests\Component\Scaffold\AssertUtilsTrait;
use Drupal\Tests\Component\Scaffold\Fixtures;
use Drupal\Tests\Component\Scaffold\ScaffoldTestResult;
use Drupal\Tests\Composer\Plugin\Scaffold\AssertUtilsTrait;
use Drupal\Tests\Composer\Plugin\Scaffold\Fixtures;
use Drupal\Tests\Composer\Plugin\Scaffold\ScaffoldTestResult;
use PHPUnit\Framework\TestCase;
/**
@ -46,7 +46,7 @@ class ScaffoldTest extends TestCase {
/**
* The Fixtures object.
*
* @var \Drupal\Tests\Component\Scaffold\Fixtures
* @var \Drupal\Tests\Composer\Plugin\Scaffold\Fixtures
*/
protected $fixtures;

View File

@ -1,14 +1,14 @@
<?php
namespace Drupal\Tests\Component\Scaffold\Integration;
namespace Drupal\Tests\Composer\Plugin\Scaffold\Integration;
use Drupal\Component\Scaffold\Operations\AppendOp;
use Drupal\Component\Scaffold\ScaffoldOptions;
use Drupal\Tests\Component\Scaffold\Fixtures;
use Drupal\Composer\Plugin\Scaffold\Operations\AppendOp;
use Drupal\Composer\Plugin\Scaffold\ScaffoldOptions;
use Drupal\Tests\Composer\Plugin\Scaffold\Fixtures;
use PHPUnit\Framework\TestCase;
/**
* @coversDefaultClass \Drupal\Component\Scaffold\Operations\AppendOp
* @coversDefaultClass \Drupal\Composer\Plugin\Scaffold\Operations\AppendOp
*
* @group Scaffold
*/

View File

@ -1,14 +1,14 @@
<?php
namespace Drupal\Tests\Component\Scaffold\Integration;
namespace Drupal\Tests\Composer\Plugin\Scaffold\Integration;
use Drupal\Component\Scaffold\Operations\ReplaceOp;
use Drupal\Component\Scaffold\ScaffoldOptions;
use Drupal\Tests\Component\Scaffold\Fixtures;
use Drupal\Composer\Plugin\Scaffold\Operations\ReplaceOp;
use Drupal\Composer\Plugin\Scaffold\ScaffoldOptions;
use Drupal\Tests\Composer\Plugin\Scaffold\Fixtures;
use PHPUnit\Framework\TestCase;
/**
* @coversDefaultClass \Drupal\Component\Scaffold\Operations\ReplaceOp
* @coversDefaultClass \Drupal\Composer\Plugin\Scaffold\Operations\ReplaceOp
*
* @group Scaffold
*/

View File

@ -1,15 +1,15 @@
<?php
namespace Drupal\Tests\Component\Scaffold\Integration;
namespace Drupal\Tests\Composer\Plugin\Scaffold\Integration;
use PHPUnit\Framework\TestCase;
use Drupal\Tests\Component\Scaffold\Fixtures;
use Drupal\Component\Scaffold\Operations\ConjunctionOp;
use Drupal\Component\Scaffold\Operations\SkipOp;
use Drupal\Component\Scaffold\Operations\ScaffoldFileCollection;
use Drupal\Tests\Composer\Plugin\Scaffold\Fixtures;
use Drupal\Composer\Plugin\Scaffold\Operations\ConjunctionOp;
use Drupal\Composer\Plugin\Scaffold\Operations\SkipOp;
use Drupal\Composer\Plugin\Scaffold\Operations\ScaffoldFileCollection;
/**
* @coversDefaultClass \Drupal\Component\Scaffold\Operations\ScaffoldFileCollection
* @coversDefaultClass \Drupal\Composer\Plugin\Scaffold\Operations\ScaffoldFileCollection
*
* @group Scaffold
*/

View File

@ -1,14 +1,14 @@
<?php
namespace Drupal\Tests\Component\Scaffold\Integration;
namespace Drupal\Tests\Composer\Plugin\Scaffold\Integration;
use Drupal\Component\Scaffold\Operations\SkipOp;
use Drupal\Component\Scaffold\ScaffoldOptions;
use Drupal\Tests\Component\Scaffold\Fixtures;
use Drupal\Composer\Plugin\Scaffold\Operations\SkipOp;
use Drupal\Composer\Plugin\Scaffold\ScaffoldOptions;
use Drupal\Tests\Composer\Plugin\Scaffold\Fixtures;
use PHPUnit\Framework\TestCase;
/**
* @coversDefaultClass \Drupal\Component\Scaffold\Operations\SkipOp
* @coversDefaultClass \Drupal\Composer\Plugin\Scaffold\Operations\SkipOp
*
* @group Scaffold
*/

View File

@ -1,6 +1,6 @@
<?php
namespace Drupal\Tests\Component\Scaffold;
namespace Drupal\Tests\Composer\Plugin\Scaffold;
/**
* Holds result of a scaffold test.