Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not remove package from custom directory #15

Closed
carlos-reynosa opened this issue Sep 9, 2015 · 5 comments
Closed

Does not remove package from custom directory #15

carlos-reynosa opened this issue Sep 9, 2015 · 5 comments

Comments

@carlos-reynosa
Copy link

Hi,

Can you confirm that composer should remove a package installed with this installer, if it was removed from the composer.json within the "require" section?

It seems that composer is not removing the custom package directory that was installed with this installer.

Thanks for your help!

Regards,

Carlos

@carlos-reynosa
Copy link
Author

By the way i'm removing the package as a dependency an then running a composer update.

@carlos-reynosa
Copy link
Author

Maybe the LibraryInstaller might need to override the uninstall function to take into account the custom paths?

uninstall(), here you can determine the actions that need to be executed when the package needs to be removed. - Composer Docs

@carlos-reynosa
Copy link
Author

Seems like the getPackageBasePath function has the vendor directory hard coded in:

protected function removeCode(PackageInterface $package)
    {
        $downloadPath = $this->getPackageBasePath($package);
        $this->downloadManager->remove($package, $downloadPath);
    }

https://github.com/composer/composer/blob/9f6fdfd703f433bd0777fd89fb4684908a6c4f06/src/Composer/Installer/LibraryInstaller.php#L180-L184

protected function getPackageBasePath(PackageInterface $package)
    {
        $this->initializeVendorDir();
        return ($this->vendorDir ? $this->vendorDir.'/' : '') . $package->getPrettyName();
    }

https://github.com/composer/composer/blob/9f6fdfd703f433bd0777fd89fb4684908a6c4f06/src/Composer/Installer/LibraryInstaller.php#L146-L151

@mnsami
Copy link
Owner

mnsami commented Sep 20, 2015

hello .. sorry for the late reply, but currently i'm heading off to my wedding vacations and i'll be available again after the 14th of October and I'll look into deep for all the comments you asked and pointed out.

thanks

@mnsami
Copy link
Owner

mnsami commented Feb 4, 2016

I think this issue is resolved automatically if you update your composer

Please check the latest commit at https://github.com/composer/composer/blob/master/src/Composer/Installer/LibraryInstaller.php#L162

    protected function getPackageBasePath(PackageInterface $package)
    {
        $installPath = $this->getInstallPath($package);
        $targetDir = $package->getTargetDir();
        if ($targetDir) {
            return preg_replace('{/*'.str_replace('/', '/+', preg_quote($targetDir)).'/?$}', '', $installPath);
        }
        return $installPath;
    }

if you are okay with it .. can you close the issue please?

thanks a lot.

@mnsami mnsami closed this as completed May 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants