コード例 #1
0
 /**
  * Command event dispatcher
  *
  * @param \Composer\Plugin\CommandEvent $event
  */
 public function onCommand(CommandEvent $event)
 {
     switch ($event->getCommandName()) {
         case 'dump-autoload':
             $_this = new DumpAutoloadEventHandler($this->__installer->getComposer()->getPackage(), $this->__installer->getComposer());
             break;
         default:
             break;
     }
 }
コード例 #2
0
 /**
  * Remove the assets of a package
  *
  * @param \Composer\Package\PackageInterface $package
  * @return bool
  */
 protected function removeAssets(PackageInterface $package)
 {
     $assets = $this->getPackageAssetsDir($package);
     if (!$assets) {
         return;
     }
     $target = $this->getAssetsInstallPath($package);
     if (file_exists($target)) {
         $this->io->write(sprintf('  - Removing <info>%s</info> assets from <info>%s</info>', $package->getPrettyName(), str_replace(dirname($this->assets_dir) . '/', '', $target)));
         $this->filesystem->remove($target);
         Dispatch::unregisterPackage($package, $this);
         $this->io->write('');
     } else {
         Error::thrower(sprintf('Unable to find assets from package "%s"', $package->getPrettyName()), '\\InvalidArgumentException', __CLASS__, __METHOD__, __LINE__);
     }
 }