Commit Graph

455 Commits

Author SHA1 Message Date
Robert Haines 8fa35de528 Fix Style/FormatStringToken cop. 2021-05-25 21:24:50 +01:00
Robert Haines e2c16991e5 Fix Style/Dir cop. 2021-05-25 21:24:50 +01:00
Robert Haines deac4fa313 Fix Style/CommentAnnotation cop. 2021-05-25 21:24:50 +01:00
Robert Haines 606b5ffbb2 Fix Lint/EmptyBlock cop. 2021-05-25 21:24:50 +01:00
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 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 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 34237efc00 Ensure that `Entry#time=` sets times as `DOSTime` objects.
Fixes #481.
2021-05-18 19:57:03 +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
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 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
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
Brian Buchalter 68b9ed4cfe Remove OUTPUT_FIELD_SEPARATOR-related test behaviors
Since modifying OUTPUT_FIELD_SEPARATOR is deprecated, there's no need
for us to do this in our test.
2021-01-26 04:41:51 -07:00
Brian Buchalter 0585e4e36b Set OUTPUT_FIELD_SEPARATOR to nil in test
As discussed in https://bugs.ruby-lang.org/issues/14240 and implemented
in 6298ec2875
setting OUTPUT_FIELD_SEPERATOR to a non-nil value is now depricated.
2021-01-26 04:36:13 -07:00
Brian Buchalter adfd15a1c6 Prefer OUTPUT_RECORD_SEPARATOR to $\ 2021-01-26 04:35:21 -07:00
Brian Buchalter 4dc308caed Prefer OUTPUT_FIELD_SEPARATOR to $, 2021-01-26 04:34:45 -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 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 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
Robert Haines b00c47a047 Add a failing test for reading local extra fields. 2020-09-20 14:41:24 +01:00
Robert Haines cf3f4339f6 Make sure that compression method is STORE for level 0.
Whatever the compression method that is set by the user, if the
compression level is set to 0 (no compression), then the entry should be
STORED. This mimics commandline tool behaviour and matches user
expectations.
2020-08-31 17:48:08 +01:00
Robert Haines 5201cd2ea3 Make sure tests that change Zip defaults reset properly. 2020-08-31 17:48:08 +01:00
Robert Haines e4ceedaa58 Use keyword arguments for the `Entry` initializer.
This greatly simplifies the creation of `Entry` objects when only a
couple of fields are not set to their defaults, while at the same time
allowing an `Entry` to be fully configured at creation time if
appropriate.

This fundamentally changes the `Entry` API and  means that some
convenience methods in `OutputStream` and `File` have needed to be
refactored.
2020-08-31 17:48:08 +01:00
Robert Haines 2775f529b4 Set the compression level general purpose flags. 2020-08-31 17:48:08 +01:00
Robert Haines d4bc24dcb3 Clean up `OutputStream` internals.
There was some fairly odd stuff going on in `put_next_entry` that
allowed for data within an `Entry` to be overridden and prevented an
`Entry` from being a single point of truth. Fixing this also simplifies
the code within `File` and still passes all tests.

Also, fixing the above means we can stop passing the compression level
around as a parameter and use the value stored in each `Entry` directly.

Let's keep `compression_level` out of the `Entry` public API though as
it only makes sense when writing an `Entry`: there doesn't seem to be an
obvious way to read what level of compression was used when reading an
`Entry` from a zip file.
2020-08-31 17:48:08 +01:00
Robert Haines 14451e63e7 Add setting a compression level to the File options.
It looks like it needs to be surfaced in `add` and `get_output_stream`.
The compression level defaults to whatever the global default is unless
it is overridden on opening the Zip::File.

Also needed to reorder some of the requires in the top-level module file
now that we are using defaults in the File class.
2020-08-31 17:48:08 +01:00
Robert Haines ef520b4b94 Add `compression_level` to the Entry API.
Allow an Entry to specify a compression level and pass this down to the
underlying OutputStream infrastructure. OutputStream has been able to
specify a compression level for a while but this has, up until now, only
ever been set to the default.

