Unverified Commit 3a4092e3 authored by larowlan's avatar larowlan
Browse files

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

parent cf5ad5fe
......@@ -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",
......
<?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) {
......
<?php
namespace Drupal\Component\Scaffold;
namespace Drupal\Composer\Plugin\Scaffold;
use Composer\Plugin\Capability\CommandProvider as CommandProviderCapability;
......
<?php
namespace Drupal\Component\Scaffold;
namespace Drupal\Composer\Plugin\Scaffold;
use Composer\Command\BaseCommand;
use Symfony\Component\Console\Input\InputInterface;
......
<?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 @@ private function __construct() {
* @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 @@ public static function autoloadFileCommitted(IOInterface $io, $package_name, $we
* @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) {
......
<?php
namespace Drupal\Component\Scaffold;
namespace Drupal\Composer\Plugin\Scaffold;
use Composer\IO\IOInterface;
use Composer\Util\ProcessExecutor;
......
<?php
namespace Drupal\Component\Scaffold;
namespace Drupal\Composer\Plugin\Scaffold;
use Composer\Composer;
use Composer\EventDispatcher\EventDispatcher;
......@@ -9,9 +9,9 @@
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 @@ public function onPostPackageEvent(PackageEvent $event) {
* 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 @@ protected function getVendorPath() {
* 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 @@ protected function getFileMappingsFromPackages(array $allowed_packages) {
* @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) {
......
<?php
namespace Drupal\Component\Scaffold;
namespace Drupal\Composer\Plugin\Scaffold;
/**
* Injects config values from an associative array into a string.
......
<?php
namespace Drupal\Component\Scaffold;
namespace Drupal\Composer\Plugin\Scaffold;
use Composer\IO\IOInterface;
......@@ -37,10 +37,10 @@ public function __construct(IOInterface $io, $dir) {
/**
* 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 @@ public function manageIgnored(array $files, ScaffoldOptions $options) {
/**
* 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
......
<?php
namespace Drupal\Component\Scaffold;
namespace Drupal\Composer\Plugin\Scaffold;
use Composer\Composer;
use Composer\Package\PackageInterface;
......@@ -35,7 +35,7 @@ public function __construct(Composer $composer) {
/**
* 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 @@ public function getOptions() {
* @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 @@ public function packageOptions(PackageInterface $package) {
*
* 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.
*/
......
<?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) {
......
<?php
namespace Drupal\Component\Scaffold\Operations;
namespace Drupal\Composer\Plugin\Scaffold\Operations;
/**
* Marker interface indicating that operation is conjoinable.
......
<?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;
......
<?php
namespace Drupal\Component\Scaffold\Operations;
namespace Drupal\Composer\Plugin\Scaffold\Operations;
/**
* Holds parameter data for operation objects during operation creation only.
......
<?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 @@ public function __construct(Composer $composer) {
* @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 @@ public function create(PackageInterface $package, OperationData $operation_data)
* @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 @@ protected function createReplaceOp(PackageInterface $package, OperationData $ope
* @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) {
......
<?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);
......
<?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 @@ public function process(ScaffoldFilePath $destination, IOInterface $io, Scaffold
/**
* 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 @@ protected function copyScaffold(ScaffoldFilePath $destination, IOInterface $io)
/**
* 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) {
......
<?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 @@ public function getIterator() {
/**
* 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) {
......
<?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 @@ public function isManaged() {
/**
* 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() {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment