Skip to content

Commit

Permalink
Merge pull request #47 from RobLoach/45-scripts-not-executing
Browse files Browse the repository at this point in the history
Fix to act on root packages rather than its alias - fixes #45
  • Loading branch information
RobLoach committed Aug 31, 2013
2 parents eb76ddb + aa7afbd commit 1864f25
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/ComponentInstaller/Installer.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use Composer\Installer\LibraryInstaller;
use Composer\Script\Event;
use Composer\Package\PackageInterface;
use Composer\Package\AliasPackage;
use Composer\Util\Filesystem;

/**
Expand All @@ -41,6 +42,11 @@ public function supports($packageType)
// the root package's scripts if available.
$rootPackage = isset($this->composer) ? $this->composer->getPackage() : null;
if (isset($rootPackage)) {
// Ensure we get the root package rather than its alias.
while ($rootPackage instanceof AliasPackage) {
$rootPackage = $rootPackage->getAliasOf();
}

// Make sure the root package can override the available scripts.
if (method_exists($rootPackage, 'setScripts')) {
$scripts = $rootPackage->getScripts();
Expand Down

0 comments on commit 1864f25

Please sign in to comment.