Commit 1082bca9 authored by webchick's avatar webchick
Browse files

Issue #3086148 by greg.1.anderson, hussainweb, Mixologic: Make scaffold...

Issue #3086148 by greg.1.anderson, hussainweb, Mixologic: Make scaffold "extra" data key conform with plugin command name
parent f9ebeb1a
......@@ -160,7 +160,7 @@ protected function recursiveGetAllowedPackages(array $packages_to_allow, array $
protected function evaluateNewPackages(array $allowed_packages) {
foreach ($this->newPackages as $name => $newPackage) {
if (!array_key_exists($name, $allowed_packages)) {
$this->io->write("Not scaffolding files for <comment>{$name}</comment>, because it is not listed in the element 'extra.composer-scaffold.allowed-packages' in the root-level composer.json file.");
$this->io->write("Not scaffolding files for <comment>{$name}</comment>, because it is not listed in the element 'extra.drupal-scaffold.allowed-packages' in the root-level composer.json file.");
}
else {
$this->io->write("Package <comment>{$name}</comment> has scaffold operations, and is already allowed in the root-level composer.json file.");
......
......@@ -105,7 +105,7 @@ protected static function autoLoadContents($relative_autoload_path) {
* @file
* Includes the autoloader created by Composer.
*
* This file was generated by composer-scaffold.
* This file was generated by drupal-scaffold.
*.
* @see composer.json
* @see index.php
......
......@@ -24,12 +24,12 @@ class Handler {
/**
* Composer hook called before scaffolding begins.
*/
const PRE_COMPOSER_SCAFFOLD_CMD = 'pre-composer-scaffold-cmd';
const PRE_DRUPAL_SCAFFOLD_CMD = 'pre-drupal-scaffold-cmd';
/**
* Composer hook called after scaffolding completes.
*/
const POST_COMPOSER_SCAFFOLD_CMD = 'post-composer-scaffold-cmd';
const POST_DRUPAL_SCAFFOLD_CMD = 'post-drupal-scaffold-cmd';
/**
* The Composer service.
......@@ -148,7 +148,7 @@ public function scaffold() {
// Call any pre-scaffold scripts that may be defined.
$dispatcher = new EventDispatcher($this->composer, $this->io);
$dispatcher->dispatch(self::PRE_COMPOSER_SCAFFOLD_CMD);
$dispatcher->dispatch(self::PRE_DRUPAL_SCAFFOLD_CMD);
// Fetch the list of file mappings from each allowed package and normalize
// them.
......@@ -177,7 +177,7 @@ public function scaffold() {
$gitIgnoreManager->manageIgnored($scaffold_results, $scaffold_options);
// Call post-scaffold scripts.
$dispatcher->dispatch(self::POST_COMPOSER_SCAFFOLD_CMD);
$dispatcher->dispatch(self::POST_DRUPAL_SCAFFOLD_CMD);
}
/**
......
......@@ -10,7 +10,7 @@
* Per-project options from the 'extras' section of the composer.json file.
*
* Projects that describe scaffold files do so via their scaffold options.
* This data is pulled from the 'composer-scaffold' portion of the extras
* This data is pulled from the 'drupal-scaffold' portion of the extras
* section of the project data.
*/
class ManageOptions {
......
......@@ -53,9 +53,9 @@ Example: Permit scaffolding from the project `drupal/core`
"name": "my/project",
...
"extra": {
"composer-scaffold": {
"drupal-scaffold": {
"allowed-packages": [
"drupal/core",
"drupal/core"
],
...
}
......@@ -89,7 +89,7 @@ so via the `locations` mapping, as shown below:
"name": "my/project",
...
"extra": {
"composer-scaffold": {
"drupal-scaffold": {
"locations": {
"web-root": "./docroot"
},
......@@ -115,7 +115,7 @@ of the `robots.txt` file provided by `drupal/core`:
"name": "my/project",
...
"extra": {
"composer-scaffold": {
"drupal-scaffold": {
"file-mapping": {
"[web-root]/robots.txt": {
"append": "assets/my-robots-additions.txt",
......@@ -128,13 +128,13 @@ It is also possible to prepend to a scaffold file instead of, or in addition to
appending by including a "prepend" entry that provides the relative path to the
file to prepend to the scaffold file.
The example below demonstrates the use of the `post-composer-scaffold-cmd` hook
The example below demonstrates the use of the `post-drupal-scaffold-cmd` hook
to patch the `.htaccess` file using a patch.
```
"name": "my/project",
...
"scripts": {
"post-composer-scaffold-cmd": [
"post-drupal-scaffold-cmd": [
"cd docroot && patch -p1 <../patches/htaccess-ssl.patch"
]
}
......@@ -152,7 +152,7 @@ web root in the snippet below.
"name": "drupal/assets",
...
"extra": {
"composer-scaffold": {
"drupal-scaffold": {
"file-mapping": {
"[web-root]/robots.txt": "assets/robots.txt",
...
......@@ -171,7 +171,7 @@ setting the value for the scaffold file to exclude to `false`:
"name": "my/project",
...
"extra": {
"composer-scaffold": {
"drupal-scaffold": {
"file-mapping": {
"[web-root]/robots.txt": false
}
......@@ -193,7 +193,7 @@ the `overwrite` flag to `false`, as shown in the example below:
{
"name": "service-provider/d8-scaffold-files",
"extra": {
"composer-scaffold": {
"drupal-scaffold": {
"file-mapping": {
"[web-root]/sites/default/settings.php": {
"mode": "replace",
......@@ -221,7 +221,7 @@ to update it.
## Specifications
Reference section for the configuration directives for the "composer-scaffold"
Reference section for the configuration directives for the "drupal-scaffold"
section of the "extra" section of a `composer.json` file appear below.
### allowed-packages
......@@ -367,7 +367,7 @@ Sample composer.json for a project that relies on packages that use composer-sca
"sort-packages": true
},
"extra": {
"composer-scaffold": {
"drupal-scaffold": {
"allowed-packages": [
"drupal/core"
],
......@@ -391,7 +391,7 @@ Sample composer.json for drupal/core, with assets placed in a different project:
{
"name": "drupal/core",
"extra": {
"composer-scaffold": {
"drupal-scaffold": {
"allowed-packages": [
"drupal/assets",
]
......@@ -406,7 +406,7 @@ Sample composer.json for composer-scaffold files in drupal/assets:
{
"name": "drupal/assets",
"extra": {
"composer-scaffold": {
"drupal-scaffold": {
"file-mapping": {
"[web-root]/.csslintrc": "assets/.csslintrc",
"[web-root]/.editorconfig": "assets/.editorconfig",
......@@ -435,7 +435,7 @@ Sample composer.json for a library that implements composer-scaffold:
{
"name": "service-provider/d8-scaffold-files",
"extra": {
"composer-scaffold": {
"drupal-scaffold": {
"file-mapping": {
"[web-root]/sites/default/settings.php": "assets/sites/default/settings.php"
}
......@@ -450,7 +450,7 @@ Append to robots.txt:
{
"name": "service-provider/d8-scaffold-files",
"extra": {
"composer-scaffold": {
"drupal-scaffold": {
"file-mapping": {
"[web-root]/robots.txt": {
"append": "assets/my-robots-additions.txt",
......@@ -464,7 +464,7 @@ Append to robots.txt:
Patch a file after it's copied:
```
"post-composer-scaffold-cmd": [
"post-drupal-scaffold-cmd": [
"cd docroot && patch -p1 <../patches/htaccess-ssl.patch"
]
```
......
......@@ -6,7 +6,7 @@
* Per-project options from the 'extras' section of the composer.json file.
*
* Projects that describe scaffold files do so via their scaffold options. This
* data is pulled from the 'composer-scaffold' portion of the extras section of
* data is pulled from the 'drupal-scaffold' portion of the extras section of
* the project data.
*/
class ScaffoldOptions {
......@@ -22,7 +22,7 @@ class ScaffoldOptions {
* ScaffoldOptions constructor.
*
* @param array $options
* The scaffold options taken from the 'composer-scaffold' section.
* The scaffold options taken from the 'drupal-scaffold' section.
*/
protected function __construct(array $options) {
$this->options = $options + [
......@@ -49,7 +49,7 @@ protected function __construct(array $options) {
* True if scaffold options have been declared
*/
public static function hasOptions(array $extras) {
return array_key_exists('composer-scaffold', $extras);
return array_key_exists('drupal-scaffold', $extras);
}
/**
......@@ -62,7 +62,7 @@ public static function hasOptions(array $extras) {
* The scaffold options object representing the provided scaffold options
*/
public static function create(array $extras) {
$options = static::hasOptions($extras) ? $extras['composer-scaffold'] : [];
$options = static::hasOptions($extras) ? $extras['drupal-scaffold'] : [];
return new self($options);
}
......
......@@ -27,7 +27,7 @@
"sort-packages": true
},
"extra": {
"composer-scaffold": {
"drupal-scaffold": {
"locations": {
"web-root": "./"
}
......
......@@ -26,7 +26,7 @@
"sort-packages": true
},
"extra": {
"composer-scaffold": {
"drupal-scaffold": {
"locations": {
"web-root": "web/"
}
......
......@@ -187,7 +187,7 @@
"autoloader-suffix": "Drupal8"
},
"extra": {
"composer-scaffold": {
"drupal-scaffold": {
"file-mapping": {
"[project-root]/.editorconfig": "assets/scaffold/files/editorconfig",
"[project-root]/.gitattributes": "assets/scaffold/files/gitattributes",
......
......@@ -133,7 +133,7 @@ public function testComposerHooks() {
// get a warning, and it does not scaffold.
$stdout = $this->mustExec("composer require --no-ansi --no-interaction fixtures/scaffold-override-fixture:dev-master", $sut);
$this->assertFileNotExists($sut . '/sites/default/default.settings.php');
$this->assertContains("Not scaffolding files for fixtures/scaffold-override-fixture, because it is not listed in the element 'extra.composer-scaffold.allowed-packages' in the root-level composer.json file.", $stdout);
$this->assertContains("Not scaffolding files for fixtures/scaffold-override-fixture, because it is not listed in the element 'extra.drupal-scaffold.allowed-packages' in the root-level composer.json file.", $stdout);
}
}
......@@ -39,7 +39,7 @@
"fixtures/drupal-core-fixture": "*"
},
"extra": {
"composer-scaffold": {
"drupal-scaffold": {
"allowed-packages": [
"fixtures/drupal-core-fixture",
"fixtures/scaffold-override-fixture"
......
......@@ -39,7 +39,7 @@
"fixtures/drupal-core-fixture": "*"
},
"extra": {
"composer-scaffold": {
"drupal-scaffold": {
"locations": {
"web-root": "./"
},
......
{
"name": "fixtures/drupal-assets-fixture",
"extra": {
"composer-scaffold": {
"drupal-scaffold": {
"file-mapping": {
"[web-root]/.csslintrc": "assets/.csslintrc",
"[web-root]/.editorconfig": "assets/.editorconfig",
......
......@@ -40,7 +40,7 @@
"fixtures/scaffold-override-fixture": "*"
},
"extra": {
"composer-scaffold": {
"drupal-scaffold": {
"allowed-packages": [
"fixtures/drupal-core-fixture",
"fixtures/scaffold-override-fixture"
......
......@@ -4,7 +4,7 @@
"fixtures/drupal-assets-fixture": "*"
},
"extra": {
"composer-scaffold": {
"drupal-scaffold": {
"allowed-packages": [
"fixtures/drupal-assets-fixture"
]
......
......@@ -40,7 +40,7 @@
"fixtures/drupal-core-fixture": "*"
},
"extra": {
"composer-scaffold": {
"drupal-scaffold": {
"allowed-packages": [
"fixtures/drupal-core-fixture",
"fixtures/profile-with-append"
......
......@@ -40,7 +40,7 @@
"fixtures/scaffold-override-fixture": "*"
},
"extra": {
"composer-scaffold": {
"drupal-scaffold": {
"allowed-packages": [
"fixtures/drupal-core-fixture",
"fixtures/scaffold-override-fixture"
......
......@@ -32,7 +32,7 @@
"fixtures/drupal-core-fixture": "*"
},
"extra": {
"composer-scaffold": {
"drupal-scaffold": {
"allowed-packages": [
"fixtures/drupal-core-fixture"
],
......
......@@ -40,7 +40,7 @@
"fixtures/scaffold-override-fixture": "*"
},
"extra": {
"composer-scaffold": {
"drupal-scaffold": {
"allowed-packages": [
"fixtures/drupal-core-fixture",
"fixtures/scaffold-override-fixture"
......
......@@ -40,7 +40,7 @@
"fixtures/scaffold-override-fixture": "*"
},
"extra": {
"composer-scaffold": {
"drupal-scaffold": {
"allowed-packages": [
"fixtures/drupal-core-fixture",
"fixtures/scaffold-override-fixture"
......
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