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

Workflow for replacing an existing package install #65

Open
rhyek opened this issue Sep 9, 2016 · 4 comments
Open

Workflow for replacing an existing package install #65

rhyek opened this issue Sep 9, 2016 · 4 comments

Comments

@rhyek
Copy link

rhyek commented Sep 9, 2016

I'm on Windows. Here's my situation:

  • Currently working on a project that uses package org/repo
  • Said package is already added to composer.json and is installed in vendors/
  • I forked org/repo to rhyek/repo and cloned it locally to ~/dev/laravel/packages/org/repo
  • In the project's root folder, I'm doing studio load "~/dev/laravel/packages/*".

Issues:

  • With the current package still installed, I run composer update org/repo and I still have the old files present inside vendors. No symlink.
  • If I delete the files and then run the same command, the script php artisan clear-compiled fails stating it can't find one of the packages files.

What should I try?

@rhyek rhyek changed the title Workflow for replacing an existing package Workflow for replacing an existing package install Sep 9, 2016
@Rjs37
Copy link

Rjs37 commented Oct 13, 2016

@rhyek Are you running this within a VM using vagrant? If so then for the symlink to work on Windows, the terminal has to be opened using the "Run as Administrator" option.

Then run "vagrant up", "vagrant ssh" and do the composer update, the symlink should then work and stay in place until you next need to do a composer update.

@franzliedke
Copy link
Owner

franzliedke commented Oct 18, 2016

@rhyek Any luck with Robert's suggestions?

What is the version constraint that you have for org/repo in your composer.json?

@rhyek rhyek closed this as completed Oct 20, 2016
@rask
Copy link
Contributor

rask commented Apr 12, 2017

Running into this issue as well.

Originally I have package foo/bar at version 1.0.0 installed. Then I forked the repo at Github (foo/bar to rask/bar). Then I used studio create as such

$ studio create --git [email protected]:rask/bar.git pkgs/bar

And loaded it as well. Then inside pkgs/bar (local clone of fork) I created a feature branch called feature/my-feature and added a commit.

Now in my main project composer.json I defined the package as

"foo/bar": "dev-feature/my-feature"

after which I attempt composer update. The update errors out as it can't seem to find the local dev branch:

Your requirements could not be resolved to an installable set of packages.

Problem 1
- The requested package foo/bar dev-feature/my-feature exists as
    foo/bar[0.1.0, 0.2.0, 0.2.1, 1.0.0 dev-feature/biz-baz, ... <more tags and branches>]
    but these are rejected by your constraint.

Changing the package vendor name or trying different feature branch names doesn't seem to work. Clearing vendor/ doesn't help either.

It seems like Composer does not respect local branches that are not available in the remote package repository? Would I need to push the feature/my-feature branch back to GitHub for it to appear properly?

Pushing the local feature branch to the fork repo at GitHub allows me to install the branch from GitHub, but studio does not kick in at any point.

@franzliedke franzliedke reopened this Dec 1, 2017
franzliedke added a commit that referenced this issue Dec 2, 2017
This is a fundamental rewrite of the Composer integration. Now, instead
of adding the loaded paths to Composer's search path (by creating path
repositories for them), we replace the packages downloaded by Composer
that can be found in the loaded paths by symlinks to the local paths.

Doing so requires us to hook into the autoload dumper, which now has to
respect the rules in the local path, not those obtained from Packagist.

All of this should hopefully fix several issues, most importantly:
- Composer's lock file will be written before Studio does its magic,
  therefore not causing any conflicts with other developers' setups.
- Different version constraints on symlinked packages won't cause
  problems anymore. Any required packages that are found in loaded paths
  will be loaded, no matter the branch or version they are on.

Open questions:
- How should packages be handled that have not yet been added to
  Packagist? (Proposed solution: Create path repositories for the loaded
  paths, but *append* them instead of *prepending*, so that they will
  only be used as fallback, if Packagist does not yield any results.)
- Should we validate the constraints from composer.json before creating
  symlinks? With this setup, everything might be working locally, but
  not when downloading the package from Packagist (as another version
  may be downloaded instead).

Refs #52, #58, #65, #72.
@franzliedke
Copy link
Owner

Please try out the newly released 0.14.0-beta1 version. I am hoping this issue will be gone.

(Note that you will have to run composer update and composer dump-autoload for the installation of any package.)

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

4 participants