This fundamentally changes the API so will need a major version bump.
2020-08-31 17:48:08 +01:00
Joni Lahtinen 99d8f59eaf Change encryption_test less implementation specific
Seems like zlib deflate compress differently when Zlib::SYNC_FLUSH is
used.
2020-04-29 16:41:21 +03:00
Lucas Kanashiro 262ba001a4 test/file_extract_test.rb: fix test_extract_incorrect_size in s390x arch
Using the current pack directives makes test_extract_incorrect_size fail
in s390x architecture because of the endian probably. This is the output
of the command executed by the test in amd64:

irb(main):001:0> [501, 500000, 1].pack('LLS')
=> "\xF5\x01\x00\x00 \xA1\a\x00\x01\x00"

And the output of the same command in s390x:

irb(main):001:0> [501, 500000, 1].pack('LLS')
=> "\x00\x00\x01\xF5\x00\a\xA1 \x00\x01"

Changing to 'VVv' pack directives like is used in
lib/zib/entry.rb fixes the test in s390x and does not add a
regression in amd64.
2020-04-04 11:44:27 -03:00
John Lees-Miller 4c789c2821 Remove unused constant from #439 2020-03-14 11:00:39 +00:00
John Lees-Miller fabacf1633
Merge pull request #440 from hainesr/rubocop-names
Rubocop name cops
2020-03-14 10:58:54 +00:00
Sebastian Henke e33c07a6e7
Use existing constant for ASCII_8BIT
Co-Authored-By: John Lees-Miller <jdleesmiller@gmail.com>
2020-03-02 11:00:39 +01:00
Robert Haines ce17c57e2d Fix Naming/AccessorMethodName in the tests.
This was kind of a misfire of this cop, but no bother to change.
2020-02-29 18:11:52 +00:00
Robert Haines e6f414f539 Fix Naming/VariableName cop in the tests. 2020-02-29 18:11:52 +00:00
Robert Haines b09f05d8d3 Fix Naming/MethodParameterName cop in the tests. 2020-02-29 18:11:52 +00:00
Sebastian Henke b0ee2683b0 Set buffers to binmode by default 2020-02-19 18:48:13 +01:00
Robert Haines 846e704048 Fix Naming/BlockParameterName cop. 2020-02-17 22:35:08 +00:00
Robert Haines c31ab81cf6 Fix Style/NumericLiterals cop. 2020-02-15 16:26:32 +00:00
Robert Haines fae95e3c29 Fix Style/NumericLiteralPrefix cop. 2020-02-15 16:26:32 +00:00
Robert Haines 4b8f74042a Fix Layout/EmptyLinesAroundClassBody cop. 2020-02-15 16:26:32 +00:00
Robert Haines 5ce4e13ddd Configure and fix Style/ClassCheck cop. 2020-02-15 16:26:32 +00:00
Robert Haines 6cab5922bc Configure and fix Metrics/LineLength cop.
Set a workable line length for now, and fix a couple of particularly bad
examples.

