rubyzip 1.3.0 → 3.0.0.alpha

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.
Files changed (134) hide show
  1. checksums.yaml +4 -4
  2. data/Changelog.md +368 -0
  3. data/README.md +123 -46
  4. data/Rakefile +13 -6
  5. data/lib/zip/central_directory.rb +166 -116
  6. data/lib/zip/compressor.rb +3 -1
  7. data/lib/zip/constants.rb +77 -21
  8. data/lib/zip/crypto/decrypted_io.rb +42 -0
  9. data/lib/zip/crypto/encryption.rb +4 -2
  10. data/lib/zip/crypto/null_encryption.rb +5 -3
  11. data/lib/zip/crypto/traditional_encryption.rb +14 -12
  12. data/lib/zip/decompressor.rb +21 -2
  13. data/lib/zip/deflater.rb +10 -8
  14. data/lib/zip/dirtyable.rb +32 -0
  15. data/lib/zip/dos_time.rb +53 -12
  16. data/lib/zip/entry.rb +306 -184
  17. data/lib/zip/entry_set.rb +11 -7
  18. data/lib/zip/errors.rb +115 -15
  19. data/lib/zip/extra_field/generic.rb +11 -17
  20. data/lib/zip/extra_field/ntfs.rb +8 -2
  21. data/lib/zip/extra_field/old_unix.rb +6 -2
  22. data/lib/zip/extra_field/universal_time.rb +45 -13
  23. data/lib/zip/extra_field/unix.rb +7 -3
  24. data/lib/zip/extra_field/unknown.rb +33 -0
  25. data/lib/zip/extra_field/zip64.rb +16 -7
  26. data/lib/zip/extra_field.rb +22 -26
  27. data/lib/zip/file.rb +196 -240
  28. data/lib/zip/file_split.rb +97 -0
  29. data/lib/zip/filesystem/dir.rb +86 -0
  30. data/lib/zip/filesystem/directory_iterator.rb +48 -0
  31. data/lib/zip/filesystem/file.rb +262 -0
  32. data/lib/zip/filesystem/file_stat.rb +110 -0
  33. data/lib/zip/filesystem/zip_file_name_mapper.rb +81 -0
  34. data/lib/zip/filesystem.rb +31 -584
  35. data/lib/zip/inflater.rb +27 -37
  36. data/lib/zip/input_stream.rb +67 -42
  37. data/lib/zip/ioextras/abstract_input_stream.rb +32 -16
  38. data/lib/zip/ioextras/abstract_output_stream.rb +5 -3
  39. data/lib/zip/ioextras.rb +7 -7
  40. data/lib/zip/null_compressor.rb +3 -1
  41. data/lib/zip/null_decompressor.rb +4 -10
  42. data/lib/zip/null_input_stream.rb +3 -1
  43. data/lib/zip/output_stream.rb +58 -43
  44. data/lib/zip/pass_thru_compressor.rb +5 -3
  45. data/lib/zip/pass_thru_decompressor.rb +16 -23
  46. data/lib/zip/streamable_directory.rb +6 -4
  47. data/lib/zip/streamable_stream.rb +9 -10
  48. data/lib/zip/version.rb +3 -1
  49. data/lib/zip.rb +19 -4
  50. data/rubyzip.gemspec +38 -0
  51. data/samples/example.rb +9 -4
  52. data/samples/example_filesystem.rb +3 -2
  53. data/samples/example_recursive.rb +3 -1
  54. data/samples/gtk_ruby_zip.rb +22 -20
  55. data/samples/qtzip.rb +12 -11
  56. data/samples/write_simple.rb +3 -4
  57. data/samples/zipfind.rb +24 -22
  58. metadata +86 -179
  59. data/TODO +0 -15
  60. data/lib/zip/extra_field/zip64_placeholder.rb +0 -15
  61. data/test/basic_zip_file_test.rb +0 -60
  62. data/test/case_sensitivity_test.rb +0 -69
  63. data/test/central_directory_entry_test.rb +0 -69
  64. data/test/central_directory_test.rb +0 -100
  65. data/test/crypto/null_encryption_test.rb +0 -57
  66. data/test/crypto/traditional_encryption_test.rb +0 -80
  67. data/test/data/WarnInvalidDate.zip +0 -0
  68. data/test/data/file1.txt +0 -46
  69. data/test/data/file1.txt.deflatedData +0 -0
  70. data/test/data/file2.txt +0 -1504
  71. data/test/data/globTest/foo/bar/baz/foo.txt +0 -0
  72. data/test/data/globTest/foo.txt +0 -0
  73. data/test/data/globTest/food.txt +0 -0
  74. data/test/data/globTest.zip +0 -0
  75. data/test/data/gpbit3stored.zip +0 -0
  76. data/test/data/mimetype +0 -1
  77. data/test/data/notzippedruby.rb +0 -7
  78. data/test/data/ntfs.zip +0 -0
  79. data/test/data/oddExtraField.zip +0 -0
  80. data/test/data/path_traversal/Makefile +0 -10
  81. data/test/data/path_traversal/jwilk/README.md +0 -5
  82. data/test/data/path_traversal/jwilk/absolute1.zip +0 -0
  83. data/test/data/path_traversal/jwilk/absolute2.zip +0 -0
  84. data/test/data/path_traversal/jwilk/dirsymlink.zip +0 -0
  85. data/test/data/path_traversal/jwilk/dirsymlink2a.zip +0 -0
  86. data/test/data/path_traversal/jwilk/dirsymlink2b.zip +0 -0
  87. data/test/data/path_traversal/jwilk/relative0.zip +0 -0
  88. data/test/data/path_traversal/jwilk/relative2.zip +0 -0
  89. data/test/data/path_traversal/jwilk/symlink.zip +0 -0
  90. data/test/data/path_traversal/relative1.zip +0 -0
  91. data/test/data/path_traversal/tilde.zip +0 -0
  92. data/test/data/path_traversal/tuzovakaoff/README.md +0 -3
  93. data/test/data/path_traversal/tuzovakaoff/absolutepath.zip +0 -0
  94. data/test/data/path_traversal/tuzovakaoff/symlink.zip +0 -0
  95. data/test/data/rubycode.zip +0 -0
  96. data/test/data/rubycode2.zip +0 -0
  97. data/test/data/test.xls +0 -0
  98. data/test/data/testDirectory.bin +0 -0
  99. data/test/data/zip64-sample.zip +0 -0
  100. data/test/data/zipWithDirs.zip +0 -0
  101. data/test/data/zipWithEncryption.zip +0 -0
  102. data/test/deflater_test.rb +0 -65
  103. data/test/encryption_test.rb +0 -42
  104. data/test/entry_set_test.rb +0 -163
  105. data/test/entry_test.rb +0 -154
  106. data/test/errors_test.rb +0 -35
  107. data/test/extra_field_test.rb +0 -76
  108. data/test/file_extract_directory_test.rb +0 -54
  109. data/test/file_extract_test.rb +0 -145
  110. data/test/file_permissions_test.rb +0 -65
  111. data/test/file_split_test.rb +0 -57
  112. data/test/file_test.rb +0 -666
  113. data/test/filesystem/dir_iterator_test.rb +0 -58
  114. data/test/filesystem/directory_test.rb +0 -139
  115. data/test/filesystem/file_mutating_test.rb +0 -87
  116. data/test/filesystem/file_nonmutating_test.rb +0 -508
  117. data/test/filesystem/file_stat_test.rb +0 -64
  118. data/test/gentestfiles.rb +0 -126
  119. data/test/inflater_test.rb +0 -14
  120. data/test/input_stream_test.rb +0 -182
  121. data/test/ioextras/abstract_input_stream_test.rb +0 -102
  122. data/test/ioextras/abstract_output_stream_test.rb +0 -106
  123. data/test/ioextras/fake_io_test.rb +0 -18
  124. data/test/local_entry_test.rb +0 -154
  125. data/test/output_stream_test.rb +0 -128
  126. data/test/pass_thru_compressor_test.rb +0 -30
  127. data/test/pass_thru_decompressor_test.rb +0 -14
  128. data/test/path_traversal_test.rb +0 -141
  129. data/test/samples/example_recursive_test.rb +0 -37
  130. data/test/settings_test.rb +0 -95
  131. data/test/test_helper.rb +0 -234
  132. data/test/unicode_file_names_and_comments_test.rb +0 -62
  133. data/test/zip64_full_test.rb +0 -51
  134. data/test/zip64_support_test.rb +0 -14
