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

WIP: Link command #1017

Closed
wants to merge 2 commits into
base: master
from

Conversation

Projects
None yet
@fprochazka
Contributor

fprochazka commented Aug 20, 2012

First of all, this pullrequest is a work in progress.

I'm determined to finish this, but I've got stuck for three days now. I have no clue how to force the composer to use the package, that has installation-source: link that I've provided. The DependencyResolver is just a gibberish to me.

If you guys could just push me in the right direction I'd be really happy to finish this. #601

@travisbot

This comment has been minimized.

travisbot commented Aug 20, 2012

This pull request fails (merged f48887b into ab38ee3).

@jmather

This comment has been minimized.

jmather commented Oct 11, 2012

Does this alter the composer.json at all? Also -- where are you at on this? What needs to be done still?

if (preg_match('~^\w[\w.-]*/\w[\w.-]*$~i', $package)) {
return $this->installFromLocalLink($input, $output, $package);
} elseif ($package) {

This comment has been minimized.

@stof

stof Oct 11, 2012

Contributor

This should simply be if as the previous if returns

This comment has been minimized.

@fprochazka

fprochazka Oct 12, 2012

Contributor

You really care about the coding standard, even if it doesn't work?

This comment has been minimized.

@ericclemmons

ericclemmons Aug 19, 2013

I was looking for the equivalent of npm link for composer & found this. It made me LOL. That's totally @stof's MO :D

}
$command = sprintf("%s link", escapeshellarg($_SERVER['PHP_SELF'])); // todo: will this work in phar?
$out = NULL;

This comment has been minimized.

@stof

stof Oct 11, 2012

Contributor

please lowercase null

$packageConfig = $jsonFile->read();
return $this->installFromLocalLink($input, $output, $packageConfig['name']);
} else {

This comment has been minimized.

@stof

stof Oct 11, 2012

Contributor

same here. Using else is not needed as the if returns

@@ -27,7 +27,10 @@ public function __construct(ProcessExecutor $executor = null)
public function removeDirectory($directory)
{
if (!is_dir($directory)) {
if (is_link($directory)) {
return unlink($directory);

This comment has been minimized.

@stof

stof Oct 11, 2012

Contributor

This is not enough on windows.

Btw, this class should probably extend the one from Filesystem component (which supports removing symlinks properly for instance)

@fprochazka

This comment has been minimized.

Contributor

fprochazka commented Oct 12, 2012

The state didn't changed... It's so long from I've written it, that I don't think I even remember what this does. I'm currently thinking about closing this PR, because somebody else, who understands the "Solver mess" could do it much faster than me.

@mneuhaus

This comment has been minimized.

mneuhaus commented Nov 9, 2012

This seems like it could be a way to solve my situation described in #1299, so +1 from me :)
Any idea/eta when or if this will be finished?

@fprochazka

This comment has been minimized.

Contributor

fprochazka commented Nov 10, 2012

No idea... it's way too complex for me to solve it on my own.

@chEbba

This comment has been minimized.

Contributor

chEbba commented Nov 19, 2012

I had an idea to have a local system repository in #915 this is not a unique idea for package managers / dependency resolvers, ex. maven use such repository.
So i think this ideas can be merged:

  • Local system repository
  • Command to add package to this repository with --link flag
  • After package is installed as a dependency in another project use link command to change copy to symlink
  • Mark packages as "linked" in local repositories (local & devlocal)
  • Is installation type "link" really needed or it can be one of dist/source? And i think dir downloader from #1266 is ok
  • I don't see a pretty way to link package on installation because you need to define somewhere which packages should be linked and which should not . But some --use-links flag may be added for install/update commands.

BTW. I think this feature can be useful, but the most of problems that people want to solve with it can be solved (and should be soved) in another ways.
The main problem in composer-user community is a versioning: ton of packages with dev-stability which depends on dev packages.
More over. Problems with repeated composer update is a worflow problem and not the composer one.

@Petah

This comment has been minimized.

Contributor

Petah commented Mar 26, 2013

Any progress?

@glen-84

This comment has been minimized.

glen-84 commented Sep 30, 2013

I also really need this, see my explanation here.

BTW, on Windows you need admin privs in order to create links, how will this be handled?

I hope this gets added soon!

*/
public function setPreferLinks(array $packages)
{
$this->preferLinks = array_flip(array_map('strtolower', $packages));

This comment has been minimized.

@stof

stof Sep 30, 2013

Contributor

as all you are doing is iterating, you don't really need to flip it and then ignore values

$this->config = $config ?: Factory::createConfig();
$this->io = $io ?: new NullIO();
$this->linksJson = new JsonFile($this->config->get('home') . '/links.json');

This comment has been minimized.

@stof

stof Sep 30, 2013

Contributor

should links really be shared between projects ?

@glen-84

This comment has been minimized.

glen-84 commented Oct 4, 2013

@Seldaek, are you able to help @hosiplan with this?

@Seldaek

This comment has been minimized.

Member

Seldaek commented Nov 13, 2013

Able is one thing but I just don't have enough time these days to work on new stuff. I try to keep on top of new PRs/issues but it already takes me too much time.

@dermellor

This comment has been minimized.

dermellor commented May 4, 2014

👍

1 similar comment
@kaiwa

This comment has been minimized.

Contributor

kaiwa commented Jun 11, 2014

👍

@nnnnathann

This comment has been minimized.

nnnnathann commented Jun 27, 2014

👍

@nvanheuverzwijn

This comment has been minimized.

nvanheuverzwijn commented Dec 19, 2014

me want 👍
Is there anything we can do to help with this feature ? This would be REALLY useful !

@pmccarren

This comment has been minimized.

pmccarren commented Mar 18, 2015

👍

@webmozart

This comment has been minimized.

webmozart commented Apr 15, 2015

I'll put myself on the list to say I'd love this :) 👍

@podorozhny

This comment has been minimized.

podorozhny commented Oct 27, 2017

fprochazka closed this on 11 Jan 2016

whyyy

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