Also, turn off for the tests.
2020-02-15 16:26:32 +00:00
Robert Haines 0df6cb3059 Fix Style/SymbolProc cop. 2020-02-15 16:26:32 +00:00
Robert Haines bb3b4474fa Fix Style/SpecialGlobalVars cop. 2020-02-15 16:26:32 +00:00
Robert Haines 2cbdbf110b Fix Style/SignalException cop. 2020-02-15 16:26:32 +00:00
Robert Haines 2dc9b49568 Fix Style/EvalWithLocation cop. 2020-02-15 16:26:32 +00:00
Robert Haines 2e11a88fd2 Fix Style/StringLiterals cop. 2020-02-15 16:26:32 +00:00
Robert Haines 45f4c2dc29 Fix Style/GuardClause cop. 2020-02-15 16:26:32 +00:00
Robert Haines b3c4c37882 Fix Style/NonNilCheck cop.
Use the `refute_nil` method for most of these.
2020-02-15 16:26:32 +00:00
Robert Haines 19aa7e834c Fix Style/RescueStandardError cop. 2020-02-15 16:26:32 +00:00
Robert Haines 68259ed7b0 Fix Style/Encoding cop. 2020-02-15 16:26:32 +00:00
Robert Haines 61c83b2a1a Configure Layout/HashAlignment cop. 2020-02-15 16:26:32 +00:00
Robert Haines cfe4972e71 Fix Layout/EmptyLineAfterGuardClause cop. 2020-02-15 16:26:32 +00:00
Robert Haines 23ba1af4fb Fix Lint/RescueException cop. 2020-02-15 16:26:32 +00:00
Robert Haines cd065d0186 Fix Lint/UnusedBlockArgument cop. 2020-02-15 16:26:32 +00:00
Robert Haines 20743a53b2 Fix Lint/AmbiguousBlockAssociation cop. 2020-02-15 16:26:32 +00:00
Robert Haines e7275dad93 Fix Style/BlockDelimiters cop errors. 2020-02-15 16:26:32 +00:00
Robert Haines 3a3ac6feb7 Fix Style/Semicolon cop. 2020-02-15 16:26:32 +00:00
Robert Haines f1154c2eca Fix Style/OrAssignment cop. 2020-02-15 15:56:17 +00:00
Robert Haines 73e405acef Fix Security/Open cop errors. 2020-02-15 15:56:17 +00:00
Robert Haines c8bfd14764 Update rubocop version and the config files.
Also rename .rubocop_rubyzip.yml to be consistent with Rubocop default
setup.
2020-02-15 15:56:17 +00:00
Jan-Joost Spanjers 0b9433c3b2 Add test for unsupported decompression, e.g bzip2 2020-01-26 15:34:17 +01:00
Jan-Joost Spanjers a5d068d3e8 Support Decompressor plugins 2020-01-26 15:34:17 +01:00
Jan-Joost Spanjers 2b7268373a Define compression methods 2020-01-26 15:34:17 +01:00
Jan-Joost Spanjers c66277db58 Rename Decompressor#sysread to #read 2020-01-26 15:34:17 +01:00
Jan-Joost Spanjers b80ce3cc57 Make decryption generic for all compression methods
Now, STORED files can be decrypted, just like DEFLATED files.
2020-01-26 15:34:17 +01:00
Jan-Joost Spanjers 8f7c5caf29 Drop #produce_input from Decompressor class 2020-01-26 15:34:17 +01:00
Jan-Joost Spanjers 1b6aeb2cd0 Replace Decompressor#input_finished? with #eof 2020-01-26 15:34:17 +01:00
Jan-Joost Spanjers e072c57beb Add Entry#incomplete? 2020-01-26 15:34:17 +01:00
Jan-Joost Spanjers c897bbdf77 Add Entry#encrypted? 2020-01-26 15:34:17 +01:00
Jan-Joost Spanjers 0b7b78dc4a Encapsulate Zlib errors within DecompressionError 2020-01-26 15:34:13 +01:00
Jan-Joost Spanjers e50fa4a97b Remove unused variables from deflater_test 2020-01-05 14:24:46 +01:00
Robert Haines d0b4d41ff1 UniversalTime: tests. 2019-12-15 22:37:29 +00:00
Robert Haines f3a2f4a8ec Add tests for File#get/find_entry. 2019-10-31 18:15:17 +00:00
Robert Haines cef3bc0784 A test to ensure find/get entry calls agree. 2019-10-31 17:27:19 +00:00
Robert Haines 1a21f39e82 Add a test for restoring file permissions on extract. 2019-10-20 19:30:34 +01:00
Robert Haines 8c694d38ee Add functionality to restore file timestamps.
There has been an option in `Zip::File` (`:restore_times`) for a long
time, but it seems it has never worked. Firstly the actual timestamp of
an added file wasn't being saved, and secondly an extracted file wasn't
having its timestamp set correctly.

