wycats / rake-pipeline-web-filters

MIT License
116 stars 36 forks source link

add gzip filter #26

Closed tkellen closed 12 years ago

tkellen commented 12 years ago

It works great, except for an issue in the spec with MemoryFileWrapper saying the output file is UTF when it should be BINARY. Someone who is a little more familiar with the internals could probably fix this in a few seconds.

dudleyf commented 12 years ago

If a filter outputs binary data, you need to call processes_binary_files in the class to declare that its output is encoded as BINARY.

tkellen commented 12 years ago

I thought that was only in reference to the input files (which usually shouldn't be binary). I will check that out when I get back in tonight.

Thanks!

On Mar 18, 2012, at 2:11 PM, Dudley Flanders reply@reply.github.com wrote:

If a filter outputs binary data, you need to call processes_binary_files in the class to declare that its output is encoded as BINARY.


Reply to this email directly or view it on GitHub: https://github.com/wycats/rake-pipeline-web-filters/pull/26#issuecomment-4563485

tkellen commented 12 years ago

That did fix the issue with the encoding format of the output file, but now gzip is returning slightly different data for every run, which makes the test fail. Any suggestions?

dudleyf commented 12 years ago

Sounds bad. I don't see anything obviously jumping out at me, I'll have to take a closer look when I get a chance.

dudleyf commented 12 years ago

According to http://www.ruby-forum.com/topic/133553, GzipWriter includes the file's mtime in the compressed data, so, since we're generating a new (in-memory) file on every test run, we get different results every time. Maybe in the spec you should uncompress the data and compare that to the original data?

tkellen commented 12 years ago

Ah-ha. I've updated the test to support this.