Commit Graph

449 Commits

Author SHA1 Message Date
Robert Haines 6c4b7a9f90 Move to version `2.4.1` due to clash with `2.4`. 2025-01-05 18:15:02 +00:00
Robert Haines e3eb62491b Make sure version number is 2.4.0.
And add a test to keep version numbers consistent from now on.

Fixes: #623
2025-01-05 11:43:53 +00:00
Robert Haines c09352b546 Bump version and Changelog for release. 2025-01-04 10:12:55 +00:00
Tsutomu Katsube 56954b0b59 Suppress "literal string will be frozen in the future" warning
Ref: https://bugs.ruby-lang.org/issues/20205

This patch will suppress the "literal string will be frozen in the
future" warning on the 2.4 branch.

Steps to reproduce
---

Run the following commands with ruby 3.4.0preview1:

```console
$ cd /tmp
$ git clone git@github.com:rubyzip/rubyzip.git
$ cd rubyzip
$ git switch 2.4
$ bundle install
$ ruby -I lib -W:deprecated -e '
require "zip"

Zip::File.open("test/data/ntfs.zip") do |zip_file|
  zip_file.each do |entry|
    puts entry.get_input_stream.read
  end
end
'
```

Expected result
---

```console
ntfs test
```

Actual result
---

```console
/private/tmp/rubyzip/lib/zip/extra_field/ntfs.rb:54: warning: literal string will be frozen in the future
ntfs test
```

Environment
---

```console
$ ruby -v
ruby 3.4.0preview1 (2024-05-16 master 9d69619623) [x86_64-darwin23]
```
2024-09-21 09:06:36 +09:00
Jean Boussier a4c3f5bddb Fix deprecation in Entry#get_input_stream 2024-04-09 16:37:04 +01:00
Jean Boussier 57cff3338f Fix `File#write_buffer` to always return the given `io`
Ref: ef89a62b70

This fixes a regression in 2.4.rc1.
2024-04-09 10:05:18 +01:00
Robert Haines 0001864cfe Bump version, Changelog and README for release. 2024-04-08 16:15:44 +01:00
Jean Boussier 385ebd054a Ensure compatibility with `--enable-frozen-string-literal`
Ref: https://bugs.ruby-lang.org/issues/20205

In Ruby 3.4 string literals will be "chilled" by default. Meaning
they are still mutable, but will pretend to be frozen.

In most case it has no impact, just emit a few warnings there and
there, but there is one thing it impacts is the `StringIO.new('')`
pattern. `StringIO` checks if the given string is frozen, and if
it is will act as a read only IO.

This breaks rubyzip 2.x.

This commit make the 2.x branch compatible with frozen string literals.
2024-04-08 15:10:07 +01:00
Robert Haines ef89a62b70 Ensure `File.open_buffer` doesn't rewrite unchanged data.
This is a backport of 14b63f68 from trunk.
2024-04-08 12:44:12 +01:00
Robert Haines 900db76760 Handle the `extract` methods in `Entry` and `File`.
Add v3 versions and warning messages to the v2 versions. We need to do
these methods like this because the new versions are very different.
2024-03-10 17:21:53 +00:00
Robert Haines 14efdd1cc4 Add `DOSTime#<=>` and a warning message to `DOSTime#dos_equals`.
`#dos_equals` now uses `#==` for its implementation.
2024-03-10 11:34:36 +00:00
Robert Haines 02faddaf44 Add warning messages to `File#get_output_stream`. 2024-03-10 09:00:17 +00:00
Robert Haines 9aa5964262 Add warning messages to the `File` class methods.
* `new`
 * `open`
 * `open_buffer`
2024-03-10 08:03:49 +00:00
Robert Haines 07d833ca78 Add warning messages to `InputStream.open`. 2024-03-03 18:06:51 +00:00
Robert Haines 6bbda380fe Add warning messages to deprectated methods.
* File.add_buffer
 * InputStream.open_buffer
2024-03-02 18:50:47 +00:00
Robert Haines a6e6c3c469 Update rubocop fails. 2024-03-02 18:38:00 +00:00
Robert Haines f68877920a Update File.split API to allow v3.0 calling style. 2024-03-02 08:23:27 +00:00
Robert Haines 4b1cfba9db Add warning message (and tests) to OutputStream. 2024-03-01 18:05:06 +00:00
Robert Haines 5e9ee53c70 Add warning message to InputStream. 2024-03-01 18:05:06 +00:00
Robert Haines cb0505d735 Add a switchable warning message re the v3 API.
Switched via an environment variable, and tested.
2024-03-01 18:05:06 +00:00
Robert Haines 49950d924c Update Entry#new API to allow v3.0 calling style.
See https://github.com/rubyzip/rubyzip/wiki/Updating-to-version-3.x#new-1
for details.
2024-03-01 18:05:06 +00:00
Robert Haines a17da19e0c Update InputStream API to allow v3.0 calling style.
See https://github.com/rubyzip/rubyzip/wiki/Updating-to-version-3.x#zipinputstream
for details.
2024-03-01 18:05:06 +00:00
Robert Haines 7c1a8fbf8f Update OutputStream API to allow v3.0 calling style.
See https://github.com/rubyzip/rubyzip/wiki/Updating-to-version-3.x#zipoutputstream
for details.
2024-03-01 18:05:06 +00:00
Robert Haines 2f1c1ea400 Move to using a post install message for 3.0 warning. 2021-07-05 20:13:36 +01:00
Robert Haines 84d7a66abc Bump version number and Changelog. 2021-07-03 12:10:30 +01:00
John Lees-Miller 69186f65cd Bump version to 2.3.0 2020-03-14 11:31: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 66324a711c Remove duplicate binmode call 2020-03-02 11:06:50 +01:00
Robert Haines c30d9dfb26 Configure Naming/MemoizedInstanceVariableName in source.
Rather than turn it off for a whole file, it's better to mark these
exceptions in comments.
2020-02-29 18:11:52 +00:00
Robert Haines f9b161eb32 Fix Naming/VariableName cop in the library code. 2020-02-29 18:11:52 +00:00
Robert Haines aa6ea05d45 Fix Naming/MethodParameterName cop in the library code. 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 989a565340 Fix Style/TrailingCommaInHashLiteral cop. 2020-02-15 16:26:32 +00:00
Robert Haines d07b36b2e6 Fix Style/TernaryParentheses 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 2f993221c0 Fix Style/Next cop. 2020-02-15 16:26:32 +00:00
Robert Haines 835843d992 Fix Naming/HeredocDelimiterCase cop. 2020-02-15 16:26:32 +00:00
Robert Haines d42c66ce2c Fix Style/MultilineWhenThen cop. 2020-02-15 16:26:32 +00:00
Robert Haines 2dfe092728 Fix Style/UnpackFirst cop. 2020-02-15 16:26:32 +00:00
Robert Haines 4e1b679c73 Fix Style/TrailingCommaInArrayLiteral 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 3121ad066f Fix Style/Alias cop. 2020-02-15 16:26:32 +00:00
Robert Haines 468a80ce02 Fix Style/IfInsideElse cop. 2020-02-15 16:26:32 +00:00
Robert Haines b3f241353a Fix Style/CommentedKeyword cop. 2020-02-15 16:26:32 +00:00
Robert Haines 5a1baf46ab Fix Style/RedundantReturn cop. 2020-02-15 16:26:32 +00:00