archive_r_ruby 0.1.22 → 0.1.23
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 +21 -21
- data/NOTICE +116 -116
- data/README.md +106 -106
- data/VERSION +1 -1
- data/ext/archive_r/archive_r_ext.cc +1098 -1098
- data/ext/archive_r/extconf.rb +125 -125
- data/ext/archive_r/vendor/archive_r/LICENSE +21 -21
- data/ext/archive_r/vendor/archive_r/NOTICE +116 -116
- data/ext/archive_r/vendor/archive_r/include/archive_r/data_stream.h +42 -42
- data/ext/archive_r/vendor/archive_r/include/archive_r/entry.h +180 -180
- 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 +92 -92
- data/ext/archive_r/vendor/archive_r/include/archive_r/path_hierarchy_utils.h +36 -36
- data/ext/archive_r/vendor/archive_r/include/archive_r/platform_compat.h +34 -34
- data/ext/archive_r/vendor/archive_r/include/archive_r/traverser.h +156 -156
- data/ext/archive_r/vendor/archive_r/src/archive_stack_cursor.cc +300 -300
- data/ext/archive_r/vendor/archive_r/src/archive_stack_cursor.h +110 -110
- data/ext/archive_r/vendor/archive_r/src/archive_stack_orchestrator.cc +161 -161
- data/ext/archive_r/vendor/archive_r/src/archive_stack_orchestrator.h +53 -53
- data/ext/archive_r/vendor/archive_r/src/archive_type.cc +545 -545
- 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 +238 -238
- 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 +56 -56
- data/ext/archive_r/vendor/archive_r/src/multi_volume_manager.cc +76 -76
- data/ext/archive_r/vendor/archive_r/src/multi_volume_manager.h +39 -39
- data/ext/archive_r/vendor/archive_r/src/multi_volume_stream_base.cc +208 -208
- data/ext/archive_r/vendor/archive_r/src/path_hierarchy.cc +127 -127
- data/ext/archive_r/vendor/archive_r/src/path_hierarchy_utils.cc +251 -251
- data/ext/archive_r/vendor/archive_r/src/simple_profiler.h +109 -109
- data/ext/archive_r/vendor/archive_r/src/system_file_stream.cc +294 -294
- data/ext/archive_r/vendor/archive_r/src/system_file_stream.h +46 -46
- data/ext/archive_r/vendor/archive_r/src/traverser.cc +295 -295
- data/lib/archive_r.rb +120 -120
- metadata +6 -3
data/lib/archive_r.rb
CHANGED
|
@@ -1,120 +1,120 @@
|
|
|
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
|
-
load_errors = []
|
|
21
|
-
extension_candidates = [
|
|
22
|
-
['require_relative', 'archive_r/archive_r'],
|
|
23
|
-
['require_relative', '../archive_r'],
|
|
24
|
-
['require', 'archive_r/archive_r']
|
|
25
|
-
]
|
|
26
|
-
|
|
27
|
-
loaded = false
|
|
28
|
-
extension_candidates.each do |method_name, target|
|
|
29
|
-
begin
|
|
30
|
-
__send__(method_name, target)
|
|
31
|
-
loaded = true
|
|
32
|
-
break
|
|
33
|
-
rescue LoadError => e
|
|
34
|
-
load_errors << [method_name, target, e.message]
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
unless loaded
|
|
39
|
-
details = load_errors.map { |method_name, target, message| "#{method_name}(#{target}): #{message}" }.join(' | ')
|
|
40
|
-
raise LoadError, "Failed to load archive_r native extension. #{details}"
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
module Archive_r
|
|
45
|
-
version_path = File.expand_path('../VERSION', __dir__)
|
|
46
|
-
unless File.exist?(version_path)
|
|
47
|
-
version_path = File.expand_path('../../../VERSION', __dir__)
|
|
48
|
-
end
|
|
49
|
-
VERSION = File.read(version_path).strip
|
|
50
|
-
# Common archive formats excluding libarchive's mtree/raw pseudo formats
|
|
51
|
-
STANDARD_FORMATS = %w[
|
|
52
|
-
7zip ar cab cpio empty iso9660 lha rar tar warc xar zip
|
|
53
|
-
].freeze
|
|
54
|
-
|
|
55
|
-
def self.normalize_options(opts = nil)
|
|
56
|
-
options =
|
|
57
|
-
case opts
|
|
58
|
-
when nil
|
|
59
|
-
{}
|
|
60
|
-
when Hash
|
|
61
|
-
opts.dup
|
|
62
|
-
else
|
|
63
|
-
opts.to_hash.dup
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
options[:formats] = STANDARD_FORMATS unless options.key?(:formats)
|
|
67
|
-
options
|
|
68
|
-
end
|
|
69
|
-
|
|
70
|
-
def self.traverse(paths, **opts, &block)
|
|
71
|
-
options = normalize_options(opts)
|
|
72
|
-
|
|
73
|
-
if block
|
|
74
|
-
Traverser.open(paths, options) { |traverser| traverser.each(&block) }
|
|
75
|
-
else
|
|
76
|
-
Traverser.new(paths, options).each
|
|
77
|
-
end
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
class Entry
|
|
81
|
-
# Additional helper methods can be added here
|
|
82
|
-
|
|
83
|
-
def to_s
|
|
84
|
-
path
|
|
85
|
-
end
|
|
86
|
-
|
|
87
|
-
def inspect
|
|
88
|
-
"#<Archive_r::Entry path=#{path.inspect} size=#{size} depth=#{depth}>"
|
|
89
|
-
end
|
|
90
|
-
end
|
|
91
|
-
|
|
92
|
-
class Traverser
|
|
93
|
-
# Additional helper methods can be added here
|
|
94
|
-
|
|
95
|
-
class << self
|
|
96
|
-
alias_method :__archive_r_c_open, :open
|
|
97
|
-
|
|
98
|
-
def open(paths, opts = nil, &block)
|
|
99
|
-
__archive_r_c_open(paths, Archive_r.normalize_options(opts), &block)
|
|
100
|
-
end
|
|
101
|
-
|
|
102
|
-
def open_hierarchy(hierarchy, opts = nil, &block)
|
|
103
|
-
open([hierarchy], opts, &block)
|
|
104
|
-
end
|
|
105
|
-
end
|
|
106
|
-
|
|
107
|
-
alias_method :__archive_r_c_initialize, :initialize
|
|
108
|
-
|
|
109
|
-
def initialize(paths, opts = nil)
|
|
110
|
-
__archive_r_c_initialize(paths, Archive_r.normalize_options(opts))
|
|
111
|
-
end
|
|
112
|
-
|
|
113
|
-
# Count entries
|
|
114
|
-
def count
|
|
115
|
-
n = 0
|
|
116
|
-
each { |entry| n += 1 }
|
|
117
|
-
n
|
|
118
|
-
end
|
|
119
|
-
end
|
|
120
|
-
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
|
+
load_errors = []
|
|
21
|
+
extension_candidates = [
|
|
22
|
+
['require_relative', 'archive_r/archive_r'],
|
|
23
|
+
['require_relative', '../archive_r'],
|
|
24
|
+
['require', 'archive_r/archive_r']
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
loaded = false
|
|
28
|
+
extension_candidates.each do |method_name, target|
|
|
29
|
+
begin
|
|
30
|
+
__send__(method_name, target)
|
|
31
|
+
loaded = true
|
|
32
|
+
break
|
|
33
|
+
rescue LoadError => e
|
|
34
|
+
load_errors << [method_name, target, e.message]
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
unless loaded
|
|
39
|
+
details = load_errors.map { |method_name, target, message| "#{method_name}(#{target}): #{message}" }.join(' | ')
|
|
40
|
+
raise LoadError, "Failed to load archive_r native extension. #{details}"
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
module Archive_r
|
|
45
|
+
version_path = File.expand_path('../VERSION', __dir__)
|
|
46
|
+
unless File.exist?(version_path)
|
|
47
|
+
version_path = File.expand_path('../../../VERSION', __dir__)
|
|
48
|
+
end
|
|
49
|
+
VERSION = File.read(version_path).strip
|
|
50
|
+
# Common archive formats excluding libarchive's mtree/raw pseudo formats
|
|
51
|
+
STANDARD_FORMATS = %w[
|
|
52
|
+
7zip ar cab cpio empty iso9660 lha rar tar warc xar zip
|
|
53
|
+
].freeze
|
|
54
|
+
|
|
55
|
+
def self.normalize_options(opts = nil)
|
|
56
|
+
options =
|
|
57
|
+
case opts
|
|
58
|
+
when nil
|
|
59
|
+
{}
|
|
60
|
+
when Hash
|
|
61
|
+
opts.dup
|
|
62
|
+
else
|
|
63
|
+
opts.to_hash.dup
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
options[:formats] = STANDARD_FORMATS unless options.key?(:formats)
|
|
67
|
+
options
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def self.traverse(paths, **opts, &block)
|
|
71
|
+
options = normalize_options(opts)
|
|
72
|
+
|
|
73
|
+
if block
|
|
74
|
+
Traverser.open(paths, options) { |traverser| traverser.each(&block) }
|
|
75
|
+
else
|
|
76
|
+
Traverser.new(paths, options).each
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
class Entry
|
|
81
|
+
# Additional helper methods can be added here
|
|
82
|
+
|
|
83
|
+
def to_s
|
|
84
|
+
path
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
def inspect
|
|
88
|
+
"#<Archive_r::Entry path=#{path.inspect} size=#{size} depth=#{depth}>"
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
class Traverser
|
|
93
|
+
# Additional helper methods can be added here
|
|
94
|
+
|
|
95
|
+
class << self
|
|
96
|
+
alias_method :__archive_r_c_open, :open
|
|
97
|
+
|
|
98
|
+
def open(paths, opts = nil, &block)
|
|
99
|
+
__archive_r_c_open(paths, Archive_r.normalize_options(opts), &block)
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
def open_hierarchy(hierarchy, opts = nil, &block)
|
|
103
|
+
open([hierarchy], opts, &block)
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
alias_method :__archive_r_c_initialize, :initialize
|
|
108
|
+
|
|
109
|
+
def initialize(paths, opts = nil)
|
|
110
|
+
__archive_r_c_initialize(paths, Archive_r.normalize_options(opts))
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
# Count entries
|
|
114
|
+
def count
|
|
115
|
+
n = 0
|
|
116
|
+
each { |entry| n += 1 }
|
|
117
|
+
n
|
|
118
|
+
end
|
|
119
|
+
end
|
|
120
|
+
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.23
|
|
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: 2026-03-28 00:00:00.000000000 Z
|
|
11
12
|
dependencies:
|
|
12
13
|
- !ruby/object:Gem::Dependency
|
|
13
14
|
name: rake
|
|
@@ -95,6 +96,7 @@ metadata:
|
|
|
95
96
|
source_code_uri: https://github.com/raizo-tcs/archive_r
|
|
96
97
|
bug_tracker_uri: https://github.com/raizo-tcs/archive_r/issues
|
|
97
98
|
changelog_uri: https://github.com/raizo-tcs/archive_r/releases
|
|
99
|
+
post_install_message:
|
|
98
100
|
rdoc_options: []
|
|
99
101
|
require_paths:
|
|
100
102
|
- lib
|
|
@@ -109,7 +111,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
109
111
|
- !ruby/object:Gem::Version
|
|
110
112
|
version: '0'
|
|
111
113
|
requirements: []
|
|
112
|
-
rubygems_version: 3.
|
|
114
|
+
rubygems_version: 3.4.20
|
|
115
|
+
signing_key:
|
|
113
116
|
specification_version: 4
|
|
114
117
|
summary: 'Ruby bindings for archive_r: libarchive-based streaming traversal for recursive
|
|
115
118
|
nested archives (no temp files, no large in-memory buffers)'
|