This commit fixes both of those issues, and adds tests to make sure.
2019-10-20 19:30:27 +01:00
Robert Haines ccabd94e42 Update tests to check error messages.
Check that they say the right things and are on stderr, not stdout. A
nice side effect of this is that it cleans up the test output.
2019-10-13 15:40:49 +01:00
Robert Haines 935a4f31a2 Make warning messages consistent.
And fix a few spelling mistakes.
2019-10-12 12:52:04 +01:00
Robert Haines e87184200a Require 'tmpdir' only in the tests.
It's not used in the library code.
2019-09-27 16:28:02 +01:00
John Lees-Miller 4167f0ce67 Validate entry sizes when extracting 2019-09-15 15:11:35 +01:00
John Lees-Miller 93505ca16f Check expected entry size in add_stored test 2019-09-15 14:58:13 +01:00
Robert Haines ecb2776218 Zip::File.add_stored() to add uncompressed files.
Adding uncompressed files to a zip archive can be overly complex, so
this convenience method makes it easier.
2019-09-14 13:58:30 +01:00
John Lees-Miller 9a41ce65c4 Add more explicit test for #280 2019-09-06 17:58:38 +01:00
John Lees-Miller eeef5073d5 Add test case based on #146 2019-09-05 19:00:34 +01:00
John Lees-Miller 7fbaf1e6c0
Merge pull request #360 from hainesr/fix-open-buffer
Fix #280 - `open_buffer` mangles the content of the buffer it is given.
2019-09-05 18:48:39 +01:00
John Lees-Miller ad15c3c494 Allow tilde in zip entry names
Use absolute_path rather than expand_path to allow tilde to pass through
unchanged. Otherwise, we try to expand it to a home directory.
2019-03-22 16:30:25 +02:00
John Lees-Miller fd81bd523c Bump version to 1.2.2 2018-08-27 09:07:21 +01:00
John Lees-Miller ffb374c6b1 Bump version to 2.0.0 2018-08-27 08:37:53 +01:00
John Lees-Miller 3dd165b494 Disable symlinks and check for path traversal 2018-08-26 14:21:38 +01:00
John Lees-Miller ffebfa3418 Consolidate path traversal tests 2018-08-26 12:13:12 +01:00
John Lees-Miller 9c468f30f3 Add jwilk's path traversal tests 2018-08-26 10:00:35 +01:00
Bart de Water 8e78311d67 Fix CVE-2018-1000544 symlink path traversal
Not sure if the exception is the right way to go
2018-08-23 18:14:48 -04:00
Bart de Water 6e0d23178a Fix CVE-2018-1000544 absolute path traversal
Small refactor along the way to centralize destination handling when no explicit path is given and a potential malicious one from the zipfile is used
2018-08-23 18:14:48 -04:00
Robert Haines aa6284db7a When globbing in ZipFSDir, take CWD into account. 2018-04-30 20:06:21 +01:00
Robert Haines 1673da744d Pass glob through from ZipFileNameMapper.
Just pass the basic glob straight through to the underlying Zip::File
implementation.
2018-04-30 19:59:02 +01:00
Oleksandr Simonov 8887b70349
Merge pull request #361 from hainesr/quiet-tests
Turn off all terminal output in all tests.
2018-04-23 22:18:31 +03:00
Robert Haines cd7bb142a4 Turn off all terminal output in all tests.
Makes things a lot easier when trying to track down bugs.
2018-04-04 19:45:54 +01:00
Robert Haines 84c208982f Switch newly created StringIOs to binmode.
StringIO objects created within File.open_buffer were not being switched into
binmode, but those passed in were. Fix this inconsistency and add a test.
2018-04-04 16:02:19 +01:00
Robert Haines 15ccc25da1 Fix File.open_buffer when no changes are made.
Things are now more carefully set up, and if a buffer is passed in which
represents a file that already exists then this is taken into account. All
initialization is now done in File.new, rather than being split between there
and File.open_buffer.

