rubyzip-bzip2 1.0.0 → 2.0.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 568ccb1b7481eecd0f87a943b4b8a44bab0daef37739e0eefb01bdf5719d92b8
4
- data.tar.gz: 59b1efa8e578d6334399745bedf424f13d1b9a1e4a4902c890902388f29afa71
3
+ metadata.gz: 20db3e6e7b08091759198d63dad3a626792e58d9425f4e4907d5ffcf623b0e83
4
+ data.tar.gz: 2e136c6ee2a45fd12ef88146e0c8efe7e86e8e12c55e7a254a65af46707caf13
5
5
  SHA512:
6
- metadata.gz: a789417a9bcc5ffe6ced70e29dbf2e6b64af2c522105201e8f77bf494be2d333f1178e09e949664a015d53cf1c5fe171bb8a056bcab46391e7bbc21b4fc64176
7
- data.tar.gz: 6f88e4f8e236c676c733f663f2fe5040cc89a4cd72aaa69ab8d3e6b51e365a0661a9a657a678e83525263d92ce06b41ac5e6dc13335320746d239ac303a35933
6
+ metadata.gz: f02c13f70d11881913bbd3f94bb03d930e921ef625a1f2793c472bc6c2367fe0541ba2c375614f9ccda01a905217f8d1a43a646e25204ab5120fe0e4c3a20e90
7
+ data.tar.gz: 180fa7d30af2d8b14fcb58946d02221469e532a837d5c31077bad5d3dfd2708628e6b12909c792fa51aa34471cc0d7b1b41169a1f52afff165ecfd57b885c6d3
@@ -12,7 +12,7 @@ jobs:
12
12
  - name: Install and set up ruby
13
13
  uses: ruby/setup-ruby@v1
14
14
  with:
15
- ruby-version: 2.4
15
+ ruby-version: '3.0'
16
16
  bundler-cache: true
17
17
 
18
18
  - name: Rubocop
@@ -8,12 +8,12 @@ jobs:
8
8
  fail-fast: false
9
9
  matrix:
10
10
  os: [ubuntu]
11
- ruby: ['2.4', '2.5', '2.6', '2.7', '3.0', '3.1', '3.2', '3.3', '3.4', head, jruby, jruby-head, truffleruby, truffleruby-head]
11
+ ruby: ['3.0', '3.1', '3.2', '3.3', '3.4', head, jruby, jruby-head, truffleruby, truffleruby-head]
12
12
  include:
13
13
  - os: macos
14
- ruby: '2.6'
14
+ ruby: '3.0'
15
15
  - os: windows
16
- ruby: '2.4.10'
16
+ ruby: '3.0'
17
17
  runs-on: ${{ matrix.os }}-latest
18
18
  continue-on-error: ${{ endsWith(matrix.ruby, 'head') || matrix.os == 'windows' }}
19
19
  steps:
@@ -30,8 +30,15 @@ jobs:
30
30
  - name: Install bzip2 library
31
31
  if: matrix.os == 'windows'
32
32
  run: |
33
- wget https://github.com/philr/bzip2-windows/releases/download/v1.0.8.0/bzip2-dll-1.0.8.0-win-x64.zip
34
- Expand-Archive -Path bzip2-dll-1.0.8.0-win-x64.zip -DestinationPath C:\hostedtoolcache\windows\Ruby\${{ matrix.ruby }}\x64\bin
33
+ Invoke-WebRequest `
34
+ -Uri https://github.com/philr/bzip2-windows/releases/download/v1.0.8.0/bzip2-dll-1.0.8.0-win-x64.zip `
35
+ -OutFile bzip2.zip `
36
+ -MaximumRetryCount 10 `
37
+ -RetryIntervalSec 2
38
+ $RubyBinPath = Split-Path (Get-Command ${{ startsWith(matrix.ruby, 'jruby') && 'j' || '' }}ruby.exe).Path
39
+ Write-Host $RubyBinPath
40
+ Expand-Archive -Path bzip2.zip -DestinationPath $RubyBinPath -Force
41
+ Get-Command bzip2.exe | Format-List
35
42
 
36
43
  - name: Run the tests
37
44
  env:
data/.rubocop.yml CHANGED
@@ -1,5 +1,16 @@
1
+ require:
2
+ - rubocop-performance
3
+ - rubocop-rake
4
+
5
+ # Set this to the minimum supported ruby in the gemspec. Otherwise
6
+ # we get errors if our ruby version doesn't match.
1
7
  AllCops:
