-
Notifications
You must be signed in to change notification settings - Fork 0
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
Distributable zip files cannot be renamed without affecting extraction directory name #5
Comments
@jaswsinc This was a lot easier to solve than I expected. The Phing ZipTask already has a <zip basedir="${project.basedir}" prefix="${project_slug}/" includeemptydirs="false" destfile="${project.basedir}/.~build/${project_slug}.zip"> I noticed there's also an Now when I run the build script, the zip file includes the prefix, which allows us to rename the ZIP file to anything we want without changing the directory name the zip file gets extracted to:
I've made the same updates to the TarTask (exclude empty dirs, use |
@raamdev writes...
Ah, that's cool. Good to know. Thanks! @raamdev writes...
I love it! If you get a chance to note those items in the CHANGELOG.md, I will try to do the same on my end whenever I make changes. See: https://github.com/websharks/phings/blob/master/CHANGELOG.md |
@jaswsinc Done. |
At present, the distributable zip files generated by the build script cannot be renamed to include a version number (e.g., I can't rename
zencache.zip
tozencache-v150605.zip
) because doing so would result in the plugin getting extracted to/zencache-v150605/
instead of/zencache/
in thewp-content/plugins/
directory.What's happening is that Phing is generating a zip file with file paths that do not include a leading directory, i.e., Phing is zipping the contents of
/zencache/
instead of zipping up thezencache
directory itself.We need to modify the build script so that what gets zipped includes the original plugin directory name, so that we can rename the zip files whatever we want without that affecting the name of the directory that the plugin gets extracted to when installed via the WordPress Dashboard.
For more background on this, read on...
When I manually zip up a directory called
zencache/
, the directory name (at the time the zip file was created) get added to the path of each file in the zip:Phing is zipping the contents of the directory, so we end up with zip file that contains file paths without a leading directory (notice there's no leading directory name):
When there's no leading directory name, the zip file gets extracted into a directory that matches the name of the zip file. That means if we rename the Phing-generated zip file to
zencache-v150606.zip
, it will get extracted tozencache-v150605/
.If the zip file was built with a leading directory name (i.e., you zip up a directory vs zipping up a bunch of files), then it doesn't matter what you name the zip file--it will always be extracted to the original name of the directory that was zipped up.
Mystery solved!
The text was updated successfully, but these errors were encountered: