wax_tasks 1.0.1 → 1.0.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 +4 -4
- data/lib/wax_tasks/asset.rb +5 -2
- data/lib/wax_tasks/collection/images.rb +11 -8
- data/lib/wax_tasks/item.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 54e1d62bddb18ee554db5a1d517f65acc68998edce0a147d0f08d1c6807a3655
|
4
|
+
data.tar.gz: 52437257c9777aaaefd078c4e4be8ad76ccf82fd2e57d0d8ef022912a789cf4c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b2479c1ed3f348c749f78f6a2988f5aa5f98041bb09821bf17c51cee5bd761f542c2560532516567595d956e220f94ffcef0aadf60c2cf0df9e6559eff82a682
|
7
|
+
data.tar.gz: cf0ba69cf4e2ab6b224bc55e9b532522ba766379f448330839d22a3e13fcbe0235df9f8a94fc9d3664350c56459de4b9491248fdaa97a8255010d63a08314f9a
|
data/lib/wax_tasks/asset.rb
CHANGED
@@ -27,9 +27,12 @@ module WaxTasks
|
|
27
27
|
def simple_derivatives
|
28
28
|
@variants.map do |label, width|
|
29
29
|
img = MiniMagick::Image.open(@path)
|
30
|
-
|
30
|
+
if width > img.width
|
31
|
+
warn Rainbow("Tried to create derivative #{width}px wide, but asset #{@id} for item #{@pid} only has a width of #{img.width}px.").yellow
|
32
|
+
else
|
33
|
+
img.resize width
|
34
|
+
end
|
31
35
|
|
32
|
-
img.resize width
|
33
36
|
img.format 'jpg'
|
34
37
|
Derivative.new("#{@id}/#{label}.jpg", label, img)
|
35
38
|
end
|
@@ -27,12 +27,14 @@ module WaxTasks
|
|
27
27
|
records = records_from_metadata
|
28
28
|
Dir.glob(Utils.safe_join(@imagedata_source, '*')).map do |path|
|
29
29
|
item = WaxTasks::Item.new(path, @image_variants)
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
30
|
+
if item.valid?
|
31
|
+
item.record = records.find { |r| r.pid == item.pid }
|
32
|
+
item.iiif_config = @config.dig 'images', 'iiif'
|
33
|
+
warn Rainbow("\nCould not find record in #{@metadata_source} for image item #{path}.\n").orange if item.record.nil?
|
34
|
+
item
|
35
|
+
else
|
36
|
+
puts Rainbow("Skipping #{path} because type #{item.type} is not an accepted format").yellow unless item.type == '.pdf'
|
37
|
+
end
|
36
38
|
end.compact
|
37
39
|
end
|
38
40
|
|
@@ -67,7 +69,7 @@ module WaxTasks
|
|
67
69
|
bar.increment!
|
68
70
|
bar.write
|
69
71
|
item
|
70
|
-
end.flat_map(&:record)
|
72
|
+
end.flat_map(&:record).compact
|
71
73
|
end
|
72
74
|
|
73
75
|
#
|
@@ -120,9 +122,10 @@ module WaxTasks
|
|
120
122
|
|
121
123
|
puts Rainbow("Generating IIIF derivatives for collection '#{@name}'\nThis might take awhile.").cyan
|
122
124
|
builder.process_data
|
125
|
+
records = items.map(&:record).compact
|
123
126
|
|
124
127
|
add_font_matter_to_json_files dir
|
125
|
-
add_iiif_results_to_records
|
128
|
+
add_iiif_results_to_records records, builder.manifests
|
126
129
|
end
|
127
130
|
end
|
128
131
|
end
|
data/lib/wax_tasks/item.rb
CHANGED
@@ -20,13 +20,13 @@ module WaxTasks
|
|
20
20
|
#
|
21
21
|
#
|
22
22
|
def accepted_image_formats
|
23
|
-
%w[.png .jpg .jpeg .tiff]
|
23
|
+
%w[.png .jpg .jpeg .tiff .tif]
|
24
24
|
end
|
25
25
|
|
26
26
|
#
|
27
27
|
#
|
28
28
|
def type
|
29
|
-
Dir.exist?(@path) ? 'dir' : File.extname(@path)
|
29
|
+
Dir.exist?(@path) ? 'dir' : File.extname(@path).downcase
|
30
30
|
end
|
31
31
|
|
32
32
|
#
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wax_tasks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marii Nyrop
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-06-
|
11
|
+
date: 2019-06-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: progress_bar
|