rubyzip-bzip2 0.0.1 → 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 +4 -4
- data/.github/workflows/lint.yml +19 -0
- data/.github/workflows/tests.yml +64 -0
- data/.gitignore +9 -0
- data/.rubocop.yml +19 -0
- data/.simplecov +22 -0
- data/Changelog.md +57 -0
- data/Gemfile +5 -0
- data/LICENSE.md +24 -0
- data/README.md +26 -8
- data/Rakefile +14 -0
- data/bin/console +8 -0
- data/lib/rubyzip/bzip2.rb +3 -0
- data/lib/zip/bzip2/decompress.rb +4 -4
- data/lib/zip/bzip2/decompressor.rb +6 -7
- data/lib/zip/bzip2/errors.rb +6 -6
- data/lib/zip/bzip2/ffi/libbz2.rb +2 -2
- data/lib/zip/bzip2/libbz2.rb +7 -8
- data/lib/zip/bzip2/version.rb +1 -1
- data/lib/zip/bzip2.rb +2 -2
- data/rubyzip-bzip2.gemspec +45 -0
- metadata +52 -38
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 20db3e6e7b08091759198d63dad3a626792e58d9425f4e4907d5ffcf623b0e83
|
4
|
+
data.tar.gz: 2e136c6ee2a45fd12ef88146e0c8efe7e86e8e12c55e7a254a65af46707caf13
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f02c13f70d11881913bbd3f94bb03d930e921ef625a1f2793c472bc6c2367fe0541ba2c375614f9ccda01a905217f8d1a43a646e25204ab5120fe0e4c3a20e90
|
7
|
+
data.tar.gz: 180fa7d30af2d8b14fcb58946d02221469e532a837d5c31077bad5d3dfd2708628e6b12909c792fa51aa34471cc0d7b1b41169a1f52afff165ecfd57b885c6d3
|
@@ -0,0 +1,19 @@
|
|
1
|
+
name: Linter
|
2
|
+
|
3
|
+
on: [push, pull_request]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
lint:
|
7
|
+
runs-on: ubuntu-latest
|
8
|
+
steps:
|
9
|
+
- name: Checkout rubyzip-bzip2 code
|
10
|
+
uses: actions/checkout@v4
|
11
|
+
|
12
|
+
- name: Install and set up ruby
|
13
|
+
uses: ruby/setup-ruby@v1
|
14
|
+
with:
|
15
|
+
ruby-version: '3.0'
|
16
|
+
bundler-cache: true
|
17
|
+
|
18
|
+
- name: Rubocop
|
19
|
+
run: bundle exec rubocop
|
@@ -0,0 +1,64 @@
|
|
1
|
+
name: Tests
|
2
|
+
|
3
|
+
on: [push, pull_request]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
test:
|
7
|
+
strategy:
|
8
|
+
fail-fast: false
|
9
|
+
matrix:
|
10
|
+
os: [ubuntu]
|
11
|
+
ruby: ['3.0', '3.1', '3.2', '3.3', '3.4', head, jruby, jruby-head, truffleruby, truffleruby-head]
|
12
|
+
include:
|
13
|
+
- os: macos
|
14
|
+
ruby: '3.0'
|
15
|
+
- os: windows
|
16
|
+
ruby: '3.0'
|
17
|
+
runs-on: ${{ matrix.os }}-latest
|
18
|
+
continue-on-error: ${{ endsWith(matrix.ruby, 'head') || matrix.os == 'windows' }}
|
19
|
+
steps:
|
20
|
+
- name: Checkout rubyzip-bzip2 code
|
21
|
+
uses: actions/checkout@v4
|
22
|
+
|
23
|
+
- name: Install and set up ruby
|
24
|
+
uses: ruby/setup-ruby@v1
|
25
|
+
with:
|
26
|
+
ruby-version: ${{ matrix.ruby }}
|
27
|
+
rubygems: latest
|
28
|
+
bundler-cache: true
|
29
|
+
|
30
|
+
- name: Install bzip2 library
|
31
|
+
if: matrix.os == 'windows'
|
32
|
+
run: |
|
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
|
42
|
+
|
43
|
+
- name: Run the tests
|
44
|
+
env:
|
45
|
+
JRUBY_OPTS: --debug
|
46
|
+
run: bundle exec rake
|
47
|
+
|
48
|
+
- name: Coveralls
|
49
|
+
if: matrix.os == 'ubuntu' && !endsWith(matrix.ruby, 'head')
|
50
|
+
uses: coverallsapp/github-action@v2
|
51
|
+
with:
|
52
|
+
github-token: ${{ secrets.github_token }}
|
53
|
+
flag-name: ${{ matrix.ruby }}
|
54
|
+
parallel: true
|
55
|
+
|
56
|
+
finish:
|
57
|
+
needs: test
|
58
|
+
runs-on: ubuntu-latest
|
59
|
+
steps:
|
60
|
+
- name: Coveralls Finished
|
61
|
+
uses: coverallsapp/github-action@v2
|
62
|
+
with:
|
63
|
+
github-token: ${{ secrets.github_token }}
|
64
|
+
parallel-finished: true
|
data/.gitignore
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,19 @@
|
|
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.
|
7
|
+
AllCops:
|
8
|
+
SuggestExtensions: false
|
9
|
+
TargetRubyVersion: 3.0
|
10
|
+
NewCops: enable
|
11
|
+
|
12
|
+
Gemspec/DevelopmentDependencies:
|
13
|
+
EnforcedStyle: gemspec
|
14
|
+
|
15
|
+
Layout/LineLength:
|
16
|
+
Max: 120
|
17
|
+
|
18
|
+
Metrics/MethodLength:
|
19
|
+
Max: 15
|
data/.simplecov
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'simplecov-lcov'
|
4
|
+
|
5
|
+
SimpleCov::Formatter::LcovFormatter.config do |c|
|
6
|
+
c.output_directory = 'coverage'
|
7
|
+
c.lcov_file_name = 'lcov.info'
|
8
|
+
c.report_with_single_file = true
|
9
|
+
c.single_report_path = 'coverage/lcov.info'
|
10
|
+
end
|
11
|
+
|
12
|
+
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new(
|
13
|
+
[
|
14
|
+
SimpleCov::Formatter::HTMLFormatter,
|
15
|
+
SimpleCov::Formatter::LcovFormatter
|
16
|
+
]
|
17
|
+
)
|
18
|
+
|
19
|
+
SimpleCov.start do
|
20
|
+
enable_coverage :branch
|
21
|
+
add_filter ['/test/', '/samples/']
|
22
|
+
end
|
data/Changelog.md
ADDED
@@ -0,0 +1,57 @@
|
|
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)
|
26
|
+
|
27
|
+
* Fix automatic require
|
28
|
+
* Fix the Libbz2::finalizer method.
|
29
|
+
|
30
|
+
## Tooling and internal changes
|
31
|
+
|
32
|
+
* Fix tests on Windows
|
33
|
+
* Use github actions for CI
|
34
|
+
* Add require statement to the example
|
35
|
+
* Add LICENSE file
|
36
|
+
* Use Markdown for the LICENSE and tidy up the README.
|
37
|
+
* Update GitHub Actions workflows.
|
38
|
+
* Update version of Rake to fix security alert.
|
39
|
+
* Remove Pry and Guard development dependencies.
|
40
|
+
* Update minimum version of RubyZip required.
|
41
|
+
* Update MiniTest dependency.
|
42
|
+
* Add a test to ensure correct version number format.
|
43
|
+
* Add `bin/console'.
|
44
|
+
* Require MFA for RubyGems operations.
|
45
|
+
* Tighten-up RuboCop configuration.
|
46
|
+
|
47
|
+
# 0.0.1
|
48
|
+
|
49
|
+
* Initial version
|
50
|
+
|
51
|
+
## About this Changelog file
|
52
|
+
|
53
|
+
This file is, at least in part, generated by the following command:
|
54
|
+
|
55
|
+
```shell
|
56
|
+
$ git log --pretty=format:"* %s" --reverse --no-merges <commit-hash>..
|
57
|
+
```
|
data/Gemfile
ADDED
data/LICENSE.md
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
BSD 2-Clause License
|
2
|
+
|
3
|
+
Copyright (c) 2020-2025, Jan-Joost Spanjers and The Rubyzip Developers
|
4
|
+
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
6
|
+
modification, are permitted provided that the following conditions are met:
|
7
|
+
|
8
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
9
|
+
list of conditions and the following disclaimer.
|
10
|
+
|
11
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
12
|
+
this list of conditions and the following disclaimer in the documentation
|
13
|
+
and/or other materials provided with the distribution.
|
14
|
+
|
15
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
16
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
17
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
18
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
19
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
20
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
21
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
22
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
23
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
24
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
data/README.md
CHANGED
@@ -1,18 +1,25 @@
|
|
1
1
|
# rubyzip-bzip2
|
2
2
|
|
3
3
|
[](http://badge.fury.io/rb/rubyzip-bzip2)
|
4
|
-
[](https://github.com/rubyzip/rubyzip-bzip2/actions/workflows/tests.yml)
|
5
|
+
[](https://github.com/rubyzip/rubyzip-bzip2/actions/workflows/lint.yml)
|
5
6
|
[](https://codeclimate.com/github/rubyzip/rubyzip-bzip2)
|
6
|
-
[](https://coveralls.io/r/rubyzip/rubyzip-bzip2?branch=
|
7
|
+
[](https://coveralls.io/r/rubyzip/rubyzip-bzip2?branch=main)
|
7
8
|
|
8
|
-
The rubyzip-bzip2 gem provides an extension of the rubyzip gem for reading zip files
|
9
|
-
compressed with bzip2 compression.
|
9
|
+
The rubyzip-bzip2 gem provides an extension of the rubyzip gem for reading zip files compressed with bzip2 compression.
|
10
10
|
|
11
11
|
## Website and Project Home
|
12
12
|
http://github.com/rubyzip/rubyzip-bzip2
|
13
13
|
|
14
14
|
## Requirements
|
15
|
-
|
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,10 +35,12 @@ gem 'rubyzip-bzip2'
|
|
28
35
|
```
|
29
36
|
|
30
37
|
## Usage
|
31
|
-
Reading a zip file with bzip2 compression is
|
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
|
42
|
+
require 'zip/bzip2'
|
43
|
+
|
35
44
|
Zip::File.open('foo.zip') do |zipfile|
|
36
45
|
zipfile.each do |entry|
|
37
46
|
content = zipfile.read(entry.name)
|
@@ -41,8 +50,7 @@ end
|
|
41
50
|
```
|
42
51
|
|
43
52
|
## License
|
44
|
-
Rubyzip-bzip2 is distributed under the same license as ruby.
|
45
|
-
http://www.ruby-lang.org/en/LICENSE.txt
|
53
|
+
Rubyzip-bzip2 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.
|
46
54
|
|
47
55
|
## Contributing
|
48
56
|
Bug reports and pull requests are welcome on GitHub at https://github.com/rubyzip/rubyzip-bzip2.
|
@@ -56,4 +64,14 @@ rake
|
|
56
64
|
```
|
57
65
|
|
58
66
|
## Authors
|
67
|
+
|
68
|
+
See https://github.com/rubyzip/rubyzip-bzip2/graphs/contributors for a comprehensive list.
|
69
|
+
|
70
|
+
### Current maintainers
|
71
|
+
|
72
|
+
* Robert Haines (@hainesr)
|
73
|
+
* John Lees-Miller (@jdleesmiller)
|
74
|
+
* Oleksandr Simonov (@simonoff)
|
75
|
+
|
76
|
+
### Original author
|
59
77
|
Jan-Joost Spanjers ( oss at hiberis.nl )
|
data/Rakefile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'bundler/gem_tasks'
|
4
|
+
require 'minitest/test_task'
|
5
|
+
require 'rubocop/rake_task'
|
6
|
+
|
7
|
+
task default: :test
|
8
|
+
|
9
|
+
Minitest::TestTask.create do |test|
|
10
|
+
test.framework = 'require "simplecov"'
|
11
|
+
test.test_globs = 'test/**/*_test.rb'
|
12
|
+
end
|
13
|
+
|
14
|
+
RuboCop::RakeTask.new
|
data/bin/console
ADDED
data/lib/zip/bzip2/decompress.rb
CHANGED
@@ -1,24 +1,24 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
require_relative 'libbz2'
|
4
4
|
|
5
5
|
module Zip
|
6
6
|
module Bzip2
|
7
|
-
class Decompress
|
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 = ''
|
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
|
-
|
4
|
-
require 'zip/bzip2/decompress'
|
3
|
+
require_relative 'decompress'
|
5
4
|
|
6
|
-
module Zip
|
5
|
+
module Zip # :nodoc:
|
7
6
|
module Bzip2
|
8
|
-
class Decompressor < ::Zip::Decompressor
|
7
|
+
class Decompressor < ::Zip::Decompressor # :nodoc:
|
9
8
|
def initialize(*args)
|
10
9
|
super
|
11
10
|
|
12
|
-
@buffer = ''
|
11
|
+
@buffer = +''
|
13
12
|
@bzip2_ffi_decompressor = ::Zip::Bzip2::Decompress.new
|
14
13
|
end
|
15
14
|
|
16
|
-
def read(length = nil, outbuf = ''
|
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
|
-
|
32
|
+
'' if length.nil? || length.zero?
|
34
33
|
end
|
35
34
|
|
36
35
|
def fill_buffer(min_length)
|
data/lib/zip/bzip2/errors.rb
CHANGED
@@ -11,7 +11,7 @@ module Zip
|
|
11
11
|
# Initializes a new instance of MemError.
|
12
12
|
#
|
13
13
|
# @private
|
14
|
-
def initialize
|
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)
|
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
|
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
|
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)
|
62
|
+
def initialize(error_code) # :nodoc:
|
63
63
|
super("An unexpected error was detected (error code: #{error_code})")
|
64
64
|
end
|
65
65
|
end
|
data/lib/zip/bzip2/ffi/libbz2.rb
CHANGED
@@ -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
|
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
|
65
|
+
class BzStream < ::FFI::Struct # :nodoc:
|
66
66
|
layout :next_in, :pointer,
|
67
67
|
:avail_in, :uint,
|
68
68
|
:total_in_lo32, :uint,
|
data/lib/zip/bzip2/libbz2.rb
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
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
|
10
|
-
def self.finalizer
|
8
|
+
class Libbz2 # :nodoc:
|
9
|
+
def self.finalizer(stream)
|
11
10
|
lambda do |_id|
|
12
|
-
|
11
|
+
FFI::Libbz2::BZ2_bzDecompressEnd(stream)
|
13
12
|
end
|
14
13
|
end
|
15
14
|
private_class_method :finalizer
|
@@ -28,11 +27,11 @@ module Zip
|
|
28
27
|
@stream = FFI::Libbz2::BzStream.new
|
29
28
|
end
|
30
29
|
|
31
|
-
def decompress_init!(small
|
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
|
|
35
|
-
ObjectSpace.define_finalizer(self, self.class.send(:finalizer))
|
34
|
+
ObjectSpace.define_finalizer(self, self.class.send(:finalizer, @stream))
|
36
35
|
|
37
36
|
true
|
38
37
|
end
|
data/lib/zip/bzip2/version.rb
CHANGED
data/lib/zip/bzip2.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'zip'
|
4
|
-
|
5
|
-
|
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.
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'lib/zip/bzip2/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = 'rubyzip-bzip2'
|
7
|
+
spec.version = Zip::Bzip2::VERSION
|
8
|
+
spec.authors = [
|
9
|
+
'Jan-Joost Spanjers', 'Robert Haines'
|
10
|
+
]
|
11
|
+
|
12
|
+
spec.summary = 'Extension of rubyzip to read bzip2 compressed files'
|
13
|
+
spec.description =
|
14
|
+
'The rubyzip-bzip2 gem provides an extension of the rubyzip gem ' \
|
15
|
+
'for reading zip files compressed with bzip2 compression'
|
16
|
+
spec.homepage = 'http://github.com/rubyzip/rubyzip-bzip2'
|
17
|
+
spec.license = 'BSD 2-Clause'
|
18
|
+
spec.require_paths = ['lib']
|
19
|
+
|
20
|
+
spec.required_ruby_version = '>= 3.0'
|
21
|
+
|
22
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
23
|
+
f.match(%r{^(test|spec|features)/})
|
24
|
+
end
|
25
|
+
|
26
|
+
spec.metadata = {
|
27
|
+
'bug_tracker_uri' => 'https://github.com/rubyzip/rubyzip-bzip2/issues',
|
28
|
+
'changelog_uri' => "https://github.com/rubyzip/rubyzip-bzip2/blob/v#{spec.version}/Changelog.md",
|
29
|
+
'documentation_uri' => "https://www.rubydoc.info/gems/rubyzip-bzip2/#{spec.version}",
|
30
|
+
'source_code_uri' => "https://github.com/rubyzip/rubyzip-bzip2/tree/v#{spec.version}",
|
31
|
+
'wiki_uri' => 'https://github.com/rubyzip/rubyzip-bzip2/wiki',
|
32
|
+
'rubygems_mfa_required' => 'true'
|
33
|
+
}
|
34
|
+
|
35
|
+
spec.add_dependency 'ffi', '~> 1.0'
|
36
|
+
spec.add_dependency 'rubyzip', '~> 3.0.0'
|
37
|
+
|
38
|
+
spec.add_development_dependency 'minitest', '~> 5.25'
|
39
|
+
spec.add_development_dependency 'rake', '~> 13.2'
|
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
|
+
spec.add_development_dependency 'simplecov', '~> 0.18.0'
|
44
|
+
spec.add_development_dependency 'simplecov-lcov', '~> 0.8'
|
45
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubyzip-bzip2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan-Joost Spanjers
|
8
|
-
|
8
|
+
- Robert Haines
|
9
|
+
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date:
|
12
|
+
date: 2025-08-22 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: ffi
|
@@ -30,120 +31,131 @@ dependencies:
|
|
30
31
|
requirements:
|
31
32
|
- - "~>"
|
32
33
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
34
|
+
version: 3.0.0
|
34
35
|
type: :runtime
|
35
36
|
prerelease: false
|
36
37
|
version_requirements: !ruby/object:Gem::Requirement
|
37
38
|
requirements:
|
38
39
|
- - "~>"
|
39
40
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
41
|
+
version: 3.0.0
|
41
42
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
43
|
+
name: minitest
|
43
44
|
requirement: !ruby/object:Gem::Requirement
|
44
45
|
requirements:
|
45
46
|
- - "~>"
|
46
47
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
48
|
+
version: '5.25'
|
48
49
|
type: :development
|
49
50
|
prerelease: false
|
50
51
|
version_requirements: !ruby/object:Gem::Requirement
|
51
52
|
requirements:
|
52
53
|
- - "~>"
|
53
54
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
55
|
+
version: '5.25'
|
55
56
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
57
|
+
name: rake
|
57
58
|
requirement: !ruby/object:Gem::Requirement
|
58
59
|
requirements:
|
59
|
-
- - "
|
60
|
+
- - "~>"
|
60
61
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
62
|
+
version: '13.2'
|
62
63
|
type: :development
|
63
64
|
prerelease: false
|
64
65
|
version_requirements: !ruby/object:Gem::Requirement
|
65
66
|
requirements:
|
66
|
-
- - "
|
67
|
+
- - "~>"
|
67
68
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
69
|
+
version: '13.2'
|
69
70
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
71
|
+
name: rubocop
|
71
72
|
requirement: !ruby/object:Gem::Requirement
|
72
73
|
requirements:
|
73
|
-
- - "
|
74
|
+
- - "~>"
|
74
75
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
76
|
+
version: 1.61.0
|
76
77
|
type: :development
|
77
78
|
prerelease: false
|
78
79
|
version_requirements: !ruby/object:Gem::Requirement
|
79
80
|
requirements:
|
80
|
-
- - "
|
81
|
+
- - "~>"
|
81
82
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
83
|
+
version: 1.61.0
|
83
84
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
85
|
+
name: rubocop-performance
|
85
86
|
requirement: !ruby/object:Gem::Requirement
|
86
87
|
requirements:
|
87
88
|
- - "~>"
|
88
89
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
90
|
+
version: 1.20.0
|
90
91
|
type: :development
|
91
92
|
prerelease: false
|
92
93
|
version_requirements: !ruby/object:Gem::Requirement
|
93
94
|
requirements:
|
94
95
|
- - "~>"
|
95
96
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
97
|
+
version: 1.20.0
|
97
98
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
99
|
+
name: rubocop-rake
|
99
100
|
requirement: !ruby/object:Gem::Requirement
|
100
101
|
requirements:
|
101
102
|
- - "~>"
|
102
103
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
104
|
+
version: 0.6.0
|
104
105
|
type: :development
|
105
106
|
prerelease: false
|
106
107
|
version_requirements: !ruby/object:Gem::Requirement
|
107
108
|
requirements:
|
108
109
|
- - "~>"
|
109
110
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
111
|
+
version: 0.6.0
|
111
112
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
113
|
+
name: simplecov
|
113
114
|
requirement: !ruby/object:Gem::Requirement
|
114
115
|
requirements:
|
115
116
|
- - "~>"
|
116
117
|
- !ruby/object:Gem::Version
|
117
|
-
version:
|
118
|
+
version: 0.18.0
|
118
119
|
type: :development
|
119
120
|
prerelease: false
|
120
121
|
version_requirements: !ruby/object:Gem::Requirement
|
121
122
|
requirements:
|
122
123
|
- - "~>"
|
123
124
|
- !ruby/object:Gem::Version
|
124
|
-
version:
|
125
|
+
version: 0.18.0
|
125
126
|
- !ruby/object:Gem::Dependency
|
126
|
-
name:
|
127
|
+
name: simplecov-lcov
|
127
128
|
requirement: !ruby/object:Gem::Requirement
|
128
129
|
requirements:
|
129
130
|
- - "~>"
|
130
131
|
- !ruby/object:Gem::Version
|
131
|
-
version: 0.
|
132
|
+
version: '0.8'
|
132
133
|
type: :development
|
133
134
|
prerelease: false
|
134
135
|
version_requirements: !ruby/object:Gem::Requirement
|
135
136
|
requirements:
|
136
137
|
- - "~>"
|
137
138
|
- !ruby/object:Gem::Version
|
138
|
-
version: 0.
|
139
|
+
version: '0.8'
|
139
140
|
description: The rubyzip-bzip2 gem provides an extension of the rubyzip gem for reading
|
140
141
|
zip files compressed with bzip2 compression
|
141
|
-
email:
|
142
|
+
email:
|
142
143
|
executables: []
|
143
144
|
extensions: []
|
144
145
|
extra_rdoc_files: []
|
145
146
|
files:
|
147
|
+
- ".github/workflows/lint.yml"
|
148
|
+
- ".github/workflows/tests.yml"
|
149
|
+
- ".gitignore"
|
150
|
+
- ".rubocop.yml"
|
151
|
+
- ".simplecov"
|
152
|
+
- Changelog.md
|
153
|
+
- Gemfile
|
154
|
+
- LICENSE.md
|
146
155
|
- README.md
|
156
|
+
- Rakefile
|
157
|
+
- bin/console
|
158
|
+
- lib/rubyzip/bzip2.rb
|
147
159
|
- lib/zip/bzip2.rb
|
148
160
|
- lib/zip/bzip2/decompress.rb
|
149
161
|
- lib/zip/bzip2/decompressor.rb
|
@@ -151,16 +163,18 @@ files:
|
|
151
163
|
- lib/zip/bzip2/ffi/libbz2.rb
|
152
164
|
- lib/zip/bzip2/libbz2.rb
|
153
165
|
- lib/zip/bzip2/version.rb
|
166
|
+
- rubyzip-bzip2.gemspec
|
154
167
|
homepage: http://github.com/rubyzip/rubyzip-bzip2
|
155
168
|
licenses:
|
156
169
|
- BSD 2-Clause
|
157
170
|
metadata:
|
158
171
|
bug_tracker_uri: https://github.com/rubyzip/rubyzip-bzip2/issues
|
159
|
-
changelog_uri: https://github.com/rubyzip/rubyzip-bzip2/blob/
|
160
|
-
documentation_uri: https://www.rubydoc.info/gems/rubyzip-bzip2/0.0
|
161
|
-
source_code_uri: https://github.com/rubyzip/rubyzip-bzip2/tree/
|
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
|
162
175
|
wiki_uri: https://github.com/rubyzip/rubyzip-bzip2/wiki
|
163
|
-
|
176
|
+
rubygems_mfa_required: 'true'
|
177
|
+
post_install_message:
|
164
178
|
rdoc_options: []
|
165
179
|
require_paths:
|
166
180
|
- lib
|
@@ -168,15 +182,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
168
182
|
requirements:
|
169
183
|
- - ">="
|
170
184
|
- !ruby/object:Gem::Version
|
171
|
-
version: '
|
185
|
+
version: '3.0'
|
172
186
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
173
187
|
requirements:
|
174
188
|
- - ">="
|
175
189
|
- !ruby/object:Gem::Version
|
176
190
|
version: '0'
|
177
191
|
requirements: []
|
178
|
-
rubygems_version: 3.
|
179
|
-
signing_key:
|
192
|
+
rubygems_version: 3.4.1
|
193
|
+
signing_key:
|
180
194
|
specification_version: 4
|
181
195
|
summary: Extension of rubyzip to read bzip2 compressed files
|
182
196
|
test_files: []
|