Commit Graph

240 Commits

Author SHA1 Message Date
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
Pavel Lobashov aa8377624f fix rubocop Style/ClassMethods cop 2015-03-24 19:37:12 +03:00
Pavel Lobashov 1759f71d50 fix rubocop Style/CommentAnnotation cop 2015-03-24 19:36:05 +03:00
Pavel Lobashov ce7e01a206 fix rubocop Style/CommentIndentation cop 2015-03-24 19:31:28 +03:00
Pavel Lobashov 4b60095371 fix rubocop Style/EmptyLines cop 2015-03-24 19:24:51 +03:00
Pavel Lobashov 94c1df1fb5 fix rubocop Style/EmptyLinesAroundAccessModifier cop 2015-03-24 19:24:17 +03:00
Pavel Lobashov f6693aff80 fix rubocop Style/EmptyLinesAroundMethodBody cop 2015-03-24 19:23:54 +03:00
Pavel Lobashov b920a1eb49 fix rubocop Style/GuardClause cop 2015-03-24 19:16:03 +03:00
Pavel Lobashov b9aefaffb5 fix rubocop Style/IfUnlessModifier cop 2015-03-24 19:09:22 +03:00
Pavel Lobashov 23cfcc73b5 fix rubocop Style/MethodName cop 2015-03-24 19:02:54 +03:00
Pavel Lobashov d6cc880c36 fix rubocop Style/MultilineTernaryOperator cop 2015-03-23 19:32:08 +03:00
Pavel Lobashov 8533708ace fix rubocop Style/Not cop 2015-03-23 19:24:34 +03:00
Pavel Lobashov 1ba81ff46f fix rubocop Style/NumericLiterals cop 2015-03-23 19:23:04 +03:00
Pavel Lobashov 77b7d6c35d fix rubocop Style/PercentLiteralDelimiters cop 2015-03-23 19:20:31 +03:00
Pavel Lobashov 6a7a22fece fix rubocop Style/MultilineOperationIndentation cop 2015-03-23 19:10:39 +03:00
Pavel Lobashov 04f69028f9 fix rubocop Style/MultilineBlockLayout cop 2015-03-23 19:08:12 +03:00