fix: resolve Phar updater strategies#481
fix: resolve Phar updater strategies#481owenvoke wants to merge 1 commit intolaravel-zero:masterfrom
Conversation
|
@owenvoke you need to rebase. |
This makes sure that the Phar name is set for the GitHub Releases strategy.
477b05c to
99025c9
Compare
|
@nunomaduro, done. 👍🏻 I have only tested these changes on the repo in the issue, so not sure if we want to do some further testing. 🤷🏻 |
|
Any news about this? What is preventing the merge? |
|
@sergix44, I think it was just needing further testing (on real-world projects). If you have a project, feel free to test this branch. 🙂 |
Uses laravel-zero/framework#481 to test if it can work for production
|
|
||
| $composer = json_decode(file_get_contents(base_path('composer.json')), true); | ||
| $name = $composer['name']; | ||
| $composer = json_decode(file_get_contents($this->app->basePath('composer.json')), true); |
There was a problem hiding this comment.
I think there should be a way to set the package name without Composer, as there is no real guarantee that the compiled binary is run in a directory with a composer.json file, nor do I think there should need to be?
There was a problem hiding this comment.
This is the composer.json within the Phar file. It should always exist.
There was a problem hiding this comment.
Okay, that's weird, because for me, it tries to load it from the working directory.
hydephp/cli@925f00b It could be due to how my paths are setup though, in which case this is my fault. Gonna check it out.
There was a problem hiding this comment.
Yeah, this is my bad. My application sets the working base path to be the working directory. For my usages, I would need this to be an absolute path, but that is probably not something Zero should worry about.
There was a problem hiding this comment.
Update: Changing the line to the following works better for me.
$composer = json_decode(file_get_contents(__DIR__.'/../../../../../../composer.json'), true);
Testing this branch now (hydephp/cli@4e2817a), but I'm erroring on this version. It tries to download https://github.com/hydephp/cli/raw/v0.5.2/hyde/builds/hyde instead of https://github.com/hydephp/cli/raw/v0.5.2/builds/hyde Edit: I can at least confirm that this branch makes so I don't get the following error: So this should at least fix laravel-zero/laravel-zero#193 (comment) |
Mine is also a real world project, so 🤷 And then set it as the update strategy: config/updater.php Now the self update from the github releases should work as expected |


This depends on #480 to be merged first. 👍🏻 See 477b05c for the actual changes.
What does this do:
updater.phar_nameconfig key, that, when set, will be used to set the name of the Phar file as stored on GitHub, GitLab, etc.Updater/ProviderThis solution appears to work for resolving the mentioned issue, however it could probably do with some testing elsewhere to ensure it doesn't break any existing applications.
Closes laravel-zero/laravel-zero#459