data/README.md CHANGED
@@ -1,26 +1,32 @@
1
1
  # rubyzip
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/rubyzip.svg)](http://badge.fury.io/rb/rubyzip)
4
- [![Build Status](https://secure.travis-ci.org/rubyzip/rubyzip.svg)](http://travis-ci.org/rubyzip/rubyzip)
4
+ [![Tests](https://github.com/rubyzip/rubyzip/actions/workflows/tests.yml/badge.svg)](https://github.com/rubyzip/rubyzip/actions/workflows/tests.yml)
5
+ [![Linter](https://github.com/rubyzip/rubyzip/actions/workflows/lint.yml/badge.svg)](https://github.com/rubyzip/rubyzip/actions/workflows/lint.yml)
5
6
  [![Code Climate](https://codeclimate.com/github/rubyzip/rubyzip.svg)](https://codeclimate.com/github/rubyzip/rubyzip)
6
7
  [![Coverage Status](https://img.shields.io/coveralls/rubyzip/rubyzip.svg)](https://coveralls.io/r/rubyzip/rubyzip?branch=master)
7
8
 
8
9
  Rubyzip is a ruby library for reading and writing zip files.
9
10
 
10
- ## Important note
11
+ ## Important notes
11
12
 
12
- The Rubyzip interface has changed!!! No need to do `require "zip/zip"` and `Zip` prefix in class names removed.
13
+ ### Updating to version 3.0
13
14
 
14
- If you have issues with any third-party gems that require an old version of rubyzip, you can use this workaround:
15
+ 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:
16
+ * `File`
17
+ * `Entry`
18
+ * `InputStream`
19
+ * `OutputStream`
15
20
 
16
- ```ruby
17
- gem 'rubyzip', '>= 1.0.0' # will load new rubyzip version
18
- gem 'zip-zip' # will load compatibility for old rubyzip API.
19
- ```
21
+ **Please see [Updating to version 3.x](https://github.com/rubyzip/rubyzip/wiki/Updating-to-version-3.x) in the wiki for details.**
20
22
 
21
23
  ## Requirements
22
24
 
23
- - Ruby 1.9.2 or greater
25
+ Version 3.x requires at least Ruby 2.5.
26
+
27
+ Version 2.x requires at least Ruby 2.4, and is known to work on Ruby 3.1.
28
+
29
+ It is not recommended to use any versions of Rubyzip earlier than 2.3 due to security issues.
24
30
 
25
31
  ## Installation
26
32
 
@@ -49,7 +55,7 @@ input_filenames = ['image.jpg', 'description.txt', 'stats.csv']
49
55
 
50
56
  zipfile_name = "/Users/me/Desktop/archive.zip"
51
57
 
52
- Zip::File.open(zipfile_name, Zip::File::CREATE) do |zipfile|
58
+ Zip::File.open(zipfile_name, create: true) do |zipfile|
53
59
  input_filenames.each do |filename|
54
60
  # Two arguments:
55
61
  # - The name of the file as it will appear in the archive
@@ -88,7 +94,7 @@ class ZipFileGenerator
88
94
  def write
89
95
  entries = Dir.entries(@input_dir) - %w[. ..]
90
96
 
91
- ::Zip::File.open(@output_file, ::Zip::File::CREATE) do |zipfile|
97
+ ::Zip::File.open(@output_file, create: true) do |zipfile|
92
98
  write_entries entries, '', zipfile
93
99
  end
94
100
  end
@@ -121,9 +127,9 @@ class ZipFileGenerator
121
127
  end
122
128
  ```
123
129
 
124
- ### Save zip archive entries in sorted by name state
130
+ ### Save zip archive entries sorted by name
125
131
 
126
- To save zip archives in sorted order like below, you need to set `::Zip.sort_entries` to `true`
132
+ To save zip archives with their entries sorted by name (see below), set `::Zip.sort_entries` to `true`
127
133
 
128
134
  ```
129
135
  Vegetable/
@@ -137,7 +143,7 @@ fruit/mango
137
143
  fruit/orange
138
144
  ```
139
145
 
140
- After this, entries in the zip archive will be saved in ordered state.
146
+ 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
147
 
142
148
  ### Default permissions of zip archives
143
149
 
@@ -173,28 +179,50 @@ Zip::File.open('foo.zip') do |zip_file|
173
179
  end
174
180
  ```
175
181
 
176
- #### Notice about ::Zip::InputStream
182
+ ### Notes on `Zip::InputStream`
183
+
184
+ `Zip::InputStream` can be used for faster reading of zip file content because it does not read the Central directory up front.
185
+
186
+ 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.
177
187
 
178
- `::Zip::InputStream` usable for fast reading zip file content because it not read Central directory.
188
+ > 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.
179
189
 
180
- But there is one exception when it is not working - General Purpose Flag Bit 3.
190
+ If `Zip::InputStream` finds such an entry in the zip archive it will raise an exception (`Zip::StreamingError`).
181
191
 
182
- > 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
192
+ `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`.
193
+
194
+ ```ruby
195
+ zip_stream = Zip::InputStream.new(File.open('file.zip'))
196
+
197
+ while entry = zip_stream.get_next_entry
198
+ # All required operations on `entry` go here.
199
+ end
200
+ ```
183
201
 
184
- If `::Zip::InputStream` finds such entry in the zip archive it will raise an exception.
202
+ 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`.
185
203
 
186
204
  ### Password Protection (Experimental)
187
205
 
188
206
  Rubyzip supports reading/writing zip files with traditional zip encryption (a.k.a. "ZipCrypto"). AES encryption is not yet supported. It can be used with buffer streams, e.g.:
189
207
 
190
208
  ```ruby
191
- Zip::OutputStream.write_buffer(::StringIO.new(''), Zip::TraditionalEncrypter.new('password')) do |out|
192
- out.put_next_entry("my_file.txt")
193
- out.write my_data
194
- end.string
209
+ # Writing.
210
+ enc = Zip::TraditionalEncrypter.new('password')
211
+ buffer = Zip::OutputStream.write_buffer(encrypter: enc) do |output|
212
+ output.put_next_entry("my_file.txt")
213
+ output.write my_data
214
+ end
215
+
216
+ # Reading.
217
+ dec = Zip::TraditionalDecrypter.new('password')
218
+ Zip::InputStream.open(buffer, decrypter: dec) do |input|
219
+ entry = input.get_next_entry
220
+ puts "Contents of '#{entry.name}':"
221
+ puts input.read
222
+ end
195
223
  ```
196
224
 
197
- This is an experimental feature and the interface for encryption may change in future versions.
225
+ _This is an experimental feature and the interface for encryption may change in future versions._
198
226
 
199
227
  ## Known issues
200
228
 
@@ -208,7 +236,7 @@ buffer = Zip::OutputStream.write_buffer do |out|
208
236
  unless [DOCUMENT_FILE_PATH, RELS_FILE_PATH].include?(e.name)
209
237
  out.put_next_entry(e.name)
210
238
  out.write e.get_input_stream.read
211
- end
239
+ end
212
240
  end
213
241
 
214
242
  out.put_next_entry(DOCUMENT_FILE_PATH)
@@ -265,13 +293,7 @@ Zip.warn_invalid_date = false
265
293
 
266
294
  ### Size Validation
267
295
 
268
- **This setting defaults to `false` in rubyzip 1.3 for backward compatibility, but it will default to `true` in rubyzip 2.0.**
269
-
270
- If you set
271
- ```
272
- Zip.validate_entry_sizes = true
273
- ```
274
- then `rubyzip`'s `extract` method checks that an entry's reported uncompressed size is not (significantly) smaller than its actual size. This is to help you protect your application against [zip bombs](https://en.wikipedia.org/wiki/Zip_bomb). Before `extract`ing an entry, you should check that its size is in the range you expect. For example, if your application supports processing up to 100 files at once, each up to 10MiB, your zip extraction code might look like:
296
+ By default (in rubyzip >= 2.0), rubyzip's `extract` method checks that an entry's reported uncompressed size is not (significantly) smaller than its actual size. This is to help you protect your application against [zip bombs](https://en.wikipedia.org/wiki/Zip_bomb). Before `extract`ing an entry, you should check that its size is in the range you expect. For example, if your application supports processing up to 100 files at once, each up to 10MiB, your zip extraction code might look like:
275
297
 
276
298
  ```ruby
277
299
  MAX_FILE_SIZE = 10 * 1024**2 # 10MiB
@@ -294,25 +316,35 @@ Zip.validate_entry_sizes = false
294
316
 
295
317
  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.
296
318
 
297
- ### Default Compression
319
+ ### Compression level
320
+
321
+ 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.
298
322
 
299
- You can set the default compression level like so:
323
+ You can configure the default compression level with:
300
324
 
301
325
  ```ruby
302
- Zip.default_compression = Zlib::DEFAULT_COMPRESSION
326
+ Zip.default_compression = X
303
327
  ```
304
328
 
305
- It defaults to `Zlib::DEFAULT_COMPRESSION`. Possible values are `Zlib::BEST_COMPRESSION`, `Zlib::DEFAULT_COMPRESSION` and `Zlib::NO_COMPRESSION`
329
+ 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.
330
+
331
+ This can also be set for each archive as an option to `Zip::File`:
332
+
333
+ ```ruby
334
+ Zip::File.open('foo.zip', create:true, compression_level: 9) do |zip|
335
+ zip.add ...
336
+ end
337
+ ```
306
338
 
307
339
  ### Zip64 Support
308
340
 
309
- By default, Zip64 support is disabled for writing. To enable it do this:
341
+ By default, Zip64 support is enabled for writing. To disable it do this:
310
342
 
311
343
  ```ruby
312
- Zip.write_zip64_support = true
344
+ Zip.write_zip64_support = false
313
345
  ```
314
346
 
315
- _NOTE_: If you will enable Zip64 writing then you will need zip extractor with Zip64 support to extract archive.
347
+ _NOTE_: If Zip64 write support is enabled then any extractor subsequently used may also require Zip64 support to read from the resultant archive.
316
348
 
317
349
  ### Block Form
318
350
 
@@ -327,15 +359,47 @@ You can set multiple settings at the same time by using a block:
327
359
  end
328
360
  ```
329
361
 
362
+ ## Compatibility
363
+
364
+ Rubyzip is known to run on a number of platforms and under a number of different Ruby versions.
365
+
366
+ ### Version 2.3.x
367
+
368
+ Rubyzip 2.3 is known to work on MRI 2.4 to 3.1 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.3 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.
369
+
370
+ ### Next (version 3.0.0)
371
+
372
+ Please see the table below for what we think the current situation is. Note: an empty cell means "unknown", not "does not work".
373
+
374
+ | OS/Ruby | 2.5 | 2.6 | 2.7 | 3.0 | 3.1 | 3.1 +YJIT | Head | Head +YJIT | JRuby 9.3.2.0 | JRuby Head | Truffleruby 21.3.0 | Truffleruby Head |
375
+ |---------|-----|-----|-----|-----|-----|----------|------|-----------|----------------|------------|--------------------|------------------|
376
+ |Ubuntu 20.04.3| CI | CI | CI | CI | CI | ci | ci | ci | CI | ci | CI | ci |
377
+ |Mac OS 11.6.2| CI | x | x | x | x | ci | | ci | x | | x | |
378
+ |Windows 10| | | x | | | | | | | | | |
379
+ |Windows Server 2019| CI | | | | | | | | | | | |
380
+
381
+ Key: `CI` - tested in CI, should work; `ci` - tested in CI, might fail; `x` - known working; `o` - known failing.
382
+
383
+ 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.
384
+
330
385
  ## Developing
331
386
 
332
- To run the test you need to do this:
387
+ Install the dependencies:
333
388
 
334
- ```
389
+ ```shell
335
390
  bundle install
391
+ ```
392
+
393
+ Run the tests with `rake`:
394
+
395
+ ```shell
336
396
  rake
337
397
  ```
338
398
 
399
+ Please also run `rubocop` over your changes.
400
+
401
+ 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.
402
+
339
403
  ## Website and Project Home
340
404
 
341
405
  http://github.com/rubyzip/rubyzip
@@ -344,17 +408,30 @@ http://rdoc.info/github/rubyzip/rubyzip/master/frames
344
408
 
345
409
  ## Authors
346
410
 
347
- Alexander Simonov ( alex at simonov.me)
411
+ See https://github.com/rubyzip/rubyzip/graphs/contributors for a comprehensive list.
348
412
 
349
- Alan Harper ( alan at aussiegeek.net)
413
+ ### Current maintainers
350
414
 
351
- Thomas Sondergaard (thomas at sondergaard.cc)
415
+ * Robert Haines (@hainesr)
416
+ * John Lees-Miller (@jdleesmiller)
417
+ * Oleksandr Simonov (@simonoff)
352
418
 
353
- Technorama Ltd. (oss-ruby-zip at technorama.net)
419
+ ### Original author
354
420
 
355
- extra-field support contributed by Tatsuki Sugiura (sugi at nemui.org)
421
+ * Thomas Sondergaard
356
422
 
357
423
  ## License
358
424
 
359
425
  Rubyzip is distributed under the same license as ruby. See
360
426
  http://www.ruby-lang.org/en/LICENSE.txt
427
+
428
+ ## Research notice
429
+ Please note that this repository is participating in a study into sustainability
430
+ of open source projects. Data will be gathered about this repository for
431
+ approximately the next 12 months, starting from June 2021.
432
+
433
+ Data collected will include number of contributors, number of PRs, time taken to
434
+ close/merge these PRs, and issues closed.
435
+
436
+ For more information, please visit
437
+ [our informational page](https://sustainable-open-science-and-software.github.io/) or download our [participant information sheet](https://sustainable-open-science-and-software.github.io/assets/PIS_sustainable_software.pdf).
data/Rakefile CHANGED
@@ -1,5 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler/gem_tasks'
2
4
  require 'rake/testtask'
5
+ require 'rdoc/task'
6
+ require 'rubocop/rake_task'
3
7
 
4
8
  task default: :test
5
9
 
@@ -10,9 +14,12 @@ Rake::TestTask.new(:test) do |test|
10
14
  test.verbose = true
11
15
  end
12
16
 
13
- # Rake::TestTask.new(:zip64_full_test) do |test|
14
- # test.libs << File.join(File.dirname(__FILE__), 'lib')
15
- # test.libs << File.join(File.dirname(__FILE__), 'test')
16
- # test.pattern = File.join(File.dirname(__FILE__), 'test/zip64_full_test.rb')
17
- # test.verbose = true
18
- # end
17
+ RDoc::Task.new do |rdoc|
18
+ rdoc.main = 'README.md'
19
+ rdoc.rdoc_files.include('README.md', 'lib/**/*.rb')
20
+ rdoc.options << '--markup=markdown'
21
+ rdoc.options << '--tab-width=2'
22
+ rdoc.options << "-t Rubyzip version #{::Zip::VERSION}"
23
+ end
24
+
25
+ RuboCop::RakeTask.new