Robert Haines
03633933eb
No need to require stringio in Zip::File.open_buffer.
...
It's already required in zip.rb.
2018-04-04 14:31:34 +01:00
Robert Haines
cfa9441914
Handle passing an IO to Zip::File.new better.
...
This now actually extracts the path from the IO if one is passed in.
2018-04-03 23:48:54 +01:00
Robert Haines
7cd263e6a0
Clean up use of file_name in Zip::File::initialize.
2018-04-03 23:45:04 +01:00
Phil
792266dbf3
Added fix for calling 'close' on a StringIO-backed zip file, and specs
2018-02-21 11:48:56 -08:00
Takumasa Ochi
cf91112b57
Apply automatic correction by rubocop
2017-06-29 11:57:12 +09:00
mwlang
14b8fed18c
allows open_buffer to work without a given block
2017-01-16 13:24:22 -06:00
Robert Haines
c00d767533
Fix rubocop offence caused by temp files changes.
2016-09-05 17:34:12 +01: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
63ed0d970b
Refactor the code which manages temp files.
...
Combine the creation of the temporary filename with the writing to it.
2016-09-05 15:07:18 +01:00
Robert Haines
7b14d11c00
Stop using 0600 perms for temporary files.
...
This fixes #294 in what I hope is a more sensible way than trying to mess with
umasks, etc, directly.
Temporary files were being created with 0600 permissions and then being set to
different permissions, based on umask, etc, afterwards. I don't know what the
rationale for this was, but there were errors in the umask calculations when
moving from the temporary file to the intended end result.
2016-09-01 12:10:56 +01:00
Mike Naberezny
6e1dea4f66
Fix accidental unlink ( #185 ) without using ObjectSpace ( #252 )
2015-11-22 14:40:59 -08:00
Alexander Simonov
8447f0e230
Fix #252
2015-11-21 12:07:30 +02:00
Seth Kingsley
05a9ba3f20
Use duck typing to detect IO-like objects.
2015-09-03 06:16:32 -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
f7eec2dd76
fix rubocop cop Style/SpaceAroundOperators
2015-06-08 10:26:13 +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
Vít Ondruch
32016ab1bf
Remove executable bit.
2015-03-31 13:15:46 +02:00
Pavel Lobashov
112a77de7c
fix some Style/FormatString cop
2015-03-24 19:20:39 +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
1ba81ff46f
fix rubocop Style/NumericLiterals cop
2015-03-23 19:23:04 +03:00
Pavel Lobashov
31fb9d729b
fix rubocop Style/PredicateName cop
2015-03-23 19:18:51 +03:00
Pavel Lobashov
d5f79822c1
fix rubocop Style/LineEndConcatenation cop
2015-03-23 19:03:28 +03:00
Pavel.Lobashov
8d6f23ba9a
fix rubocop Style/SpaceAroundOperators cop
2015-03-22 20:03:50 +03:00
Pavel.Lobashov
abf9cbec23
fix rubocop Style/RedundantSelf cop
2015-03-22 19:30:24 +03:00
Pavel Lobashov
b93ef1266f
fix rubocop Style/StringLiterals cop
2015-03-21 11:27:44 +03:00
Pavel Lobashov
b9a757e045
fix rubocop Style/EmptyLinesAroundClassBody cop
2015-03-21 11:21:26 +03:00
Pavel Lobashov
d0c8e8df60
fix rubocop Style/EmptyLines cop
2015-03-21 11:19:14 +03:00
Alexander Simonov
721c1f05ed
Merge pull request #201 from mcantor/master
...
Be smarter about handling buffer file modes
2015-01-17 12:21:32 +02:00
Max Cantor
7c7d786f02
Be smarter about handling buffer file modes.
2014-12-17 16:16:02 -05:00
James Williams
3b639b6c62
prevent tempfile path from being unlinked by garbage collection
2014-08-29 08:31:56 -06:00
Alexander Simonov
2fcdc3a3ea
Revert "Return created zip file from Zip::File.open when supplied a block"
...
This reverts commit e3029d0b10
.
2014-07-02 18:15:54 +03:00
Michael Yin
fe1d4ade49
treat empty file as non-exists
2014-07-02 12:46:44 +08:00
Tyler Pickett
e3029d0b10
Return created zip file from Zip::File.open when supplied a block
...
This change is to match ruby zip’s behavior to core’s IO.open when
supplied a block.
2014-06-17 10:08:26 -06:00
Ian Young
37ed325783
Clean up tempfiles from output stream, fixes #57
2014-04-04 14:32:11 -07:00
Alexander Simonov
f7949596eb
Fix #143
2014-03-18 15:09:50 +02:00
Sam Rawlins
a37e13c6f0
File.exists? -> File.exist?
2014-02-06 15:00:38 -08:00
Alexander Simonov
ec81c30382
Fix for #126 and #127
2014-01-24 11:37:38 +02:00
Alexander Simonov
c7f0b17abf
Real fix for #119
2014-01-19 13:45:58 +02:00
Jim Ryan
0f8ce2cbb8
Make File.open_buffer support Tempfiles
2013-12-02 18:57:42 -05:00
Alexander Simonov
94b29aba5d
Fix #106 Set options about restoring ownerships, permissions and times. restore permissions enabled by default.
2013-10-27 16:30:48 +02:00
Alexander Simonov
cb6e628fb2
Fix #28 and #103
2013-10-20 23:09:52 +03:00
Alexander Simonov
9c25518761
Merge pull request #101 from ProGNOMmers/issue_100
...
Add entry arguments to Zip::File#get_output_stream. Fixes rubyzip/rubyzip#100
2013-10-19 12:35:09 -07:00
Alexander Simonov
569d0b7078
Fix #102 recover file permissions if zip file was exist
2013-10-19 22:05:18 +03:00
Maurizio De Santis
bc512d7061
Add missing Zip::Entry arguments to Zip::File#get_output_stream. Fixes rubyzip/rubyzip#100
2013-10-11 11:40:44 +02:00
Nick Markwell
d7091a0271
Typo fix: io.is_a() -> io.is_a?()
2013-09-06 12:20:06 -04:00