rubyzip 2.3.2 → 3.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Changelog.md +485 -0
- data/LICENSE.md +24 -0
- data/README.md +192 -44
- data/Rakefile +15 -13
- data/lib/zip/central_directory.rb +179 -125
- data/lib/zip/compressor.rb +3 -1
- data/lib/zip/constants.rb +29 -21
- data/lib/zip/crypto/aes_encryption.rb +120 -0
- data/lib/zip/crypto/decrypted_io.rb +20 -14
- data/lib/zip/crypto/encryption.rb +4 -2
- data/lib/zip/crypto/null_encryption.rb +5 -13
- data/lib/zip/crypto/traditional_encryption.rb +10 -6
- data/lib/zip/decompressor.rb +4 -3
- data/lib/zip/deflater.rb +12 -8
- data/lib/zip/dirtyable.rb +32 -0
- data/lib/zip/dos_time.rb +53 -6
- data/lib/zip/entry.rb +404 -238
- data/lib/zip/entry_set.rb +11 -9
- data/lib/zip/errors.rb +136 -16
- data/lib/zip/extra_field/aes.rb +50 -0
- data/lib/zip/extra_field/generic.rb +10 -11
- data/lib/zip/extra_field/ntfs.rb +6 -4
- data/lib/zip/extra_field/old_unix.rb +3 -1
- data/lib/zip/extra_field/universal_time.rb +3 -1
- data/lib/zip/extra_field/unix.rb +5 -3
- data/lib/zip/extra_field/unknown.rb +35 -0
- data/lib/zip/extra_field/zip64.rb +19 -5
- data/lib/zip/extra_field.rb +25 -23
- data/lib/zip/file.rb +185 -226
- data/lib/zip/file_split.rb +91 -0
- data/lib/zip/filesystem/dir.rb +86 -0
- data/lib/zip/filesystem/directory_iterator.rb +48 -0
- data/lib/zip/filesystem/file.rb +263 -0
- data/lib/zip/filesystem/file_stat.rb +110 -0
- data/lib/zip/filesystem/zip_file_name_mapper.rb +81 -0
- data/lib/zip/filesystem.rb +27 -596
- data/lib/zip/inflater.rb +10 -7
- data/lib/zip/input_stream.rb +76 -44
- data/lib/zip/ioextras/abstract_input_stream.rb +18 -12
- data/lib/zip/ioextras/abstract_output_stream.rb +13 -3
- data/lib/zip/ioextras.rb +7 -7
- data/lib/zip/null_compressor.rb +3 -1
- data/lib/zip/null_decompressor.rb +6 -3
- data/lib/zip/null_input_stream.rb +3 -1
- data/lib/zip/output_stream.rb +58 -48
- data/lib/zip/pass_thru_compressor.rb +3 -1
- data/lib/zip/pass_thru_decompressor.rb +8 -5
- data/lib/zip/streamable_directory.rb +3 -1
- data/lib/zip/streamable_stream.rb +4 -1
- data/lib/zip/version.rb +4 -1
- data/lib/zip.rb +25 -3
- data/rubyzip.gemspec +39 -0
- data/samples/example.rb +8 -3
- data/samples/example_filesystem.rb +3 -2
- data/samples/example_recursive.rb +3 -1
- data/samples/gtk_ruby_zip.rb +5 -3
- data/samples/qtzip.rb +7 -6
- data/samples/write_simple.rb +2 -1
- data/samples/zipfind.rb +1 -0
- metadata +81 -49
- data/TODO +0 -15
- data/lib/zip/extra_field/zip64_placeholder.rb +0 -15
data/README.md
CHANGED
|
@@ -1,26 +1,33 @@
|
|
|
1
1
|
# rubyzip
|
|
2
2
|
|
|
3
3
|
[](http://badge.fury.io/rb/rubyzip)
|
|
4
|
-
[](https://github.com/rubyzip/rubyzip/actions/workflows/tests.yml)
|
|
5
|
+
[](https://github.com/rubyzip/rubyzip/actions/workflows/lint.yml)
|
|
6
|
+
[](https://github.com/rubocop/rubocop)
|
|
7
|
+
[](https://qlty.sh/gh/rubyzip/projects/rubyzip)
|
|
6
8
|
[](https://coveralls.io/r/rubyzip/rubyzip?branch=master)
|
|
7
9
|
|
|
8
10
|
Rubyzip is a ruby library for reading and writing zip files.
|
|
9
11
|
|
|
10
|
-
## Important
|
|
12
|
+
## Important notes
|
|
11
13
|
|
|
12
|
-
|
|
14
|
+
### Updating to version 3.0
|
|
13
15
|
|
|
14
|
-
|
|
16
|
+
The public API of some classes has been modernized to use named parameters for optional arguments. Please check your usage of the following Rubyzip classes:
|
|
17
|
+
* `File`
|
|
18
|
+
* `Entry`
|
|
19
|
+
* `InputStream`
|
|
20
|
+
* `OutputStream`
|
|
15
21
|
|
|
16
|
-
|
|
17
|
-
gem 'rubyzip', '>= 1.0.0' # will load new rubyzip version
|
|
18
|
-
gem 'zip-zip' # will load compatibility for old rubyzip API.
|
|
19
|
-
```
|
|
22
|
+
**Please see [Updating to version 3.x](https://github.com/rubyzip/rubyzip/wiki/Updating-to-version-3.x) in the wiki for details.**
|
|
20
23
|
|
|
21
24
|
## Requirements
|
|
22
25
|
|
|
23
|
-
|
|
26
|
+
Version 3.x requires at least Ruby 3.0.
|
|
27
|
+
|
|
28
|
+
Version 2.x requires at least Ruby 2.4, and is known to work on Ruby 3.x.
|
|
29
|
+
|
|
30
|
+
It is not recommended to use any versions of Rubyzip earlier than 2.3 due to security issues.
|
|
24
31
|
|
|
25
32
|
## Installation
|
|
26
33
|
|
|
@@ -49,7 +56,7 @@ input_filenames = ['image.jpg', 'description.txt', 'stats.csv']
|
|
|
49
56
|
|
|
50
57
|
zipfile_name = "/Users/me/Desktop/archive.zip"
|
|
51
58
|
|
|
52
|
-
Zip::File.open(zipfile_name,
|
|
59
|
+
Zip::File.open(zipfile_name, create: true) do |zipfile|
|
|
53
60
|
input_filenames.each do |filename|
|
|
54
61
|
# Two arguments:
|
|
55
62
|
# - The name of the file as it will appear in the archive
|
|
@@ -60,6 +67,48 @@ Zip::File.open(zipfile_name, Zip::File::CREATE) do |zipfile|
|
|
|
60
67
|
end
|
|
61
68
|
```
|
|
62
69
|
|
|
70
|
+
### Creating a Zip file with `Zip::OutputStream`
|
|
71
|
+
|
|
72
|
+
```ruby
|
|
73
|
+
require 'rubygems'
|
|
74
|
+
require 'zip'
|
|
75
|
+
|
|
76
|
+
Zip::OutputStream.open('archive.zip') do |zos|
|
|
77
|
+
# Quick.
|
|
78
|
+
zos.put_next_entry('greeting.txt')
|
|
79
|
+
zos << 'Hello, World!'
|
|
80
|
+
|
|
81
|
+
# More control.
|
|
82
|
+
# You MUST NOT make any calls on your `Entry` after calling `put_next_entry`.
|
|
83
|
+
entry = Zip::Entry.new(nil, 'parting.txt')
|
|
84
|
+
entry.atime = Time.now
|
|
85
|
+
zos.put_next_entry(entry)
|
|
86
|
+
zos.write('TTFN')
|
|
87
|
+
end
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
You can generate a Zip archive in memory using `Zip::OutputStream.write_buffer`.
|
|
91
|
+
|
|
92
|
+
### Suppressing extra fields
|
|
93
|
+
|
|
94
|
+
If you wish to suppress extra fields from being added to your entries, you can do so by passing the `suppress_extra_fields` parameter to any of the archive opening calls within `Zip::File` or `Zip::OutputStream`, e.g.:
|
|
95
|
+
|
|
96
|
+
```ruby
|
|
97
|
+
# Suppress all extra fields.
|
|
98
|
+
Zip::File.open('archive.zip', create: true, suppress_extra_fields: true)
|
|
99
|
+
Zip::OutputStream.open('archive.zip', suppress_extra_fields: true)
|
|
100
|
+
|
|
101
|
+
# Suppress an individual extra field.
|
|
102
|
+
Zip::File.open('archive.zip', create: true, suppress_extra_fields: :zip64)
|
|
103
|
+
Zip::OutputStream.open('archive.zip', suppress_extra_fields: :zip64)
|
|
104
|
+
|
|
105
|
+
# Suppress multiple extra fields.
|
|
106
|
+
Zip::File.open('archive.zip', create: true, suppress_extra_fields: [:ntfs, :zip64])
|
|
107
|
+
Zip::OutputStream.open('archive.zip', suppress_extra_fields: [:ntfs, :zip64])
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Note that there are some extra fields that cannot be suppressed at all (e.g. `:aes`), and some which will only be suppressed if it is safe to do so (e.g. `:zip64`).
|
|
111
|
+
|
|
63
112
|
### Zipping a directory recursively
|
|
64
113
|
|
|
65
114
|
Copy from [here](https://github.com/rubyzip/rubyzip/blob/9d891f7353e66052283562d3e252fe380bb4b199/samples/example_recursive.rb)
|
|
@@ -88,7 +137,7 @@ class ZipFileGenerator
|
|
|
88
137
|
def write
|
|
89
138
|
entries = Dir.entries(@input_dir) - %w[. ..]
|
|
90
139
|
|
|
91
|
-
::Zip::File.open(@output_file,
|
|
140
|
+
::Zip::File.open(@output_file, create: true) do |zipfile|
|
|
92
141
|
write_entries entries, '', zipfile
|
|
93
142
|
end
|
|
94
143
|
end
|
|
@@ -121,9 +170,9 @@ class ZipFileGenerator
|
|
|
121
170
|
end
|
|
122
171
|
```
|
|
123
172
|
|
|
124
|
-
### Save zip archive entries
|
|
173
|
+
### Save zip archive entries sorted by name
|
|
125
174
|
|
|
126
|
-
To save zip archives
|
|
175
|
+
To save zip archives with their entries sorted by name (see below), set `::Zip.sort_entries` to `true`
|
|
127
176
|
|
|
128
177
|
```
|
|
129
178
|
Vegetable/
|
|
@@ -137,7 +186,7 @@ fruit/mango
|
|
|
137
186
|
fruit/orange
|
|
138
187
|
```
|
|
139
188
|
|
|
140
|
-
|
|
189
|
+
Opening an existing zip file with this option set will not change the order of the entries automatically. Altering the zip file - adding an entry, renaming an entry, adding or changing the archive comment, etc - will cause the ordering to be applied when closing the file.
|
|
141
190
|
|
|
142
191
|
### Default permissions of zip archives
|
|
143
192
|
|
|
@@ -173,28 +222,79 @@ Zip::File.open('foo.zip') do |zip_file|
|
|
|
173
222
|
end
|
|
174
223
|
```
|
|
175
224
|
|
|
176
|
-
|
|
225
|
+
### Reading a Zip file with `Zip::InputStream`
|
|
226
|
+
|
|
227
|
+
`Zip::InputStream` can be used for faster reading of zip file content because it does not read the Central directory up front.
|
|
228
|
+
|
|
229
|
+
There is one exception where it can not work however, and this is if the file does not contain enough information in the local entry headers to extract an entry. This is indicated in an entry by the General Purpose Flag bit 3 being set.
|
|
230
|
+
|
|
231
|
+
> If bit 3 (0x08) of the general-purpose flags field is set, then the CRC-32 and file sizes are not known when the header is written. The fields in the local header are filled with zero, and the CRC-32 and size are appended in a 12-byte structure (optionally preceded by a 4-byte signature) immediately after the compressed data.
|
|
232
|
+
|
|
233
|
+
If `Zip::InputStream` finds such an entry in the zip archive it will raise an exception (`Zip::StreamingError`).
|
|
177
234
|
|
|
178
|
-
|
|
235
|
+
`Zip::InputStream` is not designed to be used for random access in a zip file. When performing any operations on an entry that you are accessing via `Zip::InputStream#get_next_entry` then you should complete any such operations before the next call to `get_next_entry`.
|
|
179
236
|
|
|
180
|
-
|
|
237
|
+
```ruby
|
|
238
|
+
Zip::InputStream.open('file.zip') do |zip_stream|
|
|
239
|
+
while entry = zip_stream.get_next_entry
|
|
240
|
+
# All required operations on `entry` go here.
|
|
241
|
+
end
|
|
242
|
+
end # The `InputStream` is closed at the end of the block.
|
|
243
|
+
```
|
|
181
244
|
|
|
182
|
-
|
|
245
|
+
Any attempt to move about in a zip file opened with `Zip::InputStream` could result in the incorrect entry being accessed and/or Zlib buffer errors. If you need random access in a zip file, use `Zip::File`.
|
|
183
246
|
|
|
184
|
-
|
|
247
|
+
### Password Protection (experimental)
|
|
185
248
|
|
|
186
|
-
|
|
249
|
+
Rubyzip supports reading zip files with AES encryption (version 3.1 and later), and reading and writing zip files with traditional zip encryption (a.k.a. "ZipCrypto"). Encryption is currently only available with the stream API, with either files or buffers, e.g.:
|
|
187
250
|
|
|
188
|
-
|
|
251
|
+
#### Version 2.x (ZipCrypto only)
|
|
189
252
|
|
|
190
253
|
```ruby
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
254
|
+
# Writing.
|
|
255
|
+
enc = Zip::TraditionalEncrypter.new('password')
|
|
256
|
+
buffer = Zip::OutputStream.write_buffer(::StringIO.new(''), enc) do |output|
|
|
257
|
+
output.put_next_entry("my_file.txt")
|
|
258
|
+
output.write my_data
|
|
259
|
+
end
|
|
260
|
+
|
|
261
|
+
# Reading.
|
|
262
|
+
dec = Zip::TraditionalDecrypter.new('password')
|
|
263
|
+
Zip::InputStream.open(buffer, 0, dec) do |input|
|
|
264
|
+
entry = input.get_next_entry
|
|
265
|
+
puts "Contents of '#{entry.name}':"
|
|
266
|
+
puts input.read
|
|
267
|
+
end
|
|
195
268
|
```
|
|
196
269
|
|
|
197
|
-
|
|
270
|
+
#### Version 3.x (AES reading and ZipCrypto read/write)
|
|
271
|
+
|
|
272
|
+
```ruby
|
|
273
|
+
# Reading AES, version 3.1 and later.
|
|
274
|
+
dec = Zip::AESDecrypter.new('password', Zip::AESEncryption::STRENGTH_256_BIT)
|
|
275
|
+
Zip::InputStream.open('aes-encrypted-file.zip', decrypter: dec) do |input|
|
|
276
|
+
entry = input.get_next_entry
|
|
277
|
+
puts "Contents of '#{entry.name}':"
|
|
278
|
+
puts input.read
|
|
279
|
+
end
|
|
280
|
+
|
|
281
|
+
# Writing.
|
|
282
|
+
enc = Zip::TraditionalEncrypter.new('password')
|
|
283
|
+
buffer = Zip::OutputStream.write_buffer(encrypter: enc) do |output|
|
|
284
|
+
output.put_next_entry("my_file.txt")
|
|
285
|
+
output.write my_data
|
|
286
|
+
end
|
|
287
|
+
|
|
288
|
+
# Reading.
|
|
289
|
+
dec = Zip::TraditionalDecrypter.new('password')
|
|
290
|
+
Zip::InputStream.open(buffer, decrypter: dec) do |input|
|
|
291
|
+
entry = input.get_next_entry
|
|
292
|
+
puts "Contents of '#{entry.name}':"
|
|
293
|
+
puts input.read
|
|
294
|
+
end
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
_This is an evolving feature and the interface for encryption may change in future versions._
|
|
198
298
|
|
|
199
299
|
## Known issues
|
|
200
300
|
|
|
@@ -208,7 +308,7 @@ buffer = Zip::OutputStream.write_buffer do |out|
|
|
|
208
308
|
unless [DOCUMENT_FILE_PATH, RELS_FILE_PATH].include?(e.name)
|
|
209
309
|
out.put_next_entry(e.name)
|
|
210
310
|
out.write e.get_input_stream.read
|
|
211
|
-
|
|
311
|
+
end
|
|
212
312
|
end
|
|
213
313
|
|
|
214
314
|
out.put_next_entry(DOCUMENT_FILE_PATH)
|
|
@@ -288,25 +388,37 @@ Zip.validate_entry_sizes = false
|
|
|
288
388
|
|
|
289
389
|
Note that if you use the lower level `Zip::InputStream` interface, `rubyzip` does *not* check the entry `size`s. In this case, the caller is responsible for making sure it does not read more data than expected from the input stream.
|
|
290
390
|
|
|
291
|
-
###
|
|
391
|
+
### Compression level
|
|
292
392
|
|
|
293
|
-
|
|
393
|
+
When adding entries to a zip archive you can set the compression level to trade-off compressed size against compression speed. By default this is set to the same as the underlying Zlib library's default (`Zlib::DEFAULT_COMPRESSION`), which is somewhere in the middle.
|
|
394
|
+
|
|
395
|
+
You can configure the default compression level with:
|
|
294
396
|
|
|
295
397
|
```ruby
|
|
296
|
-
Zip.default_compression =
|
|
398
|
+
Zip.default_compression = X
|
|
297
399
|
```
|
|
298
400
|
|
|
299
|
-
|
|
401
|
+
Where X is an integer between 0 and 9, inclusive. If this option is set to 0 (`Zlib::NO_COMPRESSION`) then entries will be stored in the zip archive uncompressed. A value of 1 (`Zlib::BEST_SPEED`) gives the fastest compression and 9 (`Zlib::BEST_COMPRESSION`) gives the smallest compressed file size.
|
|
402
|
+
|
|
403
|
+
This can also be set for each archive as an option to `Zip::File`:
|
|
404
|
+
|
|
405
|
+
```ruby
|
|
406
|
+
Zip::File.open('foo.zip', create:true, compression_level: 9) do |zip|
|
|
407
|
+
zip.add ...
|
|
408
|
+
end
|
|
409
|
+
```
|
|
300
410
|
|
|
301
411
|
### Zip64 Support
|
|
302
412
|
|
|
303
|
-
|
|
413
|
+
Since version 3.0, Zip64 support is enabled for writing by default. To disable it do this:
|
|
304
414
|
|
|
305
415
|
```ruby
|
|
306
|
-
Zip.write_zip64_support =
|
|
416
|
+
Zip.write_zip64_support = false
|
|
307
417
|
```
|
|
308
418
|
|
|
309
|
-
|
|
419
|
+
Prior to version 3.0, Zip64 support is disabled for writing by default.
|
|
420
|
+
|
|
421
|
+
_NOTE_: If Zip64 write support is enabled then any extractor subsequently used may also require Zip64 support to read from the resultant archive.
|
|
310
422
|
|
|
311
423
|
### Block Form
|
|
312
424
|
|
|
@@ -321,15 +433,50 @@ You can set multiple settings at the same time by using a block:
|
|
|
321
433
|
end
|
|
322
434
|
```
|
|
323
435
|
|
|
436
|
+
## Compatibility
|
|
437
|
+
|
|
438
|
+
Rubyzip is known to run on a number of platforms and under a number of different Ruby versions.
|
|
439
|
+
|
|
440
|
+
### Version 2.4.x
|
|
441
|
+
|
|
442
|
+
Rubyzip 2.4 is known to work on MRI 2.4 to 3.4 on Linux and Mac, and JRuby and Truffleruby on Linux. There are known issues with Windows which have been fixed on the development branch. Please [let us know](https://github.com/rubyzip/rubyzip/pulls) if you know Rubyzip 2.4 works on a platform/Ruby combination not listed here, or [raise an issue](https://github.com/rubyzip/rubyzip/issues) if you see a failure where we think it should work.
|
|
443
|
+
|
|
444
|
+
### Version 3.x
|
|
445
|
+
|
|
446
|
+
Please see the table below for what we think the current situation is. Note: an empty cell means "unknown", not "does not work".
|
|
447
|
+
|
|
448
|
+
| OS/Ruby | 3.0 | 3.1 | 3.2 | 3.3 | 3.4 | Head | JRuby 10.0.1.0 | JRuby Head | Truffleruby 24.2.1 | Truffleruby Head |
|
|
449
|
+
|---------|-----|-----|-----|-----|-----|------|---------------|------------|--------------------|------------------|
|
|
450
|
+
|Ubuntu 24.04| CI | CI | CI | CI | CI | ci | CI | ci | CI | ci |
|
|
451
|
+
|Mac OS 14.7.6| CI | CI | CI | CI | CI | ci | x | | x | |
|
|
452
|
+
|Windows Server 2022| CI | | | | CI mswin</br>CI ucrt | | | | | |
|
|
453
|
+
|
|
454
|
+
Key: `CI` - tested in CI, should work; `ci` - tested in CI, might fail; `x` - known working; `o` - known failing.
|
|
455
|
+
|
|
456
|
+
Rubies 3.1+ are also tested separately with YJIT turned on (Ubuntu and Mac OS).
|
|
457
|
+
|
|
458
|
+
See [the Actions tab](https://github.com/rubyzip/rubyzip/actions) in GitHub for full details.
|
|
459
|
+
|
|
460
|
+
Please [raise a PR](https://github.com/rubyzip/rubyzip/pulls) if you know Rubyzip works on a platform/Ruby combination not listed here, or [raise an issue](https://github.com/rubyzip/rubyzip/issues) if you see a failure where we think it should work.
|
|
461
|
+
|
|
324
462
|
## Developing
|
|
325
463
|
|
|
326
|
-
|
|
464
|
+
Install the dependencies:
|
|
327
465
|
|
|
328
|
-
```
|
|
466
|
+
```shell
|
|
329
467
|
bundle install
|
|
468
|
+
```
|
|
469
|
+
|
|
470
|
+
Run the tests with `rake`:
|
|
471
|
+
|
|
472
|
+
```shell
|
|
330
473
|
rake
|
|
331
474
|
```
|
|
332
475
|
|
|
476
|
+
Please also run `rubocop` over your changes.
|
|
477
|
+
|
|
478
|
+
Our CI runs on [GitHub Actions](https://github.com/rubyzip/rubyzip/actions). Please note that `rubocop` is run as part of the CI configuration and will fail a build if errors are found.
|
|
479
|
+
|
|
333
480
|
## Website and Project Home
|
|
334
481
|
|
|
335
482
|
http://github.com/rubyzip/rubyzip
|
|
@@ -338,17 +485,18 @@ http://rdoc.info/github/rubyzip/rubyzip/master/frames
|
|
|
338
485
|
|
|
339
486
|
## Authors
|
|
340
487
|
|
|
341
|
-
|
|
488
|
+
See https://github.com/rubyzip/rubyzip/graphs/contributors for a comprehensive list.
|
|
342
489
|
|
|
343
|
-
|
|
490
|
+
### Current maintainers
|
|
344
491
|
|
|
345
|
-
|
|
492
|
+
* Robert Haines (@hainesr)
|
|
493
|
+
* John Lees-Miller (@jdleesmiller)
|
|
494
|
+
* Oleksandr Simonov (@simonoff)
|
|
346
495
|
|
|
347
|
-
|
|
496
|
+
### Original author
|
|
348
497
|
|
|
349
|
-
|
|
498
|
+
* Thomas Sondergaard
|
|
350
499
|
|
|
351
500
|
## License
|
|
352
501
|
|
|
353
|
-
Rubyzip is distributed under the same license as ruby.
|
|
354
|
-
http://www.ruby-lang.org/en/LICENSE.txt
|
|
502
|
+
Rubyzip is distributed under the same license as Ruby. In practice this means you can use it under the terms of the Ruby License or the 2-Clause BSD License. See https://www.ruby-lang.org/en/about/license.txt and LICENSE.md for details.
|
data/Rakefile
CHANGED
|
@@ -1,21 +1,23 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'bundler/gem_tasks'
|
|
2
|
-
require '
|
|
4
|
+
require 'minitest/test_task'
|
|
5
|
+
require 'rdoc/task'
|
|
3
6
|
require 'rubocop/rake_task'
|
|
4
7
|
|
|
5
8
|
task default: :test
|
|
6
9
|
|
|
7
|
-
|
|
8
|
-
test.
|
|
9
|
-
test.
|
|
10
|
-
test.pattern = 'test/**/*_test.rb'
|
|
11
|
-
test.verbose = true
|
|
10
|
+
Minitest::TestTask.create do |test|
|
|
11
|
+
test.framework = 'require "simplecov"'
|
|
12
|
+
test.test_globs = 'test/**/*_test.rb'
|
|
12
13
|
end
|
|
13
14
|
|
|
14
|
-
|
|
15
|
+
RDoc::Task.new do |rdoc|
|
|
16
|
+
rdoc.main = 'README.md'
|
|
17
|
+
rdoc.rdoc_files.include('README.md', 'lib/**/*.rb')
|
|
18
|
+
rdoc.options << '--markup=markdown'
|
|
19
|
+
rdoc.options << '--tab-width=2'
|
|
20
|
+
rdoc.options << "-t Rubyzip version #{Zip::VERSION}"
|
|
21
|
+
end
|
|
15
22
|
|
|
16
|
-
|
|
17
|
-
# test.libs << File.join(File.dirname(__FILE__), 'lib')
|
|
18
|
-
# test.libs << File.join(File.dirname(__FILE__), 'test')
|
|
19
|
-
# test.pattern = File.join(File.dirname(__FILE__), 'test/zip64_full_test.rb')
|
|
20
|
-
# test.verbose = true
|
|
21
|
-
# end
|
|
23
|
+
RuboCop::RakeTask.new
|