Commit Graph

1244 Commits

Author SHA1 Message Date
Robert Haines e10badf68e Fix Style/FrozenStringLiteralComment cop. 2021-05-25 21:24:50 +01:00
Taichi Ishitani 0e4dc676a0 fix frozen string literal error 2021-05-25 21:24:50 +01:00
Robert Haines 6f929b603f Configure Layout/EmptyLineBetweenDefs cop. 2021-05-25 21:24:50 +01:00
Robert Haines 3d33e4a8e0 Update Rubocop version.
Now using as late a version as we can for Ruby 2.4.
2021-05-25 21:24:50 +01:00
Robert Haines f1e73b047e Tidy up dependencies in gemspec. 2021-05-25 21:24:50 +01:00
Robert Haines cb69bd520f Update Changelog. 2021-05-25 19:58:08 +01:00
Robert Haines 3b3b932f2d No longer need to turn on `objectspace` in JRuby. 2021-05-25 19:53:42 +01:00
Benoit Daloze af716bef32 Refactor assert_forwarded so it does not need ObjectSpace._id2ref or eval 2021-05-25 19:24:11 +01:00
Robert Haines f0b50d3c6c Add JRUBY_OPTS=--debug to the CI environment. 2021-05-19 22:23:54 +01:00
Robert Haines db3ce93027 Add coveralls integration to the GitHub CI Action.
Fixes #480.
2021-05-19 21:39:53 +01:00
Robert Haines 3958039497 Name the steps in the linter Action.
To match those of the tests Action.
2021-05-18 23:12:51 +01:00
Robert Haines 43d9984044 Install zip for the Windows CI test Action.
And remove hardcoded paths for zip in the tests.
2021-05-18 23:05:35 +01:00
Robert Haines 8702876e55 Set the default `Entry` time to the file's mtime on Windows.
For some reason this was being skipped on Windows, but not Linux or
MacOS.
2021-05-18 21:59:54 +01:00
Robert Haines df9d39730e Add macos and windows tests to Actions.
Just one run of each for now should be enough. Allow windows tests to
fail for now as our tests are broken there at the moment.
2021-05-18 21:33:42 +01:00
Robert Haines bae056efb4 Optimise the GitHub Actions tests workflow. 2021-05-18 21:12:49 +01:00
Robert Haines 34237efc00 Ensure that `Entry#time=` sets times as `DOSTime` objects.
Fixes #481.
2021-05-18 19:57:03 +01:00
Robert Haines 25795c7b0e Update Changelog with some recent merged PRs. 2021-05-18 19:24:47 +01:00
Robert Haines 2b2e0ee568 Bump version to 3.0.0.
There are breaking changes in the recent PRs that have been merged.
2021-05-18 19:23:56 +01:00
Robert Haines 1f5aa84738 Update maintainer information in the README. 2021-05-17 20:21:24 +01:00
Robert Haines 5c8bb1c4a0 Update CI information in the README. 2021-05-17 20:21:00 +01:00
Robert Haines 4ed35cae94 DosTime#<=> should return `nil` if other is not comparable. 2021-05-17 19:57:16 +01:00
Robert Haines 6e9f2976d1 Add temporary fix for JRuby to workaround Time cmp bug.
Workaround jruby/jruby#6668 until fix is released.