2
- TargetRubyVersion: 2.4
8
+ SuggestExtensions: false
9
+ TargetRubyVersion: 3.0
10
+ NewCops: enable
11
+
12
+ Gemspec/DevelopmentDependencies:
13
+ EnforcedStyle: gemspec
3
14
 
4
15
  Layout/LineLength:
5
16
  Max: 120
data/.simplecov CHANGED
@@ -17,6 +17,6 @@ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new(
17
17
  )
18
18
 
19
19
  SimpleCov.start do
20
- # enable_coverage :branch <-- Re-enable this when we move to ruby ~> 2.5.
20
+ enable_coverage :branch
21
21
  add_filter ['/test/', '/samples/']
22
22
  end
data/Changelog.md CHANGED
@@ -1,4 +1,28 @@
1
- # X.X.X (Next)
1
+ # 2.0.0 (2025-08-22)
2
+
3
+ * Bump version number for RubyZip v3.0 support.
4
+ * Update to use RubyZip ~> 3.0.0.
5
+ * Update README with requirements for version 2.
6
+
7
+
8
+ ## Tooling and internal changes
9
+
10
+ * Enable branch coverage analysis.
11
+ * Update Rubocop and add extensions.
12
+ * Prefer `require_relative` where appropriate.
13
+ * Deal with Rubocop offences in gemspec.
14
+ * Fix Style/RedundantReturn Rubocop offences.
15
+ * Fix Style/OptionalBooleanParameter Rubocop offences.
16
+ * Fix Performance/UnfreezeString Rubocop offences.
17
+ * Fix Layout/LineContinuationSpacing Rubocop offences.
18
+ * Fix Style/FileRead Rubocop offences.
19
+ * Fix Layout/LeadingCommentSpace Rubocop offences.
20
+ * Update GitHub Actions to use rubies >= 3.0.
21
+ * Update Minitest and properly use it.
22
+ * Remove use of JRuby object space in tests.
23
+ * Update installation of bzip2 in windows tests.
24
+
25
+ # 1.0.0 (2025-02-07)
2
26
 
3
27
  * Fix automatic require
4
28
  * Fix the Libbz2::finalizer method.
