Skip to content
This repository has been archived by the owner on Jan 21, 2020. It is now read-only.

Push composer scripts into their own namespace #40

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
},
"autoload": {
"psr-4": {
"App\\": "src/App/"
"App\\": "src/App/",
"ExpressiveInstaller\\": "src/ExpressiveInstaller/"
}
},
"autoload-dev": {
Expand All @@ -38,8 +39,8 @@
}
},
"scripts": {
"pre-install-cmd": "App\\Composer\\OptionalPackages::install",
"pre-update-cmd": "App\\Composer\\OptionalPackages::install",
"pre-install-cmd": "ExpressiveInstaller\\OptionalPackages::install",
"pre-update-cmd": "ExpressiveInstaller\\OptionalPackages::install",
"check": [
"@cs",
"@test"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @license https://github.com/zendframework/zend-expressive-skeleton/blob/master/LICENSE.md New BSD License
*/

namespace App\Composer;
namespace ExpressiveInstaller;

use Composer\Composer;
use Composer\Factory;
Expand All @@ -28,8 +28,8 @@
* Add this script to composer.json:
*
* "scripts": {
* "pre-update-cmd": "App\\Composer\\OptionalPackages::install",
* "pre-install-cmd": "App\\Composer\\OptionalPackages::install"
* "pre-update-cmd": "ExpressiveInstaller\\OptionalPackages::install",
* "pre-install-cmd": "ExpressiveInstaller\\OptionalPackages::install"
* },
*/
class OptionalPackages
Expand Down Expand Up @@ -178,6 +178,9 @@ public static function install(Event $event)
unset(self::$composerDefinition['scripts']);
}

// Remove installer script autoloading rules
unset(self::$composerDefinition['autoload']['psr-4']['ExpressiveInstaller\\']);

// Update composer definition
$json->write(self::$composerDefinition);

Expand Down