Version 9.2.18.0 is hopefully the version that will fix this, but we can
adjust the version accordingly if not.
2021-05-17 19:55:13 +01:00
Robert Haines 65886ac875 Add GitHub actions badges to the README. 2021-05-17 12:49:49 +01:00
Robert Haines 6536b96458 Turn off fail-fast for the CI tests action. 2021-05-17 12:39:18 +01:00
Robert Haines e24f191222 Add some head versions to CI action and allow errors. 2021-05-16 23:24:50 +01:00
Robert Haines 25ce623d13 Add a GitHub action for CI tests. 2021-05-16 21:36:04 +01:00
Robert Haines fd510e07eb Add a GitHub action for linting. 2021-05-16 19:43:27 +01:00
Oleksandr Simonov 7f3bb29487
Merge pull request #464 from hainesr/remove_dosequals
Replace and deprecate `Zip::DOSTime#dos_equals`.
2021-05-03 10:22:13 +03:00
Oleksandr Simonov ef16746cd3
Merge pull request #473 from hainesr/fix-comp-tests
Fix the compression level tests to compare relative sizes.
2021-05-03 10:21:07 +03:00
Oleksandr Simonov f17335459a
Merge pull request #474 from taichi-ishitani/add_ruby30_to_ci
add Ruby 3.0 to CI
2021-05-03 10:20:31 +03:00
Taichi Ishitani 6b656d3277 add Ruby 3.0 to CI 2021-03-06 00:11:47 +09:00
Robert Haines 9da6be98d8 Fix the compression level tests to be relative.
Made little sense to use hardcoded bytes sizes; the tests end up too
brittle.
2021-02-16 13:21:24 +00:00
Oleksandr Simonov 67339da9d1
Merge pull request #470 from bbuchalter/simplify_assertions_in_basic_zip_file_test
Simplify assertions in basic_zip_file_test
2021-02-14 14:29:21 +02:00
Oleksandr Simonov b6eae4f9d8
Merge pull request #468 from bbuchalter/remove_compare_enumerables
Remove compare_enumerables from test_helper.rb
2021-02-14 14:28:19 +02:00
Oleksandr Simonov bdef2137d9
Merge pull request #448 from hainesr/compression_level
Set compression level on a per-zipfile basis.
2021-02-14 14:26:27 +02:00
Oleksandr Simonov a0345420d8
Merge branch 'master' into compression_level 2021-02-14 14:26:12 +02:00
Oleksandr Simonov e397af3e0d
Merge pull request #447 from jlahtinen/fix_zlib_deflate_buffer_growth
Fix zlib deflate buffer growth
2021-02-14 14:24:36 +02:00
Oleksandr Simonov 9f29d09e02
Merge pull request #462 from hainesr/fix-zis-partial-read
Fix input stream partial read error.
2021-02-14 14:23:13 +02:00
Oleksandr Simonov 410daad1ac
Merge pull request #459 from hainesr/fix-extra-fields
Fix loading extra fields
2021-02-14 14:22:38 +02:00
Oleksandr Simonov 1440947a13
Merge pull request #458 from kenhys/fix-spdx-id
Use correct SPDX license identifier
2021-02-14 14:21:10 +02:00
Brian Buchalter 2c4de67d9f Simplify assertions in basic_zip_file_test
We can get the same strength of assertions with less code. Also, by
using assert_equal instead of assert, we get better feedback when
assertion does not meet expectations.
2021-01-26 07:54:23 -07:00
Brian Buchalter 72cedd7ce4 Remove compare_enumerables from test_helper.rb
This change has several benefits:
* When errors occur, the test provides useful feedback, showing you
  expected vs. actual.
* We no longer need to open and modify the Enumerable module.
* The test is more readable.
2021-01-26 06:19:26 -07:00
Robert Haines 5a4d1d8b6b Replace and deprecate `Zip::DOSTime#dos_equals`.
Having a specific 'does this instance equal another instance' method is
kind of annoying and breaks a number of things. Most obviously it breaks
comparing to `nil`: `nil.dos_equals(other)` will fail where
`nil == other` does not.

So this commit overrides `<=>` in `Zip::DOSTime` and deprecates
`dos_equals`.
2020-11-28 21:19:58 +00:00
Robert Haines 0a6037b0ad Update Changelog.md. 2020-11-08 17:51:57 +00:00
Robert Haines 2ea805c951 Check `number_of_bytes` before comparison in read.
If an input stream has been read from, and left some data in the
internal buffer, then a subsequent `read`, with no amount of bytes to be
read having been specified, will raise an error when comparing to `nil`.
This fix checks that the number of bytes specified in the `read` is not
`nil` before comparing with the size of the internal buffer.

Fixes #461.
2020-11-08 17:20:53 +00:00
Robert Haines ac89366902 Failing test to catch error on read after readline. 2020-11-08 17:19:49 +00:00
Robert Haines 0235e76bae Test packing the NTFS extra field. 2020-10-03 18:27:20 +01:00
Robert Haines 8bafcbbc4d Remove dead code in extra_field/generic.rb (`==`).
From what I can tell this was erroneously copied out of extra_field.rb
during a refactor. It attempts to compare a non-existent Hash that used
to be inherited before the refactor. If this code had been left within
ExtraField it would make more sense, but as it's not needed there either
let's just remove it.

See 20d79feb99 for the refactor.
2020-10-03 18:27:20 +01:00
Robert Haines a668fd14d2 Test reading an extra field with a bad header ID. 2020-10-03 18:27:20 +01:00
Robert Haines c2b9aa2893 Correctly read extra fields when opening a zip file.
Previously, only the extra fields stored in the central directory were
being read in. In reality it is often the case that the extra field in
the central directory is just a marker, and the full data is in the
local header. So we need to read both in and merge the two into the
final correct extra field. This merging infrastructure was already
implemented in the extra field code but we never actually read the
local extra fields in until now.

Reading the central directory headers and local entry headers seems
rather fragile, so we can't just read one over the other and hope to end
up with a correctly merged set of extra fields because this breaks other
things. So we need to specifically read the local extra field data and
merge just those bits.

This commit also fixes a couple of tests that were 'broken' by us now
reading extra fields in correctly!
2020-10-03 18:27:20 +01:00