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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0f3064a982a38257ff4ef606d6de52925a377e2138a3bacc7cb60033a6ff1ac1
4
- data.tar.gz: f24f28f6daac8df45542854f099c071d5b17f52deff99ae7f3bd5d009d6d7c0d
3
+ metadata.gz: ad5f2e41132ed61e2e80173f7550d75f3f0c8711d264e36a605fbee28e4a322e
4
+ data.tar.gz: 6d2b1989b06bb359cf48f2a5d24e8eea4b697cde22404c144cfef72357fdfb2d
5
5
  SHA512:
6
- metadata.gz: 7e08082742ca10c5156773d5d279c1e5c7fe6d035cbe06678e2c68509862d89880c1a7f3e40d4e7a69b433e2407546d3735846a7d53a3c139819fa271001b852
7
- data.tar.gz: 8d8551cf4cd26ae177b36e5aa67f217323853535ffaed26e4825f537e4384e998629b6084240a2dd82eaad276396dd51b22ab84a4d65f6f9f98475965ca6096e
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, &block)
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|
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Omnizip
4
- VERSION = "0.3.33"
4
+ VERSION = "0.3.34"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omnizip
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.33
4
+ version: 0.3.34
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.