omnizip 0.3.33 → 0.3.34
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/CHANGELOG.md +11 -0
- data/lib/omnizip/archive_handlers/seven_zip_handler.rb +5 -5
- data/lib/omnizip/archive_handlers/tar_handler.rb +19 -1
- data/lib/omnizip/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ad5f2e41132ed61e2e80173f7550d75f3f0c8711d264e36a605fbee28e4a322e
|
|
4
|
+
data.tar.gz: 6d2b1989b06bb359cf48f2a5d24e8eea4b697cde22404c144cfef72357fdfb2d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 38afce515d452d0dd4b1ace8b32608b59ff72e86d76d7d0ccfe3985f2d8cae6c24f4e657dc2e48d92b1b9194de2bca7e6d38eedb499255f1b8dcc3da5e2660db
|
|
7
|
+
data.tar.gz: dab546e8c4db730e7d257d29c89e903768e2112e858a87ef55daf3ac64305e584c715b3042a60e5caef7428357a8b12d4c2609e8ed2baa15612a5ada53ed3337
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
### Fixed
|
|
11
|
+
- `Omnizip.compress_directory` to `.7z` and `.tar` (both documented)
|
|
12
|
+
works now: the 7z handler treats directory entries as the no-op
|
|
13
|
+
they are in the format (7z derives the tree from file paths;
|
|
14
|
+
nested paths verified against `7zz`), and the Tar handler routes
|
|
15
|
+
bare directory entries to the writer's `add_directory` instead of
|
|
16
|
+
misreading them as CWD-relative paths. Both round-trip nested
|
|
17
|
+
subdirectories through `extract_archive`.
|
|
18
|
+
|
|
19
|
+
## [0.3.33] - 2026-08-27
|
|
20
|
+
|
|
10
21
|
### Fixed
|
|
11
22
|
- The convenience API (`compress_file`, `compress_directory`,
|
|
12
23
|
`extract_archive`, `list_archive`, `read_from_archive`,
|
|
@@ -40,12 +40,12 @@ module Omnizip
|
|
|
40
40
|
@writer = writer
|
|
41
41
|
end
|
|
42
42
|
|
|
43
|
+
# Directory entries are a no-op: 7z archives derive the
|
|
44
|
+
# directory tree from the files' archive paths ("sub/f.txt"
|
|
45
|
+
# implies "sub/"), and the writer/reader handle slashed
|
|
46
|
+
# paths (verified against 7zz).
|
|
43
47
|
def add(name, source_path = nil)
|
|
44
|
-
if source_path.nil?
|
|
45
|
-
raise ArgumentError,
|
|
46
|
-
"directory entries are not supported in .7z " \
|
|
47
|
-
"convenience compression"
|
|
48
|
-
end
|
|
48
|
+
return if source_path.nil?
|
|
49
49
|
|
|
50
50
|
@writer.add_file(source_path, name)
|
|
51
51
|
end
|
|
@@ -6,7 +6,9 @@ module Omnizip
|
|
|
6
6
|
# /+list+ interface for the TAR format. Wraps +Omnizip::Formats::Tar+.
|
|
7
7
|
class TarHandler
|
|
8
8
|
def create(path, &block)
|
|
9
|
-
Omnizip::Formats::Tar.create(path
|
|
9
|
+
Omnizip::Formats::Tar.create(path) do |writer|
|
|
10
|
+
block&.call(EntryProxy.new(writer))
|
|
11
|
+
end
|
|
10
12
|
end
|
|
11
13
|
|
|
12
14
|
def open(path, &block)
|
|
@@ -34,6 +36,22 @@ module Omnizip
|
|
|
34
36
|
end
|
|
35
37
|
end
|
|
36
38
|
|
|
39
|
+
# Translates the generic +add(name, source_path)+ interface:
|
|
40
|
+
# a bare +add(name)+ is a directory ENTRY (no source on disk
|
|
41
|
+
# relative to the caller), which the Tar writer's own +add+
|
|
42
|
+
# would misread as a CWD-relative path.
|
|
43
|
+
class EntryProxy
|
|
44
|
+
def initialize(writer)
|
|
45
|
+
@writer = writer
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def add(name, source_path = nil)
|
|
49
|
+
return @writer.add_directory(name) if source_path.nil?
|
|
50
|
+
|
|
51
|
+
@writer.add(name, source_path)
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
37
55
|
def read_entry(path, entry_name)
|
|
38
56
|
data = nil
|
|
39
57
|
Omnizip::Formats::Tar.open(path) do |reader|
|
data/lib/omnizip/version.rb
CHANGED