retouch 0.3.1 → 0.3.2

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: ded00b784bc38feace65825e78c1a054c85e25deaa24c3646f0bb42413cbb678
4
- data.tar.gz: 25e71fe884b758478af207538e4652d9c3d9186a10d7333045d8f9c7f85e9fe8
3
+ metadata.gz: 31384107f186fa5f161afcc5ad8037cbb328c8989768f6baa38d689a4be0e6f9
4
+ data.tar.gz: 1001ee8463fed9e436aff8e72099f2790b0428203dd57a27db58081dae1a8cac
5
5
  SHA512:
6
- metadata.gz: fef149f89fed473a1f2e648bb0162e7957bc28a799850026743ec872777ba7bc87b1e82ae3db15b43beb927a39fa93a2dd40af297c37495f1de245591ff140d2
7
- data.tar.gz: d3d5e48248efadcd180e51085a4d92cd8b4b560d21ea1a968ca4c95fe07953794db2cdd29db007109170548d680e10e1ec495fe17a061583956a259b23ee321e
6
+ metadata.gz: 845b4b9b951220cd4997743d1eaf6a69aebae86f57117f8c2e9684a55414a5ce165faee90bc7ffecf36f0d427388e501fe5d60aec892e01e8787631849b191e8
7
+ data.tar.gz: 2c4d4b2ad3ca84479d6d686594a42cfa90fdd0937adf2a506da2ce7e420fb3ddbeb2bc8a4cc77c19d2d27c8e0d47f7fc4b53e2c5c82aab5a90269a4b2c39b183
data/.codespellignore ADDED
File without changes
data/.yamllint ADDED
@@ -0,0 +1,16 @@
1
+ extends: default
2
+ ignore: |
3
+ build/
4
+ node_modules/
5
+ runtime/build/
6
+ tmp/
7
+ **/*.dSYM/**
8
+
9
+ rules:
10
+ comments:
11
+ min-spaces-from-content: 1
12
+ document-start: disable
13
+ line-length:
14
+ max: 200
15
+ truthy:
16
+ check-keys: false
data/CHANGELOG.md CHANGED
@@ -2,17 +2,20 @@
2
2
 
3
3
  All notable changes to Retouch are recorded here.
4
4
 
5
+ ## [0.3.2] - 2026-09-26
6
+
7
+ - Reject batch outputs that resolve to the same file through symlinks or hard links.
8
+
5
9
  ## [0.3.1] - 2026-09-25
6
10
 
7
- - Use normalized fixed-point weights for resampling with integer interpolation.
8
- - Require Flipbook 0.4.0 for GIF and APNG integration.
11
+ - Preserve colors and transparency more consistently when resizing images.
12
+ - Require Flipbook 0.4.0 for GIF and APNG support.
9
13
 
10
14
  ## [0.3.0] - 2026-09-25
11
15
 
12
16
  - Add color, quantization, convolution, pixelation, compositing, annotation, and multi-image operations.
13
17
  - Add glob-based batch transforms, output templates, and process workers.
14
18
  - Add optional Glyphic text and Flipbook 0.3.0+ GIF reading, GIF output, and APNG output integrations.
15
- - Document current format and GIF Reader limitations.
16
19
 
17
20
  ## [0.1.0] - 2026-09-25
18
21
 
data/lib/retouch/batch.rb CHANGED
@@ -29,7 +29,8 @@ module Retouch
29
29
  raise Error, "input file does not exist: #{paths.find { |path| !File.file?(path) }}" unless paths.all? { |path| File.file?(path) }
30
30
 
31
31
  outputs = paths.each_with_index.map { |path, index| output_path(to, path, index) }
32
- raise Error, "output template produces duplicate paths" unless outputs.uniq.length == outputs.length
32
+ resolved_outputs = outputs.map { |path| destination_key(path) }
33
+ raise Error, "output template produces duplicate paths" unless resolved_outputs.uniq.length == outputs.length
33
34
 
34
35
  jobs = Integer(jobs)
35
36
  raise ArgumentError, "jobs must be positive" unless jobs.positive?
@@ -67,6 +68,21 @@ module Retouch
67
68
 
68
69
  outputs
69
70
  end
71
+
72
+ def self.destination_key(path)
73
+ ancestor = File.expand_path(path)
74
+ suffix = []
75
+ until File.exist?(ancestor) || File.symlink?(ancestor)
76
+ suffix.unshift(File.basename(ancestor))
77
+ ancestor = File.dirname(ancestor)
78
+ end
79
+ resolved = File.join(File.realpath(ancestor), *suffix)
80
+ return resolved unless File.file?(resolved)
81
+
82
+ stat = File.stat(resolved)
83
+ [stat.dev, stat.ino]
84
+ end
85
+ private_class_method :destination_key
70
86
  end
71
87
 
72
88
  def self.batch(inputs, to:, jobs: 1, force: false, &block)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Retouch
4
- VERSION = "0.3.1"
4
+ VERSION = "0.3.2"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: retouch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yudai Takada
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-09-25 00:00:00.000000000 Z
11
+ date: 2026-09-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tessel
@@ -109,7 +109,9 @@ executables:
109
109
  extensions: []
110
110
  extra_rdoc_files: []
111
111
  files:
112
+ - ".codespellignore"
112
113
  - ".rubocop.yml"
114
+ - ".yamllint"
113
115
  - CHANGELOG.md
114
116
  - LICENSE
115
117
  - README.md