Skip to content

Support decompressor plugins - #427

Merged
jdleesmiller merged 21 commits into
rubyzip:masterfrom
jspanjers:refactor-decompressor
Feb 1, 2020
Merged

jdleesmiller merged 21 commits into
rubyzip:masterfrom
jspanjers:refactor-decompressor

Conversation

@jspanjers

Copy link
Copy Markdown
Contributor

As suggested in #425, this pull request makes it possible to easily extend rubyzip with additional decompressors.

@coveralls

coveralls commented Jan 5, 2020 •

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.2%) to 95.674% when pulling 0b9433c on jspanjers:refactor-decompressor into 0b79104 on rubyzip:master.

@jdleesmiller jdleesmiller left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR and sorry for the long turnaround. This looks great to me 👍. Just a few suggestions.

I think this could go out in a semver minor version bump, probably 2.2 (I am planning to release 2.1 shortly), because I don't see any breaking changes, except to classes marked with :nodoc:. Does that sound right?

Are you planning on releasing a plugin gem with bzip2 compression support? You can of course keep that under your own namespace, but if you would like it to live under the rubyzip org, we can ask @simonoff about setting that up.

Comment thread lib/zip/inflater.rb Outdated
Comment thread lib/zip/inflater.rb Outdated
Comment thread lib/zip/input_stream.rb

def produce_input
@decompressor.produce_input
@decompressor.read(CHUNK_SIZE)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are quite a few CHUNK_SIZEs with the same value already. I wonder whether using Decompressor::CHUNK_SIZE would be appropriate here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the optimal CHUNK_SIZE for decompressors is dependant on compression method. Thus the Decompressor::CHUNK_SIZE should not exist and be replaced by an implementation dependant CHUCK_SIZE in Inflater.

Therefore, in InputStream, I think it is better to not depend on this Decompressor::CHUNK_SIZE.

@jspanjers

Copy link
Copy Markdown
Contributor Author

I think this could go out in a semver minor version bump, probably 2.2 (I am planning to release 2.1 shortly), because I don't see any breaking changes, except to classes marked with :nodoc:. Does that sound right?

Agreed.

Are you planning on releasing a plugin gem with bzip2 compression support? You can of course keep that under your own namespace, but if you would like it to live under the rubyzip org, we can ask @simonoff about setting that up.

Yes, I am planning to create a bzip2 compression plugin gem, after this pull request is accepted. When the plugin gem is ready, I would very much like to transfer control (and maintainership) to rubyzip.org.

@jspanjers
jspanjers force-pushed the refactor-decompressor branch from 6f90c6e to 0b9433c Compare January 26, 2020 14:38
@hainesr

hainesr commented Jan 26, 2020

Copy link
Copy Markdown
Member

Are you planning on releasing a plugin gem with bzip2 compression support? You can of course keep that under your own namespace, but if you would like it to live under the rubyzip org, we can ask @simonoff about setting that up.

Yes, I am planning to create a bzip2 compression plugin gem, after this pull request is accepted. When the plugin gem is ready, I would very much like to transfer control (and maintainership) to rubyzip.org.

I think developing a collection of plugins under the rubyzip org is a nice idea. It would also be an opportunity to widen the cohort of maintainers of the library and drive more participation.

@jdleesmiller jdleesmiller left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thanks for the updates. Spotted one minor thing but I can fix that post-merge.

Comment thread lib/zip/inflater.rb
retried += 1
retry
end
rescue Zlib::Error => e

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
rescue Zlib::Error => e
rescue Zlib::Error

@jdleesmiller
jdleesmiller merged commit 666fb8c into rubyzip:master Feb 1, 2020
This was referenced Feb 1, 2020
@Kimmie234

Copy link
Copy Markdown

Wallet

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.

5 participants