Commit f9ebeb1a authored by webchick's avatar webchick

Issue #3086081 by hussainweb, greg.1.anderson: Name of composer:scaffold command is awkward

parent 9aa7d13c
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
/** /**
* The "composer:scaffold" command class. * The "drupal:scaffold" command class.
* *
* Manually run the scaffold operation that normally happens after * Manually run the scaffold operation that normally happens after
* 'composer install'. * 'composer install'.
...@@ -19,17 +19,18 @@ class ComposerScaffoldCommand extends BaseCommand { ...@@ -19,17 +19,18 @@ class ComposerScaffoldCommand extends BaseCommand {
*/ */
protected function configure() { protected function configure() {
$this $this
->setName('composer:scaffold') ->setName('drupal:scaffold')
->setDescription('Update the Composer scaffold files.') ->setAliases(['scaffold'])
->setDescription('Update the Drupal scaffold files.')
->setHelp( ->setHelp(
<<<EOT <<<EOT
The <info>composer:scaffold</info> command places the scaffold files in their The <info>drupal:scaffold</info> command places the scaffold files in their
respective locations according to the layout stipulated in the composer.json respective locations according to the layout stipulated in the composer.json
file. file.
<info>php composer.phar composer:scaffold</info> <info>php composer.phar drupal:scaffold</info>
It is usually not necessary to call <info>composer:scaffold</info> manually, It is usually not necessary to call <info>drupal:scaffold</info> manually,
because it is called automatically as needed, e.g. after an <info>install</info> because it is called automatically as needed, e.g. after an <info>install</info>
or <info>update</info> command. Note, though, that only packages explicitly or <info>update</info> command. Note, though, that only packages explicitly
allowed to scaffold in the top-level composer.json will be processed by this allowed to scaffold in the top-level composer.json will be processed by this
......
# composer-scaffold # Drupal Composer Scaffold
This project provides a composer plugin for placing scaffold files (like This project provides a composer plugin for placing scaffold files (like
`index.php`, `update.php`, …) from the `drupal/core` project into their desired `index.php`, `update.php`, …) from the `drupal/core` project into their desired
...@@ -22,7 +22,7 @@ explicitly granted that right in the top-level composer.json file. See ...@@ -22,7 +22,7 @@ explicitly granted that right in the top-level composer.json file. See
## Usage ## Usage
Composer-scaffold is used by requiring `drupal/core-composer-scaffold` in your Drupal Composer Scaffold is used by requiring `drupal/core-composer-scaffold` in your
project, and providing configuration settings in the `extra` section of your project, and providing configuration settings in the `extra` section of your
project's composer.json file. Additional configuration from the composer.json project's composer.json file. Additional configuration from the composer.json
file of your project's dependencies is also consulted in order to scaffold the file of your project's dependencies is also consulted in order to scaffold the
...@@ -31,6 +31,14 @@ end of scaffold files, as is commonly done to `.htaccess` and `robots.txt` ...@@ -31,6 +31,14 @@ end of scaffold files, as is commonly done to `.htaccess` and `robots.txt`
files. See [altering scaffold files](#altering-scaffold-files) for more files. See [altering scaffold files](#altering-scaffold-files) for more
information. information.
Typically, the scaffold operations run automatically as needed, e.g. after
`composer install`, so it is usually not necessary to do anything different
to scaffold a project once the configuration is set up in the project
composer.json file, as described below. To scaffold files directly, run:
```
composer drupal:scaffold
```
### Allowed Packages ### Allowed Packages
Scaffold files are stored inside of projects that are required from the main Scaffold files are stored inside of projects that are required from the main
...@@ -465,7 +473,7 @@ Patch a file after it's copied: ...@@ -465,7 +473,7 @@ Patch a file after it's copied:
### drupal-composer/drupal-scaffold ### drupal-composer/drupal-scaffold
Previous versions of drupal-scaffold (see community project, Previous versions of Drupal Composer Scaffold (see community project,
[drupal-composer/drupal-scaffold](https://github.com/drupal-composer/drupal-project)) [drupal-composer/drupal-scaffold](https://github.com/drupal-composer/drupal-project))
downloaded each scaffold file directly from its distribution server (e.g. downloaded each scaffold file directly from its distribution server (e.g.
`https://git.drupalcode.org`) to the desired destination directory. This was `https://git.drupalcode.org`) to the desired destination directory. This was
......
...@@ -9,6 +9,9 @@ ...@@ -9,6 +9,9 @@
"composer-plugin-api": "^1.0.0", "composer-plugin-api": "^1.0.0",
"php": ">=7.0.8" "php": ">=7.0.8"
}, },
"conflict": {
"drupal-composer/drupal-scaffold": "*"
},
"autoload": { "autoload": {
"psr-4": { "psr-4": {
"Drupal\\Composer\\Plugin\\Scaffold\\": "" "Drupal\\Composer\\Plugin\\Scaffold\\": ""
......
...@@ -104,7 +104,7 @@ public function testComposerHooks() { ...@@ -104,7 +104,7 @@ public function testComposerHooks() {
$this->mustExec("composer update --no-ansi", $sut); $this->mustExec("composer update --no-ansi", $sut);
$this->assertScaffoldedFile($sut . '/sites/default/default.settings.php', FALSE, 'scaffolded from the scaffold-override-fixture'); $this->assertScaffoldedFile($sut . '/sites/default/default.settings.php', FALSE, 'scaffolded from the scaffold-override-fixture');
// Delete the same test scaffold file again, then run // Delete the same test scaffold file again, then run
// 'composer composer:scaffold' and see if the scaffold file is // 'composer drupal:scaffold' and see if the scaffold file is
// re-scaffolded. // re-scaffolded.
@unlink($sut . '/sites/default/default.settings.php'); @unlink($sut . '/sites/default/default.settings.php');
$this->assertFileNotExists($sut . '/sites/default/default.settings.php'); $this->assertFileNotExists($sut . '/sites/default/default.settings.php');
...@@ -114,7 +114,7 @@ public function testComposerHooks() { ...@@ -114,7 +114,7 @@ public function testComposerHooks() {
// 'composer install' and see if the scaffold file is re-scaffolded. // 'composer install' and see if the scaffold file is re-scaffolded.
@unlink($sut . '/sites/default/default.settings.php'); @unlink($sut . '/sites/default/default.settings.php');
$this->assertFileNotExists($sut . '/sites/default/default.settings.php'); $this->assertFileNotExists($sut . '/sites/default/default.settings.php');
$this->mustExec("composer composer:scaffold --no-ansi", $sut); $this->mustExec("composer drupal:scaffold --no-ansi", $sut);
$this->assertScaffoldedFile($sut . '/sites/default/default.settings.php', FALSE, 'scaffolded from the scaffold-override-fixture'); $this->assertScaffoldedFile($sut . '/sites/default/default.settings.php', FALSE, 'scaffolded from the scaffold-override-fixture');
// Run 'composer create-project' to create a new test project called // Run 'composer create-project' to create a new test project called
// 'create-project-test', which is a copy of 'fixtures/drupal-drupal'. // 'create-project-test', which is a copy of 'fixtures/drupal-drupal'.
......
...@@ -191,7 +191,7 @@ public function testUnmanagedGitIgnoreWhenGitNotAvailable() { ...@@ -191,7 +191,7 @@ public function testUnmanagedGitIgnoreWhenGitNotAvailable() {
$this->assertEquals(127, $status); $this->assertEquals(127, $status);
// Run the scaffold command. // Run the scaffold command.
$output = []; $output = [];
exec('composer composer:scaffold', $output, $status); exec('composer drupal:scaffold', $output, $status);
putenv('PATH=' . $oldPath . ':' . getenv('PATH')); putenv('PATH=' . $oldPath . ':' . getenv('PATH'));
......
...@@ -112,7 +112,7 @@ public function scaffoldSut($fixture_name, $is_link = FALSE, $relocated_docroot ...@@ -112,7 +112,7 @@ public function scaffoldSut($fixture_name, $is_link = FALSE, $relocated_docroot
$sut = $this->createSut($fixture_name, ['SYMLINK' => $is_link ? 'true' : 'false']); $sut = $this->createSut($fixture_name, ['SYMLINK' => $is_link ? 'true' : 'false']);
// Run composer install to get the dependencies we need to test. // Run composer install to get the dependencies we need to test.
$this->fixtures->runComposer("install --no-ansi --no-scripts", $sut); $this->fixtures->runComposer("install --no-ansi --no-scripts", $sut);
// Test composer:scaffold. // Test drupal:scaffold.
$scaffoldOutput = $this->fixtures->runScaffold($sut); $scaffoldOutput = $this->fixtures->runScaffold($sut);
// Calculate the docroot directory and assert that our fixture layout // Calculate the docroot directory and assert that our fixture layout
......
...@@ -13,7 +13,7 @@ Example: ...@@ -13,7 +13,7 @@ Example:
$ SCAFFOLD_FIXTURE_DIR=$HOME/tmp/scaffold-fixtures composer unit $ SCAFFOLD_FIXTURE_DIR=$HOME/tmp/scaffold-fixtures composer unit
$ cd $HOME/tmp/scaffold-fixtures $ cd $HOME/tmp/scaffold-fixtures
$ cd drupal-drupal $ cd drupal-drupal
$ composer composer:scaffold $ composer drupal:scaffold
Scaffolding files for fixtures/drupal-assets-fixture: Scaffolding files for fixtures/drupal-assets-fixture:
- Link [web-root]/.csslintrc from assets/.csslintrc - Link [web-root]/.csslintrc from assets/.csslintrc
......
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