data/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
  [![Tests](https://github.com/rubyzip/rubyzip-bzip2/actions/workflows/tests.yml/badge.svg)](https://github.com/rubyzip/rubyzip-bzip2/actions/workflows/tests.yml)
5
5
  [![Linter](https://github.com/rubyzip/rubyzip-bzip2/actions/workflows/lint.yml/badge.svg)](https://github.com/rubyzip/rubyzip-bzip2/actions/workflows/lint.yml)
6
6
  [![Code Climate](https://codeclimate.com/github/rubyzip/rubyzip-bzip2.svg)](https://codeclimate.com/github/rubyzip/rubyzip-bzip2)
7
- [![Coverage Status](https://img.shields.io/coveralls/rubyzip/rubyzip-bzip2.svg)](https://coveralls.io/r/rubyzip/rubyzip-bzip2?branch=master)
7
+ [![Coverage Status](https://img.shields.io/coveralls/rubyzip/rubyzip-bzip2.svg)](https://coveralls.io/r/rubyzip/rubyzip-bzip2?branch=main)
8
8
 
9
9
  The rubyzip-bzip2 gem provides an extension of the rubyzip gem for reading zip files compressed with bzip2 compression.
10
10
 
@@ -12,7 +12,14 @@ The rubyzip-bzip2 gem provides an extension of the rubyzip gem for reading zip f
12
12
  http://github.com/rubyzip/rubyzip-bzip2
13
13
 
14
14
  ## Requirements
15
- - Ruby 2.4 or greater
15
+
16
+ Version 2.x of this library:
17
+ * Ruby 3.0 or greater
18
+ * Rubyzip 3.0.x
19
+
20
+ Version 1.x of this library:
21
+ * Ruby 2.4 or greater
22
+ * Rubyzip 2.4.x
16
23
 
17
24
  ## Installation
18
25
  The rubyzip-bzip2 gem is available on RubyGems:
@@ -28,7 +35,7 @@ gem 'rubyzip-bzip2'
28
35
  ```
29
36
 
30
37
  ## Usage
31
- Reading a zip file with bzip2 compression is not different from reading
38
+ Reading a zip file with bzip2 compression is no different from reading
32
39
  any other zip file using rubyzip:
33
40
 
34
41
  ```ruby
data/Rakefile CHANGED
@@ -1,12 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'bundler/gem_tasks'
4
- require 'rake/testtask'
4
+ require 'minitest/test_task'
5
+ require 'rubocop/rake_task'
5
6
 
6
- Rake::TestTask.new(:test) do |t|
7
- t.libs << 'test'
8
- t.libs << 'lib'
9
- t.test_files = FileList['test/**/*_test.rb']
7
+ task default: :test
8
+
9
+ Minitest::TestTask.create do |test|
10
+ test.framework = 'require "simplecov"'
11
+ test.test_globs = 'test/**/*_test.rb'
10
12
  end
11
13
 
12
- task default: :test
14
+ RuboCop::RakeTask.new
@@ -1,24 +1,24 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'zip/bzip2/libbz2'
3
+ require_relative 'libbz2'
4
4
 
5
5
  module Zip
6
6
  module Bzip2
7
- class Decompress #:nodoc:
7
+ class Decompress # :nodoc:
8
8
  OUTPUT_BUFFER_SIZE = 4096
9
9
 
10
10
  def initialize(options = {})
11
11
  small = options[:small]
12
12
 
13
13
  @libbz2 = Libbz2.new.tap do |libbz2|
14
- libbz2.decompress_init!(small)
14
+ libbz2.decompress_init!(small: small)
15
15
  end
16
16
 
17
17
  @finished = false
18
18
  end
19
19
 
20
20
  def decompress(data)
21
- result = ''.dup
21
+ result = +''
22
22
 
23
23
  with_input_buffer(data) do |input_buffer|
24
24
  @libbz2.input_buffer = input_buffer
@@ -1,19 +1,18 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'zip'
4
- require 'zip/bzip2/decompress'
3
+ require_relative 'decompress'
5
4
 
6
- module Zip #:nodoc:
5
+ module Zip # :nodoc:
7
6
  module Bzip2
8
- class Decompressor < ::Zip::Decompressor #:nodoc:
7
+ class Decompressor < ::Zip::Decompressor # :nodoc:
9
8
  def initialize(*args)
10
9
  super
11
10
 
12
- @buffer = ''.dup
11
+ @buffer = +''
13
12
  @bzip2_ffi_decompressor = ::Zip::Bzip2::Decompress.new
14
13
  end
15
14
 
16
- def read(length = nil, outbuf = ''.dup)
15
+ def read(length = nil, outbuf = +'')
17
16
  return return_value_on_eof(length) if eof
18
17
 
19
18
  fill_buffer(length)
@@ -30,7 +29,7 @@ module Zip #:nodoc:
30
29
  private
31
30
 
32
31
  def return_value_on_eof(length)
33
- return '' if length.nil? || length.zero?
32
+ '' if length.nil? || length.zero?
34
33
  end
35
34
 
36
35
  def fill_buffer(min_length)
@@ -11,7 +11,7 @@ module Zip
11
11
  # Initializes a new instance of MemError.
12
12
  #
13
13
  # @private
14
- def initialize #:nodoc:
14
+ def initialize # :nodoc:
15
15
  super('Could not allocate enough memory to perform this request')
16
16
  end
17
17
  end
@@ -23,10 +23,10 @@ module Zip
23
23
  #
24
24
  # @param message [String] Exception message (overrides the default).
25
25
  # @private
26
- def initialize(message = nil) #:nodoc:
26
+ def initialize(message = nil) # :nodoc:
27
27
  super(
28
28
  message ||
29
- 'Data integrity error detected (mismatch between stored and computed CRCs, '\
29
+ 'Data integrity error detected (mismatch between stored and computed CRCs, ' \
30
30
  'or other anomaly in the compressed data)',
31
31
  )
32
32
  end
@@ -38,7 +38,7 @@ module Zip
38
38
  # Initializes a new instance of MagicDataError.
39
39
  #
40
40
  # @private
41
- def initialize #:nodoc:
41
+ def initialize # :nodoc:
42
42
  super('Compressed data does not start with the correct magic bytes (\'BZh\')')
43
43
  end
44
44
  end
@@ -48,7 +48,7 @@ module Zip
48
48
  # Initializes a new instance of ConfigError.
49
49
  #
50
50
  # @private
51
- def initialize #:nodoc:
51
+ def initialize # :nodoc:
52
52
  super('libbz2 has been improperly compiled on your platform')
53
53
  end
54
54
  end
@@ -59,7 +59,7 @@ module Zip
59
59
  #
60
60
  # @param error_code [Integer] The error_code reported by libbz2.
61
61
  # @private
62
- def initialize(error_code) #:nodoc:
62
+ def initialize(error_code) # :nodoc:
63
63
  super("An unexpected error was detected (error code: #{error_code})")
64
64
  end
65
65
  end
@@ -34,7 +34,7 @@ module Zip
34
34
  # See bzlib.h and http://bzip.org/docs.html.
35
35
  #
36
36
  # @private
37
- module Libbz2 #:nodoc:
37
+ module Libbz2 # :nodoc:
38
38
  extend ::FFI::Library
39
39
 
40
40
  ffi_lib ['bz2', 'libbz2.so.1', 'libbz2.dll']
@@ -62,7 +62,7 @@ module Zip
62
62
  callback :bzfree, %i[pointer pointer], :void
63
63
 
64
64
  # typedef struct { ... } bz_stream;
65
- class BzStream < ::FFI::Struct #:nodoc:
65
+ class BzStream < ::FFI::Struct # :nodoc:
66
66
  layout :next_in, :pointer,
67
67
  :avail_in, :uint,
68
68
  :total_in_lo32, :uint,
@@ -1,12 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'ffi'
4
- require 'zip/bzip2/errors'
5
- require 'zip/bzip2/ffi/libbz2'
3
+ require_relative 'errors'
4
+ require_relative 'ffi/libbz2'
6
5
 
7
6
  module Zip
8
7
  module Bzip2
9
- class Libbz2 #:nodoc:
8
+ class Libbz2 # :nodoc:
10
9
  def self.finalizer(stream)
11
10
  lambda do |_id|
12
11
  FFI::Libbz2::BZ2_bzDecompressEnd(stream)
@@ -28,7 +27,7 @@ module Zip
28
27
  @stream = FFI::Libbz2::BzStream.new
29
28
  end
30
29
 
31
- def decompress_init!(small = false)
30
+ def decompress_init!(small: false)
32
31
  result = FFI::Libbz2::BZ2_bzDecompressInit(@stream, 0, small ? 1 : 0)
33
32
  check_error(result)
34
33
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Zip
4
4
  module Bzip2
5
- VERSION = '1.0.0'
5
+ VERSION = '2.0.0'
6
6
  end
7
7
  end
data/lib/zip/bzip2.rb CHANGED
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'zip'
4
- require 'zip/bzip2/version'
5
- require 'zip/bzip2/decompressor'
4
+ require_relative 'bzip2/version'
5
+ require_relative 'bzip2/decompressor'
6
6
 
7
7
  module Zip
8
8
  # The Zip::Bzip2 module extends Rubyzip with support for the bzip2 compression method.
@@ -1,25 +1,23 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- lib = File.expand_path('lib', __dir__)
4
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
- require 'zip/bzip2/version'
3
+ require_relative 'lib/zip/bzip2/version'
6
4
 
7
5
  Gem::Specification.new do |spec|
8
6
  spec.name = 'rubyzip-bzip2'
9
- spec.version = ::Zip::Bzip2::VERSION
7
+ spec.version = Zip::Bzip2::VERSION
10
8
  spec.authors = [
11
9
  'Jan-Joost Spanjers', 'Robert Haines'
12
10
  ]
13
11
 
14
12
  spec.summary = 'Extension of rubyzip to read bzip2 compressed files'
15
13
  spec.description =
16
- 'The rubyzip-bzip2 gem provides an extension of the rubyzip gem '\
14
+ 'The rubyzip-bzip2 gem provides an extension of the rubyzip gem ' \
17
15
  'for reading zip files compressed with bzip2 compression'
18
16
  spec.homepage = 'http://github.com/rubyzip/rubyzip-bzip2'
19
17
  spec.license = 'BSD 2-Clause'
20
18
  spec.require_paths = ['lib']
21
19
 
22
- spec.required_ruby_version = '>= 2.4'
20
+ spec.required_ruby_version = '>= 3.0'
23
21
 
24
22
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
25
23
  f.match(%r{^(test|spec|features)/})
@@ -35,11 +33,13 @@ Gem::Specification.new do |spec|
35
33
  }
36
34
 
37
35
  spec.add_dependency 'ffi', '~> 1.0'
38
- spec.add_dependency 'rubyzip', '~> 2.4', '< 3.0'
36
+ spec.add_dependency 'rubyzip', '~> 3.0.0'
39
37
 
40
- spec.add_development_dependency 'minitest', '~> 5.15'
38
+ spec.add_development_dependency 'minitest', '~> 5.25'
41
39
  spec.add_development_dependency 'rake', '~> 13.2'
42
- spec.add_development_dependency 'rubocop', '~> 0.79.0'
40
+ spec.add_development_dependency 'rubocop', '~> 1.61.0'
41
+ spec.add_development_dependency 'rubocop-performance', '~> 1.20.0'
42
+ spec.add_development_dependency 'rubocop-rake', '~> 0.6.0'
43
43
  spec.add_development_dependency 'simplecov', '~> 0.18.0'
44
44
  spec.add_development_dependency 'simplecov-lcov', '~> 0.8'
45
45
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubyzip-bzip2
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan-Joost Spanjers
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2025-02-07 00:00:00.000000000 Z
12
+ date: 2025-08-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ffi
@@ -31,34 +31,28 @@ dependencies:
31
31
  requirements:
32
32
  - - "~>"
33
33
  - !ruby/object:Gem::Version
34
- version: '2.4'
35
- - - "<"
36
- - !ruby/object:Gem::Version
37
- version: '3.0'
34
+ version: 3.0.0
38
35
  type: :runtime
39
36
  prerelease: false
40
37
  version_requirements: !ruby/object:Gem::Requirement
41
38
  requirements:
42
39
  - - "~>"
43
40
  - !ruby/object:Gem::Version
44
- version: '2.4'
45
- - - "<"
46
- - !ruby/object:Gem::Version
47
- version: '3.0'
41
+ version: 3.0.0
48
42
  - !ruby/object:Gem::Dependency
49
43
  name: minitest
50
44
  requirement: !ruby/object:Gem::Requirement
51
45
  requirements:
52
46
  - - "~>"
53
47
  - !ruby/object:Gem::Version
54
- version: '5.15'
48
+ version: '5.25'
55
49
  type: :development
56
50
  prerelease: false
57
51
  version_requirements: !ruby/object:Gem::Requirement
58
52
  requirements:
59
53
  - - "~>"
60
54
  - !ruby/object:Gem::Version
61
- version: '5.15'
55
+ version: '5.25'
62
56
  - !ruby/object:Gem::Dependency
63
57
  name: rake
64
58
  requirement: !ruby/object:Gem::Requirement
@@ -79,14 +73,42 @@ dependencies:
79
73
  requirements:
80
74
  - - "~>"
81
75
  - !ruby/object:Gem::Version
82
- version: 0.79.0
76
+ version: 1.61.0
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - "~>"
82
+ - !ruby/object:Gem::Version
83
+ version: 1.61.0
84
+ - !ruby/object:Gem::Dependency
85
+ name: rubocop-performance
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - "~>"
89
+ - !ruby/object:Gem::Version
90
+ version: 1.20.0
91
+ type: :development
92
+ prerelease: false
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - "~>"
96
+ - !ruby/object:Gem::Version
97
+ version: 1.20.0
98
+ - !ruby/object:Gem::Dependency
99
+ name: rubocop-rake
100
+ requirement: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - "~>"
103
+ - !ruby/object:Gem::Version
104
+ version: 0.6.0
83
105
  type: :development
84
106
  prerelease: false
85
107
  version_requirements: !ruby/object:Gem::Requirement
86
108
  requirements:
87
109
  - - "~>"
88
110
  - !ruby/object:Gem::Version
89
- version: 0.79.0
111
+ version: 0.6.0
90
112
  - !ruby/object:Gem::Dependency
91
113
  name: simplecov
92
114
  requirement: !ruby/object:Gem::Requirement
@@ -147,9 +169,9 @@ licenses:
147
169
  - BSD 2-Clause
148
170
  metadata:
149
171
  bug_tracker_uri: https://github.com/rubyzip/rubyzip-bzip2/issues
150
- changelog_uri: https://github.com/rubyzip/rubyzip-bzip2/blob/v1.0.0/Changelog.md
151
- documentation_uri: https://www.rubydoc.info/gems/rubyzip-bzip2/1.0.0
152
- source_code_uri: https://github.com/rubyzip/rubyzip-bzip2/tree/v1.0.0
172
+ changelog_uri: https://github.com/rubyzip/rubyzip-bzip2/blob/v2.0.0/Changelog.md
173
+ documentation_uri: https://www.rubydoc.info/gems/rubyzip-bzip2/2.0.0
174
+ source_code_uri: https://github.com/rubyzip/rubyzip-bzip2/tree/v2.0.0
153
175
  wiki_uri: https://github.com/rubyzip/rubyzip-bzip2/wiki
154
176
  rubygems_mfa_required: 'true'
155
177
  post_install_message:
@@ -160,7 +182,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
160
182
  requirements:
161
183
  - - ">="
162
184
  - !ruby/object:Gem::Version
163
- version: '2.4'
185
+ version: '3.0'
164
186
  required_rubygems_version: !ruby/object:Gem::Requirement
165
187
  requirements:
166
188
  - - ">="