This has also needed a bit of a re-write of Zip::File.initialize. I've tried to
bring some logic to it as a result, and have added comments to explain what is
now happening.
2018-04-04 15:54:12 +01:00
Andrew Meyer c787d94852 Handle stored files with general purpose bit 3 set
Signed-off-by: Sam Coward <scoward@pivotal.io>
2018-04-03 16:07:18 -04:00
Phil 792266dbf3 Added fix for calling 'close' on a StringIO-backed zip file, and specs 2018-02-21 11:48:56 -08:00
Alexey Sorokin deb6616c5f Merge branch 'master' into force-entry-names-encoding-option 2017-10-18 19:24:58 +03:00
Alexey Sorokin a9f020c0a0 add option to force entry names encoding
if you need to work with existing zip files which contain names with
non-ascii characters then you can specify this option.
Without this option find_entry will not work properly
2017-10-18 18:20:56 +03:00
Takumasa Ochi cf91112b57 Apply automatic correction by rubocop 2017-06-29 11:57:12 +09:00
Alexander Simonov df8dfbcff3 Merge pull request #314 from mwlang/bugfix/open_buffer_without_block
allows open_buffer to work without a given block
2017-02-08 13:16:06 +02:00
mwlang 14b8fed18c allows open_buffer to work without a given block 2017-01-16 13:24:22 -06:00
Koichi ITO 960414aff0 Fix warnings: `constant ::Fixnum is deprecated` in Ruby 2.4 2017-01-08 16:41:23 +09:00
Koichi ITO 33d0949902 Fix warnings: `Use assert_nil if expecting nil` 2017-01-08 15:31:51 +09:00
David Rodríguez f157dfc1b6 Revert "Cleanup after ourselves"
This reverts commit 6597af1257 since
7caab1f already fixed the same thing. It should fix the build.
2016-11-10 08:23:34 -02:00
Alexander Simonov a0cf673186 Merge pull request #300 from hainesr/fix-create-perms
Fix permissions on new zip files (#294)
2016-11-09 22:19:04 +02:00
Alexander Simonov 82fa57cc83 Merge pull request #303 from deivid-rodriguez/extended_globbing
Extended globbing
2016-11-09 22:17:17 +02:00
David Rodríguez 9c475f5160 Add extended globbing support 2016-10-08 19:32:53 -03:00
David Rodríguez 6597af1257 Cleanup after ourselves
Otherwise tests leave an empty file there.
2016-10-08 19:23:45 -03:00
David Rodríguez 366a1d8dca Fix test failure when running a single test file
```
bundle exec rake TEST=test/file_test.rb
```

was giving

```
  1) Error:
ZipFileTest#test_get_output_stream:
NameError: uninitialized constant ZipFileTest::ZipEntryTest
    .../test/file_test.rb:59:in `block in test_get_output_stream'
    .../lib/zip/file.rb:102:in `open'
    .../test/file_test.rb:45:in `test_get_output_stream'
```
2016-10-08 19:21:30 -03:00
Robert Haines fc23f68f77 Refactor the create logic in Zip::File.
Make the internal @create varible more consistent and actually match the
documentation.

Zip::File::CREATE is now true, rather than 1.

A new test is added to check if passing 1 in still works to ensure backwards
compatibility.
2016-09-05 15:16:57 +01:00
Robert Haines b005c487b4 Clean up file permissions tests.
Now we don't differentiate between Windows and Linux in the library code for
this, we don't need separate tests.
2016-09-01 12:15:30 +01:00
Robert Haines 7caab1f467 Clean up empty.zip after running tests.
After running the tests there was a file left in the project directory,
'empty.zip', which was simply 'touch'ed to use as a null file. Switch to create
this as one of the generated test files so it's cleaned up automatically.

Also, use 'null.zip' as the name as there is already an 'empty.zip' generated
that is a zip file, but empty.
2016-08-28 12:17:17 +01:00
Marcos Wright-Kuhns 4b27538818 Add a test helper for more human-readable file permission comparison
Before this change:
  1) Failure:
FilePermissionsTest#test_umask_027 [/Users/marcoswk/workspace/rubyzip/test/file_permissions_test.rb:52]:
Expected: 33184
  Actual: 33183

After this change:
  1) Failure:
FilePermissionsTest#test_umask_027 [/Users/marcoswk/workspace/rubyzip/test/file_permissions_test.rb:52]:
--- expected
+++ actual
@@ -1,2 +1,2 @@
 # encoding: US-ASCII
-"100640"
+"100637"
2016-06-30 14:47:41 -07:00
Marcos Wright-Kuhns 046b7f8f86 Add a failing test when the umask is 0027
This test fails because in *NIX when the umask is 0027, files are created with 0640 permissions. The current implementation of Zip::File.create_file_permissions does a simple subtraction of 0666 - 0027 == 0637
2016-06-30 14:43:52 -07:00
Marcos Wright-Kuhns b6896c4de3 Switch file_permission_test.rb to compare with File.open perms
...instead of comparing against in-ruby subtraction math.
2016-06-30 14:41:27 -07:00
Alexander Simonov 972749c518 Merge pull request #263 from ShockwaveNN/feature/fix-warn-date-tests
Add correct test for `Zip.warn_invalid_date` attribute
2016-01-05 00:37:17 +02:00
Oleksandr Avoiants 73bfa5955c Fix TypeError: can't dup NilClass from EntrySet#dup 2015-12-19 11:26:20 +02:00
Pavel Lobashov bee921b6fb Add actual verification to tests for `Zip.warn_invalid_date` attribute 2015-12-18 16:41:00 +03:00
Alexander Simonov 8447f0e230
Fix #252 2015-11-21 12:07:30 +02:00
Victor Costan 77acc03ddb Fix exception due to calling empty? on nil. 2015-09-30 03:57:21 -04:00
Seth Kingsley 05a9ba3f20 Use duck typing to detect IO-like objects. 2015-09-03 06:16:32 -07:00
Seth Kingsley 1a028fcbaa Fix name collision in test class. 2015-09-03 06:14:23 -07:00
Claire Pitman a1f75a3ab9 Added error for empty (zero bit) zip file. Added tests for empty and non existant zips 2015-07-27 23:20:59 -07:00
Victor Costan 37a5baad96 Accept StringIO in Zip.open_buffer. 2015-07-02 14:17:17 -04:00
Robert Haines 9acc50f004 Do something more expected with new file permissions.
Instead of inheriting the permissions from the tmp directory, new files should
have permissions that reflect the defaults on the system taking umask into
account.

It seems that (unix) permissions of 666 - umask are as close to a standard as
anything [1] and that 'touch' uses this. On Windows it seems sensible to just
use 644 directly [2].

[1] http://unix.stackexchange.com/a/102080
[2] http://ruby-doc.org/core-1.9.3/File.html
2015-06-24 18:25:22 +01:00
Pavel Lobashov 1e99ff69b9 Revert "fix rubocop cop Style/ClassCheck". It cause regression in tests
This reverts commit 8c13dfc265.
2015-06-08 10:45:23 +03:00
Pavel Lobashov 8c13dfc265 fix rubocop cop Style/ClassCheck 2015-06-08 10:36:41 +03:00
Pavel Lobashov 4c81b1151a fix rubocop cop Style/NilComparison 2015-06-08 10:30:12 +03:00
Pavel Lobashov 13658b0586 fix rubocop cop Style/NonNilCheck 2015-06-08 10:29:08 +03:00
Pavel Lobashov 37ede3cd61 fix rubocop cop Style/SingleSpaceBeforeFirstArg 2015-06-08 10:27:21 +03:00
Pavel Lobashov 68181da2c7 fix rubocop cop Style/TrailingBlankLines 2015-06-08 10:24:36 +03:00
Pavel Lobashov c0177a455b Merge branch 'master' into rubocop_fixes
Conflicts:
	README.md
	samples/example_recursive.rb
2015-06-08 10:14:25 +03:00
Sim Kern Cheh 34899f3a80 Fix Recursive zipping example
- Minor refactoring
- Rubify Java-ish code
- Fix issue with `::Zip` reference
- Add test to ensure integrity
2015-06-01 13:22:04 +08:00
Pavel Lobashov e211434830 fix rubocop Lint/UnusedBlockArgument cop 2015-03-24 19:48:37 +03:00