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

Problems when both rubyzip and zipruby installed #6

Closed
wants to merge 3 commits into from

Conversation

mezza
Copy link

@mezza mezza commented May 30, 2011

I've been using rubyzip in a rails application to create custom XLSX files by compressing an expanded XLSX document tree and using ErB to replace the contents of one xml file. However, I've been experiencing a number of issues with Excel complaining about errors with the resulting XLSX file, and so tested expanding and compressing a simple XLSX file to see what happens. I also tried using rubyzip just to replace the contents of one of entries in a zip archive.

It seems that rubyzip is compressing the file in a subtly different manner from that expected by Excel, and the only solution I've found is to use zipruby instead just to modify the contents of the files I want to edit. This works fine.

However both rubyzip and zipruby define Zip::File, and other areas of the application that use other dependent gems, eg roo, have issues with Zip::File.exists? which is defined in both zip gems.

I've tried using Bundler to load gems specific to a given method, but this doesn't seem to work, and so the only other solution that works for me is to explicitly specify the namespace for any ::File method invocations.

This seems to work fine, with tests passing as well.

If you know of any other solutions I'd be interested to know, otherwise I'd request that the changes be pulled.

@joerixaop
Copy link

Is there a reason not to merge this?

@jawspeak
Copy link

jawspeak commented Jan 4, 2012

This would be very useful to merge in, rather than more of us needing to fork and modify rubyzip with this change. Also, it could also be fixed with zipruby changing the module namespace to ZipRuby::* instead of the same Zip::*.

I had the same problem, but solved it the other way. I created a zipruby fork that addresses this problem by renaming the zipruby module Zip::* to ZipRuby::*

https://github.com/jawspeak/zipruby-compatibility-with-rubyzip-fork
use bundle to get it with:
gem "zipruby-compat", :require => 'zipruby', :git => "git@github.com:jawspeak/zipruby-compatibility-with-rubyzip-fork.git", :tag => "v0.3.7"

@rmontgomery429
Copy link

This also addresses a conflict with selenium webdriver. For now I'm just using the mezza fork but it would be nice to see this merged in.

http://code.google.com/p/selenium/issues/detail?id=1003#makechanges

@simonoff
Copy link
Member

I cannot merge this pull automatically.
But I can fix ::File conflict and close this pull request.

@simonoff simonoff closed this in 0282627 Jan 31, 2012
@mezza
Copy link
Author

mezza commented Feb 8, 2012

Thanks for merging this in! Could you publish a new release of the gem please?

@tamird
Copy link

tamird commented Oct 23, 2013

This issue should be reopened. The issue was reintroduced with 61ce5db and Zip::File is now again defined by both rubyzip and zipruby. This causes more problems :(

@simonoff

@simonoff
Copy link
Member

Why using rubyzip and zipruby in one project? zipruby is outdate library. Last release was January 23, 2010.

@tamird
Copy link

tamird commented Oct 23, 2013

The comments in my code indicate that rubyzip does not allow you to mutate files entirely in memory. If you have sensitive data, you cannot let it touch the disk. Has this changed?

@simonoff
Copy link
Member

master branch of rubyzip has support of StringIO so you can working with zip archives in memory.

@tamird
Copy link

tamird commented Oct 23, 2013

is that ready for release?

@simonoff
Copy link
Member

can you test master branch? I want to have more users who using rubyzip with StringIO. Probably release ready but i need to be sure.
Thank you!

@vyshnevska
Copy link

guys) have huge problems with these both gems :(
Erorr: undefined method `lstat' for Zip::File:Class

Please help me!!!

muz pushed a commit to muz/rubyzip that referenced this pull request Aug 6, 2014
Fixed bug with checking for password= function
fbvilela pushed a commit to ipropertyau/zipruby-compat that referenced this pull request Nov 25, 2014
This is so that zipruby can interoperate with rubyzip. Previously, both defined Zip::File.

That was not cool, because if you had a project that used rubyzip, when you introduced rubyzip, then it will no longer work. You'd get errors like this: "undefined method `exists?' for Zip::File:Class"

Another workaround is rubyzip/rubyzip#6 where they describe changing rubyzip.
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

Successfully merging this pull request may close these issues.

None yet

7 participants