Open Danack opened 10 years ago
up
Did you ever find a solution to this? I'm running into the same problem.
@jauzeyimam I just wrote a function to fix the paths:
function fixPaths($outputDirectory, $siteURL) {
$absolutePath = dirname(realpath($outputDirectory));
$src = $outputDirectory."/packages.json";
$text = @file_get_contents($src);
if ($text === false) {
throw new LogicException("Failed to open `packages.json` in directory ".$outputDirectory.". Presumably it wasn't built?");
}
$text = str_replace($absolutePath, $siteURL, $text);
file_put_contents($src, $text);
$src = $outputDirectory."/index.html";
$text = file_get_contents($src);
if ($text === false) {
throw new LogicException("Failed to open `index.html` in directory ".$outputDirectory.". Presumably it wasn't built?");
}
$text = str_replace($absolutePath, "", $text);
file_put_contents($src, $text);
}
Ran into the same exact issue. Even more, the packages.json generated has a the dictionary for "dist" with wrong "url" attributes:
{
"packages": {
"company/sample_package": {
"0.1.1": {
"name": "company/sample_package",
"version": "0.1.1",
"version_normalized": "0.1.1.0",
"dist": {
"type": "zip",
"url": "dist/company-sample_package-0.1.1.zip",
"reference": null,
"shasum": "d67a7d6ccd6bedb823065e360dcd741801e47f82"
},
"type": "library"
}
}
This causes the composer install to not find the package as dist/package_name-0.1.1.zip is obviously a non valid url to download it.
Anybody has run into this? I can fix it by coding a script to fix the url's... but seems like I am missing an option to define my repositories or this is a bug
would be nice to see a fix here in the offical repro
I don't remember this being an issue anymore. I do create zip files, and they have the correct URL. Maybe I use the option to assign an "external" URL, but if this fixes it, why not using it.
Is there a setting to set what directory should be used when generating the url for each package in the packages.json from a satis.json that uses zip artifacts?
e.g. I have a satis config file like:
i.e. all the zip files are in the directory
zipsOutput/packages/
directory and I'm going to generate the satis files into the zipsOutput directory and serve that as the web root.However after generating the satis files, all of the packages have a URL set to the full path in the packages.json like:
"url": "/documents/projects/github/Bastion/Bastion/zipsOutput/packages/zendframework_Component_ZendValidator_2.2.5.zip"
So in the web browser, the files have a url like:
http://localhost:8000/documents/projects/github/Bastion/Bastion/zipsOutput/packages/zendframework_Component_ZendFilter_2.2.5.zip
rather than :
http://localhost:8000/packages/zendframework_Component_ZendFilter_2.2.5.zip
I know there's a setting in 'archive' for when Satis is downloading packages itself, but this seems not to work when it's using artifacts that are already available.