archive_r_ruby 0.1.3 → 0.1.4
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/{LICENSE → LICENSE.txt} +77 -77
- data/README.md +103 -103
- data/ext/archive_r/Makefile +48 -45
- data/ext/archive_r/archive_r-x64-mingw-ucrt.def +2 -0
- data/ext/archive_r/archive_r_ext.cc +1106 -1106
- data/ext/archive_r/archive_r_ext.o +0 -0
- data/ext/archive_r/extconf.rb +120 -120
- data/ext/archive_r/mkmf.log +23 -18
- data/ext/archive_r/vendor/archive_r/LICENSE.txt +77 -77
- data/ext/archive_r/vendor/archive_r/include/archive_r/data_stream.h +52 -52
- data/ext/archive_r/vendor/archive_r/include/archive_r/entry.h +166 -166
- data/ext/archive_r/vendor/archive_r/include/archive_r/entry_fault.h +34 -34
- data/ext/archive_r/vendor/archive_r/include/archive_r/entry_metadata.h +56 -56
- data/ext/archive_r/vendor/archive_r/include/archive_r/multi_volume_stream_base.h +46 -46
- data/ext/archive_r/vendor/archive_r/include/archive_r/path_hierarchy.h +109 -109
- data/ext/archive_r/vendor/archive_r/include/archive_r/path_hierarchy_utils.h +37 -37
- data/ext/archive_r/vendor/archive_r/include/archive_r/platform_compat.h +19 -19
- data/ext/archive_r/vendor/archive_r/include/archive_r/traverser.h +122 -122
- data/ext/archive_r/vendor/archive_r/src/archive_stack_cursor.cc +330 -330
- data/ext/archive_r/vendor/archive_r/src/archive_stack_cursor.h +97 -97
- data/ext/archive_r/vendor/archive_r/src/archive_stack_orchestrator.cc +162 -162
- data/ext/archive_r/vendor/archive_r/src/archive_stack_orchestrator.h +54 -54
- data/ext/archive_r/vendor/archive_r/src/archive_type.cc +552 -552
- data/ext/archive_r/vendor/archive_r/src/archive_type.h +77 -77
- data/ext/archive_r/vendor/archive_r/src/data_stream.cc +35 -35
- data/ext/archive_r/vendor/archive_r/src/entry.cc +253 -253
- data/ext/archive_r/vendor/archive_r/src/entry_fault.cc +26 -26
- data/ext/archive_r/vendor/archive_r/src/entry_fault_error.cc +54 -54
- data/ext/archive_r/vendor/archive_r/src/entry_fault_error.h +32 -32
- data/ext/archive_r/vendor/archive_r/src/entry_impl.h +57 -57
- data/ext/archive_r/vendor/archive_r/src/multi_volume_manager.cc +81 -81
- data/ext/archive_r/vendor/archive_r/src/multi_volume_manager.h +41 -41
- data/ext/archive_r/vendor/archive_r/src/multi_volume_stream_base.cc +199 -199
- data/ext/archive_r/vendor/archive_r/src/path_hierarchy.cc +151 -151
- data/ext/archive_r/vendor/archive_r/src/path_hierarchy_utils.cc +304 -304
- data/ext/archive_r/vendor/archive_r/src/simple_profiler.h +120 -120
- data/ext/archive_r/vendor/archive_r/src/system_file_stream.cc +295 -295
- data/ext/archive_r/vendor/archive_r/src/system_file_stream.h +46 -46
- data/ext/archive_r/vendor/archive_r/src/traverser.cc +314 -314
- data/lib/archive_r.rb +105 -105
- metadata +11 -8
- data/ext/archive_r/archive_r.bundle +0 -0
data/lib/archive_r.rb
CHANGED
|
@@ -1,105 +1,105 @@
|
|
|
1
|
-
# SPDX-License-Identifier: MIT
|
|
2
|
-
# Copyright (c) 2025 archive_r Team
|
|
3
|
-
|
|
4
|
-
begin
|
|
5
|
-
# Windows/MSVC specific: Ensure dependent DLLs (like libarchive.dll) are found.
|
|
6
|
-
# If LIBARCHIVE_ROOT is set, add its bin directory to the DLL search path.
|
|
7
|
-
if RUBY_PLATFORM =~ /mswin|mingw|cygwin/
|
|
8
|
-
if ENV['LIBARCHIVE_ROOT']
|
|
9
|
-
bin_dir = File.join(ENV['LIBARCHIVE_ROOT'], 'bin')
|
|
10
|
-
if Dir.exist?(bin_dir)
|
|
11
|
-
if defined?(RubyInstaller::Runtime)
|
|
12
|
-
RubyInstaller::Runtime.add_dll_directory(bin_dir)
|
|
13
|
-
else
|
|
14
|
-
ENV['PATH'] = "#{bin_dir};#{ENV['PATH']}"
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
# Prefer the packaged gem layout (lib/archive_r/archive_r.so)
|
|
21
|
-
require_relative 'archive_r/archive_r'
|
|
22
|
-
rescue LoadError
|
|
23
|
-
begin
|
|
24
|
-
# Fallback to the local development layout (bindings/ruby/archive_r.so)
|
|
25
|
-
require_relative '../archive_r'
|
|
26
|
-
rescue LoadError
|
|
27
|
-
begin
|
|
28
|
-
# Fallback for Windows/MinGW where extension might be directly in lib/ or current dir
|
|
29
|
-
require 'archive_r/archive_r'
|
|
30
|
-
rescue LoadError
|
|
31
|
-
# Last resort: try requiring without directory prefix (common in some Windows setups)
|
|
32
|
-
require 'archive_r'
|
|
33
|
-
end
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
module Archive_r
|
|
38
|
-
VERSION = "0.1.3"
|
|
39
|
-
# Common archive formats excluding libarchive's mtree/raw pseudo formats
|
|
40
|
-
STANDARD_FORMATS = %w[
|
|
41
|
-
7zip ar cab cpio empty iso9660 lha rar tar warc xar zip
|
|
42
|
-
].freeze
|
|
43
|
-
|
|
44
|
-
def self.normalize_options(opts = nil)
|
|
45
|
-
options =
|
|
46
|
-
case opts
|
|
47
|
-
when nil
|
|
48
|
-
{}
|
|
49
|
-
when Hash
|
|
50
|
-
opts.dup
|
|
51
|
-
else
|
|
52
|
-
opts.to_hash.dup
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
options[:formats] = STANDARD_FORMATS unless options.key?(:formats)
|
|
56
|
-
options
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
def self.traverse(paths, **opts, &block)
|
|
60
|
-
options = normalize_options(opts)
|
|
61
|
-
|
|
62
|
-
if block
|
|
63
|
-
Traverser.open(paths, options) { |traverser| traverser.each(&block) }
|
|
64
|
-
else
|
|
65
|
-
Traverser.new(paths, options).each
|
|
66
|
-
end
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
class Entry
|
|
70
|
-
# Additional helper methods can be added here
|
|
71
|
-
|
|
72
|
-
def to_s
|
|
73
|
-
path
|
|
74
|
-
end
|
|
75
|
-
|
|
76
|
-
def inspect
|
|
77
|
-
"#<Archive_r::Entry path=#{path.inspect} size=#{size} depth=#{depth}>"
|
|
78
|
-
end
|
|
79
|
-
end
|
|
80
|
-
|
|
81
|
-
class Traverser
|
|
82
|
-
# Additional helper methods can be added here
|
|
83
|
-
|
|
84
|
-
class << self
|
|
85
|
-
alias_method :__archive_r_c_open, :open
|
|
86
|
-
|
|
87
|
-
def open(paths, opts = nil, &block)
|
|
88
|
-
__archive_r_c_open(paths, Archive_r.normalize_options(opts), &block)
|
|
89
|
-
end
|
|
90
|
-
end
|
|
91
|
-
|
|
92
|
-
alias_method :__archive_r_c_initialize, :initialize
|
|
93
|
-
|
|
94
|
-
def initialize(paths, opts = nil)
|
|
95
|
-
__archive_r_c_initialize(paths, Archive_r.normalize_options(opts))
|
|
96
|
-
end
|
|
97
|
-
|
|
98
|
-
# Count entries
|
|
99
|
-
def count
|
|
100
|
-
n = 0
|
|
101
|
-
each { |entry| n += 1 }
|
|
102
|
-
n
|
|
103
|
-
end
|
|
104
|
-
end
|
|
105
|
-
end
|
|
1
|
+
# SPDX-License-Identifier: MIT
|
|
2
|
+
# Copyright (c) 2025 archive_r Team
|
|
3
|
+
|
|
4
|
+
begin
|
|
5
|
+
# Windows/MSVC specific: Ensure dependent DLLs (like libarchive.dll) are found.
|
|
6
|
+
# If LIBARCHIVE_ROOT is set, add its bin directory to the DLL search path.
|
|
7
|
+
if RUBY_PLATFORM =~ /mswin|mingw|cygwin/
|
|
8
|
+
if ENV['LIBARCHIVE_ROOT']
|
|
9
|
+
bin_dir = File.join(ENV['LIBARCHIVE_ROOT'], 'bin')
|
|
10
|
+
if Dir.exist?(bin_dir)
|
|
11
|
+
if defined?(RubyInstaller::Runtime)
|
|
12
|
+
RubyInstaller::Runtime.add_dll_directory(bin_dir)
|
|
13
|
+
else
|
|
14
|
+
ENV['PATH'] = "#{bin_dir};#{ENV['PATH']}"
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
# Prefer the packaged gem layout (lib/archive_r/archive_r.so)
|
|
21
|
+
require_relative 'archive_r/archive_r'
|
|
22
|
+
rescue LoadError
|
|
23
|
+
begin
|
|
24
|
+
# Fallback to the local development layout (bindings/ruby/archive_r.so)
|
|
25
|
+
require_relative '../archive_r'
|
|
26
|
+
rescue LoadError
|
|
27
|
+
begin
|
|
28
|
+
# Fallback for Windows/MinGW where extension might be directly in lib/ or current dir
|
|
29
|
+
require 'archive_r/archive_r'
|
|
30
|
+
rescue LoadError
|
|
31
|
+
# Last resort: try requiring without directory prefix (common in some Windows setups)
|
|
32
|
+
require 'archive_r'
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
module Archive_r
|
|
38
|
+
VERSION = "0.1.3"
|
|
39
|
+
# Common archive formats excluding libarchive's mtree/raw pseudo formats
|
|
40
|
+
STANDARD_FORMATS = %w[
|
|
41
|
+
7zip ar cab cpio empty iso9660 lha rar tar warc xar zip
|
|
42
|
+
].freeze
|
|
43
|
+
|
|
44
|
+
def self.normalize_options(opts = nil)
|
|
45
|
+
options =
|
|
46
|
+
case opts
|
|
47
|
+
when nil
|
|
48
|
+
{}
|
|
49
|
+
when Hash
|
|
50
|
+
opts.dup
|
|
51
|
+
else
|
|
52
|
+
opts.to_hash.dup
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
options[:formats] = STANDARD_FORMATS unless options.key?(:formats)
|
|
56
|
+
options
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def self.traverse(paths, **opts, &block)
|
|
60
|
+
options = normalize_options(opts)
|
|
61
|
+
|
|
62
|
+
if block
|
|
63
|
+
Traverser.open(paths, options) { |traverser| traverser.each(&block) }
|
|
64
|
+
else
|
|
65
|
+
Traverser.new(paths, options).each
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
class Entry
|
|
70
|
+
# Additional helper methods can be added here
|
|
71
|
+
|
|
72
|
+
def to_s
|
|
73
|
+
path
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
def inspect
|
|
77
|
+
"#<Archive_r::Entry path=#{path.inspect} size=#{size} depth=#{depth}>"
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
class Traverser
|
|
82
|
+
# Additional helper methods can be added here
|
|
83
|
+
|
|
84
|
+
class << self
|
|
85
|
+
alias_method :__archive_r_c_open, :open
|
|
86
|
+
|
|
87
|
+
def open(paths, opts = nil, &block)
|
|
88
|
+
__archive_r_c_open(paths, Archive_r.normalize_options(opts), &block)
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
alias_method :__archive_r_c_initialize, :initialize
|
|
93
|
+
|
|
94
|
+
def initialize(paths, opts = nil)
|
|
95
|
+
__archive_r_c_initialize(paths, Archive_r.normalize_options(opts))
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
# Count entries
|
|
99
|
+
def count
|
|
100
|
+
n = 0
|
|
101
|
+
each { |entry| n += 1 }
|
|
102
|
+
n
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
end
|
metadata
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: archive_r_ruby
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- raizo.tcs
|
|
8
|
+
autorequire:
|
|
8
9
|
bindir: bin
|
|
9
10
|
cert_chain: []
|
|
10
|
-
date:
|
|
11
|
+
date: 2025-12-04 00:00:00.000000000 Z
|
|
11
12
|
dependencies:
|
|
12
13
|
- !ruby/object:Gem::Dependency
|
|
13
14
|
name: rake
|
|
@@ -37,8 +38,8 @@ dependencies:
|
|
|
37
38
|
- - "~>"
|
|
38
39
|
- !ruby/object:Gem::Version
|
|
39
40
|
version: '5.0'
|
|
40
|
-
description:
|
|
41
|
-
files
|
|
41
|
+
description: Ruby bindings for archive_r that recursively walk nested and multipart
|
|
42
|
+
archives directly from the source stream without creating temporary files
|
|
42
43
|
email:
|
|
43
44
|
- raizo.tcs@users.noreply.github.com
|
|
44
45
|
executables: []
|
|
@@ -46,10 +47,10 @@ extensions:
|
|
|
46
47
|
- ext/archive_r/extconf.rb
|
|
47
48
|
extra_rdoc_files: []
|
|
48
49
|
files:
|
|
49
|
-
- LICENSE
|
|
50
|
+
- LICENSE.txt
|
|
50
51
|
- README.md
|
|
51
52
|
- ext/archive_r/Makefile
|
|
52
|
-
- ext/archive_r/archive_r.
|
|
53
|
+
- ext/archive_r/archive_r-x64-mingw-ucrt.def
|
|
53
54
|
- ext/archive_r/archive_r_ext.cc
|
|
54
55
|
- ext/archive_r/archive_r_ext.o
|
|
55
56
|
- ext/archive_r/extconf.rb
|
|
@@ -94,6 +95,7 @@ metadata:
|
|
|
94
95
|
source_code_uri: https://github.com/raizo-tcs/archive_r
|
|
95
96
|
bug_tracker_uri: https://github.com/raizo-tcs/archive_r/issues
|
|
96
97
|
changelog_uri: https://github.com/raizo-tcs/archive_r/releases
|
|
98
|
+
post_install_message:
|
|
97
99
|
rdoc_options: []
|
|
98
100
|
require_paths:
|
|
99
101
|
- lib
|
|
@@ -108,7 +110,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
108
110
|
- !ruby/object:Gem::Version
|
|
109
111
|
version: '0'
|
|
110
112
|
requirements: []
|
|
111
|
-
rubygems_version: 3.
|
|
113
|
+
rubygems_version: 3.4.19
|
|
114
|
+
signing_key:
|
|
112
115
|
specification_version: 4
|
|
113
|
-
summary: Ruby bindings for archive_r
|
|
116
|
+
summary: Ruby bindings for archive_r that traverse nested archives without temp extraction
|
|
114
117
|
test_files: []
|
|
Binary file
|