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

Added API for an install path in installable repository #2424

Open
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
5 participants
@hason
Contributor

hason commented Nov 14, 2013

Fixes #2174

@stof

View changes

src/Composer/Repository/InstalledFilesystemRepository.php Outdated
throw new \InvalidArgumentException('The package "'.$package.'" is not in the repository.');
}

$this->packageData[$package->getUniqueName()] = $extra;

This comment has been minimized.

@stof

stof Nov 14, 2013

Contributor

is it intended to overwrite the install path here ? As there is a separate interface to set it, people might not expect it to be stored as package data

@stof

View changes

src/Composer/Repository/DataRepositoryInterface.php Outdated
*
* @author Martin Hasoň <martin.hason@gmail.com>
*/
interface DataRepositoryInterface

This comment has been minimized.

@stof

stof Nov 14, 2013

Contributor

The methods in this interface are only used internally in your implementation of InstalledFilesystemRepository. What is the use case for a new interface ?

@Seldaek

This comment has been minimized.

Member

Seldaek commented Mar 9, 2014

Just a note that #2773 might need to be updated after merging this.

@alebiavati

This comment has been minimized.

Contributor

alebiavati commented Mar 31, 2014

I'll get that done.

@hason hason force-pushed the hason:installpath branch from 11a9ec0 to 30e82e6 Nov 10, 2014

@Seldaek Seldaek modified the milestones: Backwards Compatible, Urgent Feb 25, 2015

@gossi

This comment has been minimized.

gossi commented May 2, 2015

At which place to find the install-path for each package (I'm sorry for asking I'm not into the composer api).

@Seldaek

This comment has been minimized.

Member

Seldaek commented May 2, 2015

This is the key part of how to access the install path for a package instance, I am not sure at which level you are working, but I don't think they persist to the installed.json in this PR.

+                            $repository = $composer->getRepositoryManager()->getLocalRepository();
+                            if ($repository instanceof InstalledRepositoryInterface && $repository->hasPackage($package)) {
+                                $path = $repository->getInstallPath($package);
+                            }
@gossi

This comment has been minimized.

gossi commented May 3, 2015

I'm consuming installed.json if it's in there it's the perfect place for composer and for me to read the desired information 😃

@hason hason force-pushed the hason:installpath branch from 30e82e6 to 9f5219f May 4, 2015

@hason

This comment has been minimized.

Contributor

hason commented May 4, 2015

This PR is updated.

@hason hason force-pushed the hason:installpath branch from 9f5219f to c2896b8 May 4, 2015

$path = $this->getInstallPath($package);
$data[] = array(
'package' => $dumper->dump($package),
'install-path' => null !== $path ? $this->fs->findShortestPath($fileDir, $path, true) : null,

This comment has been minimized.

@gossi

gossi May 7, 2015

This would break the functionality of tools that rely on the current structure of the dump. It would be better to put the install-path into the $package and dump it the way it currently is.

// some pseudo-code:
foreach ($this->getCanonicalPackages() as $package) {
    $path = $this->getInstallPath($package);
    $package['installPath'] = null !== $path ? $this->fs->findShortestPath($fileDir, $path, true) : null;
    $data[] = $dumper->dump($package);
}

And then let the dumper transform installPath into install-path.

@Seldaek Seldaek modified the milestones: 2.0, Nice To Have Apr 12, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment