exiv2 0.0.9 → 0.1.1

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: 700d9adb55ce3e0eb64fa2f2f8749c607e22ebd896e82b92142c4a901f8c2f99
4
- data.tar.gz: f74dc692a5e857177623ff7d62c88bd7f3dfb6e7e717fd47c9a05dbc6b921f2b
3
+ metadata.gz: 2d7b70abda815a7d5ee2a37dbda954d65f61a277cd41c73517d02c1659ac2ed6
4
+ data.tar.gz: 9f6aba355b6e181965205674a81a577bd4adc7ac085886021138d2ba925e3489
5
5
  SHA512:
6
- metadata.gz: '025834b98bb969965ce0a4a0b87df41f5bb4c193cf16297753f4bfc8ca45ab94c6048f81e6429e53f1dcb90e73bfdada4a39da8b1a816c594bf1767ae8ca7b82'
7
- data.tar.gz: 7b3f1468e28087b2f7b369a6b7b660656f31aef57b93ac048ad1f8333256f61c629a30d95834f2f50001b9720ebf2075110ab3b9b275923a5a9fa5be0fe5013f
6
+ metadata.gz: a0431aa73b62228bf2bbbfd618747ce18d3b453306f4ae452e9a4e8843c274ae1fb5ca65f09657f1d7ff568f4689fde1156320d4c1a8e1b4b86a844748a358d6
7
+ data.tar.gz: 5c67ecf3dee17f011d274610bff7d5e1d245ce0754f0f1d5c2095785759da78780c5a307ff48c2380e79b4e308171944f5430142b1563593789074ce8f2f5793
data/README.md CHANGED
@@ -1,6 +1,9 @@
1
1
  # Exiv2
2
2
 
3
- [![Build Status](https://travis-ci.org/envato/exiv2.svg)](https://travis-ci.org/envato/exiv2)
3
+ [![License MIT](https://img.shields.io/badge/license-MIT-brightgreen.svg)](https://github.com/envato/exiv2/blob/master/LICENSE)
4
+ [![Gem Version](https://img.shields.io/gem/v/exiv2.svg?maxAge=2592000)](https://rubygems.org/gems/exiv2)
5
+ [![Gem Downloads](https://img.shields.io/gem/dt/exiv2.svg?maxAge=2592000)](https://rubygems.org/gems/exiv2)
6
+ [![Build Status](https://github.com/envato/exiv2/workflows/tests/badge.svg?branch=master)](https://github.com/envato/exiv2/actions?query=branch%3Amaster+workflow%3Atests)
4
7
 
5
8
  A simple wrapper around the C++ Exiv2 libary for reading and writing image metadata.
6
9
 
data/ext/exiv2/exiv2.cpp CHANGED
@@ -75,6 +75,7 @@ extern "C" void Init_exiv2() {
75
75
  basic_error_class = rb_define_class_under(exiv2_module, "BasicError", rb_eRuntimeError);
76
76
 
77
77
  image_class = rb_define_class_under(exiv2_module, "Image", rb_cObject);
78
+ rb_undef_alloc_func(image_class);
78
79
  rb_define_method(image_class, "read_metadata", (Method)image_read_metadata, 0);
79
80
  rb_define_method(image_class, "write_metadata", (Method)image_write_metadata, 0);
80
81
  rb_define_method(image_class, "iptc_data", (Method)image_iptc_data, 0);
@@ -85,18 +86,21 @@ extern "C" void Init_exiv2() {
85
86
  rb_define_singleton_method(image_factory_class, "open", (Method)image_factory_open, 1);
86
87
 
87
88
  exif_data_class = rb_define_class_under(exiv2_module, "ExifData", rb_cObject);
89
+ rb_undef_alloc_func(exif_data_class);
88
90
  rb_include_module(exif_data_class, enumerable_module);
89
91
  rb_define_method(exif_data_class, "each", (Method)exif_data_each, 0);
90
92
  rb_define_method(exif_data_class, "add", (Method)exif_data_add, 2);
91
93
  rb_define_method(exif_data_class, "delete", (Method)exif_data_delete, 1);
92
94
 
93
95
  iptc_data_class = rb_define_class_under(exiv2_module, "IptcData", rb_cObject);
96
+ rb_undef_alloc_func(iptc_data_class);
94
97
  rb_include_module(iptc_data_class, enumerable_module);
95
98
  rb_define_method(iptc_data_class, "each", (Method)iptc_data_each, 0);
96
99
  rb_define_method(iptc_data_class, "add", (Method)iptc_data_add, 2);
97
100
  rb_define_method(iptc_data_class, "delete", (Method)iptc_data_delete, 1);
98
101
 
99
102
  xmp_data_class = rb_define_class_under(exiv2_module, "XmpData", rb_cObject);
103
+ rb_undef_alloc_func(xmp_data_class);
100
104
  rb_include_module(xmp_data_class, enumerable_module);
101
105
  rb_define_method(xmp_data_class, "each", (Method)xmp_data_each, 0);
102
106
  rb_define_method(xmp_data_class, "add", (Method)xmp_data_add, 2);
data/ext/exiv2/extconf.rb CHANGED
@@ -5,6 +5,8 @@ RbConfig::MAKEFILE_CONFIG['CCFLAGS'] = ENV['CCFLAGS'] if ENV['CCFLAGS']
5
5
  RbConfig::MAKEFILE_CONFIG['CXX'] = ENV['CXX'] if ENV['CXX']
6
6
  RbConfig::MAKEFILE_CONFIG['CXXFLAGS'] = ENV['CXXFLAGS'] if ENV['CXXFLAGS']
7
7
 
8
- dir_config("exiv2")
8
+ if dir_config("exiv2") == [nil, nil]
9
+ pkg_config("exiv2")
10
+ end
9
11
  have_library("exiv2")
10
12
  create_makefile("exiv2/exiv2")
data/lib/exiv2/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  # coding: utf-8
2
2
  module Exiv2
3
- VERSION = "0.0.9"
3
+ VERSION = "0.1.1"
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: exiv2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pete Yandell
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-27 00:00:00.000000000 Z
11
+ date: 2023-02-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -46,15 +46,8 @@ extensions:
46
46
  - ext/exiv2/extconf.rb
47
47
  extra_rdoc_files: []
48
48
  files:
49
- - ".gitignore"
50
- - ".rspec"
51
- - ".travis.yml"
52
- - Gemfile
53
- - Gemfile.lock
54
49
  - LICENSE
55
50
  - README.md
56
- - Rakefile
57
- - exiv2.gemspec
58
51
  - ext/exiv2/exiv2.cpp
59
52
  - ext/exiv2/extconf.rb
60
53
  - lib/exiv2.rb
@@ -63,13 +56,15 @@ files:
63
56
  - lib/exiv2/shared_methods.rb
64
57
  - lib/exiv2/version.rb
65
58
  - lib/exiv2/xmp_data.rb
66
- - spec/exiv2_spec.rb
67
- - spec/files/photo_with_utf8_description.jpg
68
- - spec/files/test.jpg
69
59
  homepage: https://github.com/envato/exiv2
70
60
  licenses: []
71
- metadata: {}
72
- post_install_message:
61
+ metadata:
62
+ bug_tracker_uri: https://github.com/envato/exiv2/issues
63
+ changelog_uri: https://github.com/envato/exiv2/releases
64
+ documentation_uri: https://www.rubydoc.info/gems/exiv2/0.1.1
65
+ homepage_uri: https://github.com/envato/exiv2
66
+ source_code_uri: https://github.com/envato/exiv2/tree/v0.1.1
67
+ post_install_message:
73
68
  rdoc_options: []
74
69
  require_paths:
75
70
  - lib
@@ -85,12 +80,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
85
80
  - !ruby/object:Gem::Version
86
81
  version: '0'
87
82
  requirements: []
88
- rubyforge_project: exiv2
89
- rubygems_version: 2.7.7
90
- signing_key:
83
+ rubygems_version: 3.4.6
84
+ signing_key:
91
85
  specification_version: 4
92
86
  summary: A simple wrapper around Exiv2
93
- test_files:
94
- - spec/exiv2_spec.rb
95
- - spec/files/photo_with_utf8_description.jpg
96
- - spec/files/test.jpg
87
+ test_files: []
data/.gitignore DELETED
@@ -1,14 +0,0 @@
1
- Makefile
2
- mkmf.log
3
- .DS_Store
4
- *.gem
5
- *.bundle
6
- *.rbc
7
- *.a
8
- *.o
9
- *.so
10
- *.dSYM
11
- pkg
12
- tmp
13
- bin
14
- /vendor
data/.rspec DELETED
@@ -1 +0,0 @@
1
- --colour
data/.travis.yml DELETED
@@ -1,9 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.4
4
- - 2.5
5
- - 2.6
6
- before_script:
7
- - sudo apt-get install libexiv2-dev
8
- script:
9
- - bundle exec rake spec
data/Gemfile DELETED
@@ -1,3 +0,0 @@
1
- source "http://rubygems.org"
2
-
3
- gemspec
data/Gemfile.lock DELETED
@@ -1,36 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- exiv2 (0.0.9)
5
-
6
- GEM
7
- remote: http://rubygems.org/
8
- specs:
9
- diff-lcs (1.2.5)
10
- rake (10.4.2)
11
- rake-compiler (0.9.5)
12
- rake
13
- rspec (3.4.0)
14
- rspec-core (~> 3.4.0)
15
- rspec-expectations (~> 3.4.0)
16
- rspec-mocks (~> 3.4.0)
17
- rspec-core (3.4.1)
18
- rspec-support (~> 3.4.0)
19
- rspec-expectations (3.4.0)
20
- diff-lcs (>= 1.2.0, < 2.0)
21
- rspec-support (~> 3.4.0)
22
- rspec-mocks (3.4.0)
23
- diff-lcs (>= 1.2.0, < 2.0)
24
- rspec-support (~> 3.4.0)
25
- rspec-support (3.4.1)
26
-
27
- PLATFORMS
28
- ruby
29
-
30
- DEPENDENCIES
31
- exiv2!
32
- rake-compiler
33
- rspec
34
-
35
- BUNDLED WITH
36
- 1.10.6
data/Rakefile DELETED
@@ -1,16 +0,0 @@
1
- require 'rspec/core/rake_task'
2
- RSpec::Core::RakeTask.new(:spec)
3
- task :default => :spec
4
-
5
- require 'rake/extensiontask'
6
- Rake::ExtensionTask.new('exiv2') do |ext|
7
- ext.lib_dir = "lib/exiv2"
8
- if ENV['EXIV2_DIR']
9
- ext.config_options << "--with-exiv2-dir=#{ENV['EXIV2_DIR']}"
10
- end
11
- end
12
- Rake::Task[:spec].prerequisites << :compile
13
-
14
- require 'bundler'
15
- Bundler::GemHelper.install_tasks
16
-
data/exiv2.gemspec DELETED
@@ -1,25 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- $:.push File.expand_path("../lib", __FILE__)
3
- require "exiv2/version"
4
-
5
- Gem::Specification.new do |s|
6
- s.name = "exiv2"
7
- s.version = Exiv2::VERSION
8
- s.platform = Gem::Platform::RUBY
9
- s.authors = ["Pete Yandell"]
10
- s.email = ["pete@envato.com"]
11
- s.homepage = "https://github.com/envato/exiv2"
12
- s.summary = %q{A simple wrapper around Exiv2}
13
- s.description = %q{A simple wrapper around the C++ Exiv2 libary for reading image metadata}
14
-
15
- s.rubyforge_project = "exiv2"
16
-
17
- s.add_development_dependency "rspec"
18
- s.add_development_dependency "rake-compiler"
19
-
20
- s.files = `git ls-files`.split("\n")
21
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
22
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
23
- s.require_paths = ["lib", "ext"]
24
- s.extensions = ["ext/exiv2/extconf.rb"]
25
- end
data/spec/exiv2_spec.rb DELETED
@@ -1,227 +0,0 @@
1
- # coding: utf-8
2
- require 'bundler/setup'
3
- require 'exiv2'
4
- require 'fileutils'
5
-
6
- describe Exiv2 do
7
-
8
- it "should handle a Pathname being passed to open" do
9
- image = Exiv2::ImageFactory.open(Pathname.new("spec/files/test.jpg").to_s)
10
- image.read_metadata
11
- expect(image.iptc_data.to_hash).not_to be_empty
12
- end
13
-
14
- it "should raise an error when trying to open a non-existant file" do
15
- expect {
16
- Exiv2::ImageFactory.open("tmp/no-such-file.jpg")
17
- }.to raise_error(Exiv2::BasicError)
18
- end
19
-
20
- it "should write metadata" do
21
- FileUtils.cp("spec/files/test.jpg", "spec/files/test_tmp.jpg")
22
- image = Exiv2::ImageFactory.open("spec/files/test_tmp.jpg")
23
- image.read_metadata
24
- image.iptc_data["Iptc.Application2.Caption"] = "A New Caption"
25
- image.write_metadata
26
- image = nil
27
-
28
- image2 = Exiv2::ImageFactory.open("spec/files/test_tmp.jpg")
29
- image2.read_metadata
30
- expect(image2.iptc_data["Iptc.Application2.Caption"]).to eq("A New Caption")
31
- FileUtils.rm("spec/files/test_tmp.jpg")
32
- end
33
-
34
- it 'reads UTF-8 data' do
35
- image = Exiv2::ImageFactory.open(Pathname.new("spec/files/photo_with_utf8_description.jpg").to_s)
36
- image.read_metadata
37
- description = image.exif_data["Exif.Image.ImageDescription"]
38
- if description.respond_to? :encoding # Only in Ruby 1.9+
39
- expect(description.encoding).to eq(Encoding::UTF_8)
40
- end
41
- expect(description).to eq('UTF-8 description. ☃ł㌎')
42
- end
43
-
44
- it 'reads UTF-8 data in each' do
45
- if String.new.respond_to? :encoding # Only in Ruby 1.9+
46
- image = Exiv2::ImageFactory.open(Pathname.new("spec/files/photo_with_utf8_description.jpg").to_s)
47
- image.read_metadata
48
- image.exif_data.each do |key,value|
49
- expect(key.encoding).to eq(Encoding::UTF_8)
50
- expect(value.encoding).to eq(Encoding::UTF_8)
51
- end
52
- end
53
- end
54
-
55
- let(:image) do
56
- image = Exiv2::ImageFactory.open("spec/files/test.jpg")
57
- image.read_metadata
58
- image
59
- end
60
-
61
- context "IPTC data" do
62
- before do
63
- @iptc_data = image.iptc_data
64
- end
65
-
66
- it "should read IPTC data" do
67
- expect(@iptc_data).to be_a(Exiv2::IptcData)
68
- expect(@iptc_data.inspect).to eq('#<Exiv2::IptcData: {"Iptc.Application2.Caption"=>"Rhubarb rhubarb rhubard", "Iptc.Application2.Keywords"=>["fish", "custard"]}>')
69
- expect(@iptc_data.to_a).to eq([
70
- ["Iptc.Application2.Caption", "Rhubarb rhubarb rhubard"],
71
- ["Iptc.Application2.Keywords", "fish"],
72
- ["Iptc.Application2.Keywords", "custard"]
73
- ])
74
- end
75
-
76
- it "should convert iptc data into a hash" do
77
- iptc_hash = @iptc_data.to_hash
78
- expect(iptc_hash).to be_a(Hash)
79
- expect(iptc_hash).to eq({
80
- "Iptc.Application2.Caption" => "Rhubarb rhubarb rhubard",
81
- "Iptc.Application2.Keywords" => ["fish", "custard"]
82
- })
83
- end
84
-
85
- it "should write IPTC data" do
86
- @iptc_data.add("Iptc.Application2.Keywords", "fishy")
87
- expect(@iptc_data.to_a).to eq([
88
- ["Iptc.Application2.Caption", "Rhubarb rhubarb rhubard"],
89
- ["Iptc.Application2.Keywords", "fish"],
90
- ["Iptc.Application2.Keywords", "custard"],
91
- ["Iptc.Application2.Keywords", "fishy"]
92
- ])
93
- end
94
-
95
- it "should set IPTC data" do
96
- @iptc_data["Iptc.Application2.Caption"] = "A New Caption"
97
- expect(@iptc_data.to_hash["Iptc.Application2.Caption"]).to eq("A New Caption")
98
- end
99
-
100
- it "should set multiply IPTC data values" do
101
- @iptc_data["Iptc.Application2.Keywords"] = ["abc", "cde"]
102
- expect(@iptc_data.to_hash["Iptc.Application2.Keywords"]).to eq(["abc", "cde"])
103
- end
104
-
105
- it "should delete one value of IPTC data" do
106
- @iptc_data.delete("Iptc.Application2.Keywords")
107
- expect(@iptc_data.to_hash["Iptc.Application2.Keywords"]).to eq("custard")
108
- end
109
-
110
- it "should delete all values of IPTC data" do
111
- @iptc_data.delete_all("Iptc.Application2.Keywords")
112
- expect(@iptc_data.to_hash["Iptc.Application2.Keywords"]).to eq(nil)
113
- end
114
- end
115
-
116
- context "XMP data" do
117
- before do
118
- @xmp_data = image.xmp_data
119
- end
120
-
121
- it "should read XMP data" do
122
- expect(@xmp_data).to be_a(Exiv2::XmpData)
123
- expect(@xmp_data.inspect).to eq('#<Exiv2::XmpData: {"Xmp.dc.description"=>"lang=\"x-default\" This is a description", "Xmp.dc.title"=>"lang=\"x-default\" Pickled"}>')
124
- expect(@xmp_data.to_a).to eq([
125
- ["Xmp.dc.title", "lang=\"x-default\" Pickled"],
126
- ["Xmp.dc.description", "lang=\"x-default\" This is a description"]
127
- ])
128
- end
129
-
130
- it "should convert xmp data into a hash" do
131
- xmp_hash = @xmp_data.to_hash
132
- expect(xmp_hash).to be_a(Hash)
133
- expect(xmp_hash).to eq({
134
- "Xmp.dc.title" => "lang=\"x-default\" Pickled",
135
- "Xmp.dc.description" => "lang=\"x-default\" This is a description"
136
- })
137
- end
138
-
139
- it "should write XMP data" do
140
- @xmp_data["Xmp.dc.title"] = "lang=\"x-default\" Changed!"
141
- expect(@xmp_data.to_hash["Xmp.dc.title"]).to eq("lang=\"x-default\" Changed!")
142
- end
143
-
144
- it "should set XMP data" do
145
- @xmp_data["Xmp.dc.title"] = "A New Title"
146
- expect(@xmp_data.to_hash["Xmp.dc.title"]).to eq("lang=\"x-default\" A New Title")
147
- end
148
-
149
- it "should set multiply XMP data values" do
150
- @xmp_data["Xmp.dc.title"] = ["abc", "cde"]
151
- expect(@xmp_data.to_hash["Xmp.dc.title"]).to eq(["lang=\"x-default\" abc", "lang=\"x-default\" cde"])
152
- end
153
-
154
- it "should delete one value of XMP data" do
155
- @xmp_data["Xmp.dc.title"] = ["abc", "cde"]
156
- @xmp_data.delete("Xmp.dc.title")
157
- expect(@xmp_data.to_hash["Xmp.dc.title"]).to eq("lang=\"x-default\" cde")
158
- end
159
-
160
- it "should delete all values of XMP data" do
161
- @xmp_data.delete_all("Xmp.dc.title")
162
- expect(@xmp_data.to_hash["Xmp.dc.title"]).to eq(nil)
163
- end
164
- end
165
-
166
- context "EXIF data" do
167
- before do
168
- @exif_data = image.exif_data
169
- end
170
-
171
- it "should read Exif data" do
172
- expect(@exif_data).to be_a(Exiv2::ExifData)
173
- expect(@exif_data.inspect).to eq('#<Exiv2::ExifData: {"Exif.Image.ExifTag"=>"52", "Exif.Image.Software"=>"plasq skitch", "Exif.Photo.ExifVersion"=>"48 50 49 48", "Exif.Photo.PixelXDimension"=>"32", "Exif.Photo.PixelYDimension"=>"32"}>')
174
- expect(@exif_data.to_a).to eq([
175
- ["Exif.Image.Software", "plasq skitch"],
176
- ["Exif.Image.ExifTag", "52"],
177
- ["Exif.Photo.ExifVersion", "48 50 49 48"],
178
- ["Exif.Photo.PixelXDimension", "32"],
179
- ["Exif.Photo.PixelYDimension", "32"]
180
- ])
181
- end
182
-
183
- it "should convert xmp data into a hash" do
184
- exif_hash = @exif_data.to_hash
185
- expect(exif_hash).to be_a(Hash)
186
- expect(exif_hash).to eq({
187
- "Exif.Photo.PixelXDimension" => "32",
188
- "Exif.Photo.ExifVersion" => "48 50 49 48",
189
- "Exif.Image.Software" => "plasq skitch",
190
- "Exif.Photo.PixelYDimension" => "32",
191
- "Exif.Image.ExifTag" => "52"
192
- })
193
- end
194
-
195
- it "should write Exif data" do
196
- @exif_data.add("Exif.Image.Software", "ruby-exiv2")
197
- expect(@exif_data.to_hash).to eq({
198
- "Exif.Photo.PixelXDimension" => "32",
199
- "Exif.Photo.ExifVersion" => "48 50 49 48",
200
- "Exif.Image.Software" => ["plasq skitch", "ruby-exiv2"],
201
- "Exif.Photo.PixelYDimension" => "32",
202
- "Exif.Image.ExifTag" => "52"
203
- })
204
- end
205
-
206
- it "should set Exif data" do
207
- @exif_data["Exif.Image.Software"] = "ruby-exiv2"
208
- expect(@exif_data.to_hash["Exif.Image.Software"]).to eq("ruby-exiv2")
209
- end
210
-
211
- it "should set multiply Exif data values" do
212
- @exif_data["Exif.Image.Software"] = ["ruby-exiv2", "plasq skitch"]
213
- expect(@exif_data.to_hash["Exif.Image.Software"]).to eq(["ruby-exiv2", "plasq skitch"])
214
- end
215
-
216
- it "should delete one value of Exif data" do
217
- @exif_data["Exif.Image.Software"] = ["ruby-exiv2", "plasq skitch"]
218
- @exif_data.delete("Exif.Image.Software")
219
- expect(@exif_data.to_hash["Exif.Image.Software"]).to eq("plasq skitch")
220
- end
221
-
222
- it "should delete all values of Exif data" do
223
- @exif_data.delete_all("Exif.Image.Software")
224
- expect(@exif_data.to_hash["Exif.Image.Software"]).to eq(nil)
225
- end
226
- end
227
- end
data/spec/files/test.jpg DELETED
Binary file