exiv2 0.1.0 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -31
- data/ext/exiv2/exiv2.cpp +27 -10
- data/ext/exiv2/extconf.rb +21 -4
- data/lib/exiv2/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c62790694ad3a6cf96e9f52341343bedefc97acbc262c3e454c0582cfd53fbab
|
4
|
+
data.tar.gz: 8cc6d290fc681e9a597a5b920ecdd23521cb2bec04616c26d02efabe9716ed98
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fc9cb80689cbff412812924041daca2c69c191689dd602f0700688a563a86191ca48d4b9fc09f6c1ac9933cd9ac463df6417bd9c4b0a4cda78f787e4435fa627
|
7
|
+
data.tar.gz: 76d9e02c5524da3741c7a46a43fc26d28558947110527e01e5191607a675123abcaa4bfe6f131a6df6a2987b4c84e8d313b35551cc27fca6892b444eeb3d7ef4
|
data/README.md
CHANGED
@@ -17,31 +17,6 @@ Requires that the exiv2 C++ library is installed.
|
|
17
17
|
gem install exiv2
|
18
18
|
```
|
19
19
|
|
20
|
-
if you get errors with header could not be found below:
|
21
|
-
|
22
|
-
```
|
23
|
-
exiv2.cpp:1:10: fatal error: 'exiv2/image.hpp' file not found
|
24
|
-
#include "exiv2/image.hpp"
|
25
|
-
```
|
26
|
-
|
27
|
-
please explicitly declare the header path
|
28
|
-
|
29
|
-
```
|
30
|
-
gem install exiv2 -- --with-exiv2-include="${EXIV2_PREFIX}/include" --with-exiv2-lib="${EXIV2_PREFIX}/lib"
|
31
|
-
```
|
32
|
-
|
33
|
-
on OSX with Homebrew's exiv2, the `EXIV2_PREFIX` can be set:
|
34
|
-
|
35
|
-
```
|
36
|
-
export EXIV2_PREFIX=$(brew --prefix exiv2)
|
37
|
-
```
|
38
|
-
|
39
|
-
If you get this error while trying to install as part of a bundle install, you can set these paths using:
|
40
|
-
```
|
41
|
-
bundle config build.exiv2 --with-exiv2-include="${EXIV2_PREFIX}/include" --with-exiv2-lib="${EXIV2_PREFIX}/lib"
|
42
|
-
```
|
43
|
-
|
44
|
-
|
45
20
|
If you are on new version of Command Line Tool (that is newer than 6.2, and bump into following error:
|
46
21
|
|
47
22
|
```
|
@@ -93,17 +68,17 @@ are welcome.
|
|
93
68
|
|
94
69
|
## Compatibility
|
95
70
|
|
96
|
-
Tested on 2.
|
71
|
+
Tested on 2.6.x, 2.7.x, 3.0.x, 3.1.x and 3.2.x with Exiv2 0.27.1 and 0.28.0.
|
97
72
|
|
98
73
|
## Developing
|
99
74
|
|
100
|
-
|
101
|
-
|
102
|
-
|
75
|
+
- Fork the project.
|
76
|
+
- Make your feature addition or bug fix.
|
77
|
+
- Add tests for it. This is important so I don't break it in a
|
103
78
|
future version unintentionally.
|
104
|
-
|
79
|
+
- Commit, do not mess with rakefile, version, or history.
|
105
80
|
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
106
|
-
|
81
|
+
- Send me a pull request. Bonus points for topic branches.
|
107
82
|
|
108
83
|
## Status
|
109
84
|
|
data/ext/exiv2/exiv2.cpp
CHANGED
@@ -1,7 +1,20 @@
|
|
1
|
-
#include "exiv2/
|
2
|
-
#include "exiv2/error.hpp"
|
1
|
+
#include "exiv2/exiv2.hpp"
|
3
2
|
#include "ruby.h"
|
4
3
|
|
4
|
+
#if EXIV2_MAJOR_VERSION == 0 && EXIV2_MINOR_VERSION <= 27
|
5
|
+
#define ExivImagePtr Exiv2::Image::AutoPtr
|
6
|
+
#define ExivValuePtr Exiv2::Value::AutoPtr
|
7
|
+
#else
|
8
|
+
#define ExivImagePtr Exiv2::Image::UniquePtr
|
9
|
+
#define ExivValuePtr Exiv2::Value::UniquePtr
|
10
|
+
#endif
|
11
|
+
|
12
|
+
#if EXIV2_MAJOR_VERSION == 0 && EXIV2_MINOR_VERSION <= 27
|
13
|
+
#define ExivError Exiv2::BasicError<char>
|
14
|
+
#else
|
15
|
+
#define ExivError Exiv2::Error
|
16
|
+
#endif
|
17
|
+
|
5
18
|
// Create a Ruby string from a C++ std::string.
|
6
19
|
static VALUE to_ruby_string(const std::string& string) {
|
7
20
|
VALUE str = rb_str_new(string.data(), string.length());
|
@@ -75,6 +88,7 @@ extern "C" void Init_exiv2() {
|
|
75
88
|
basic_error_class = rb_define_class_under(exiv2_module, "BasicError", rb_eRuntimeError);
|
76
89
|
|
77
90
|
image_class = rb_define_class_under(exiv2_module, "Image", rb_cObject);
|
91
|
+
rb_undef_alloc_func(image_class);
|
78
92
|
rb_define_method(image_class, "read_metadata", (Method)image_read_metadata, 0);
|
79
93
|
rb_define_method(image_class, "write_metadata", (Method)image_write_metadata, 0);
|
80
94
|
rb_define_method(image_class, "iptc_data", (Method)image_iptc_data, 0);
|
@@ -85,18 +99,21 @@ extern "C" void Init_exiv2() {
|
|
85
99
|
rb_define_singleton_method(image_factory_class, "open", (Method)image_factory_open, 1);
|
86
100
|
|
87
101
|
exif_data_class = rb_define_class_under(exiv2_module, "ExifData", rb_cObject);
|
102
|
+
rb_undef_alloc_func(exif_data_class);
|
88
103
|
rb_include_module(exif_data_class, enumerable_module);
|
89
104
|
rb_define_method(exif_data_class, "each", (Method)exif_data_each, 0);
|
90
105
|
rb_define_method(exif_data_class, "add", (Method)exif_data_add, 2);
|
91
106
|
rb_define_method(exif_data_class, "delete", (Method)exif_data_delete, 1);
|
92
107
|
|
93
108
|
iptc_data_class = rb_define_class_under(exiv2_module, "IptcData", rb_cObject);
|
109
|
+
rb_undef_alloc_func(iptc_data_class);
|
94
110
|
rb_include_module(iptc_data_class, enumerable_module);
|
95
111
|
rb_define_method(iptc_data_class, "each", (Method)iptc_data_each, 0);
|
96
112
|
rb_define_method(iptc_data_class, "add", (Method)iptc_data_add, 2);
|
97
113
|
rb_define_method(iptc_data_class, "delete", (Method)iptc_data_delete, 1);
|
98
114
|
|
99
115
|
xmp_data_class = rb_define_class_under(exiv2_module, "XmpData", rb_cObject);
|
116
|
+
rb_undef_alloc_func(xmp_data_class);
|
100
117
|
rb_include_module(xmp_data_class, enumerable_module);
|
101
118
|
rb_define_method(xmp_data_class, "each", (Method)xmp_data_each, 0);
|
102
119
|
rb_define_method(xmp_data_class, "add", (Method)xmp_data_add, 2);
|
@@ -117,7 +134,7 @@ static VALUE image_read_metadata(VALUE self) {
|
|
117
134
|
try {
|
118
135
|
image->readMetadata();
|
119
136
|
}
|
120
|
-
catch (
|
137
|
+
catch (ExivError error) {
|
121
138
|
rb_raise(basic_error_class, "%s", error.what());
|
122
139
|
}
|
123
140
|
|
@@ -131,7 +148,7 @@ static VALUE image_write_metadata(VALUE self) {
|
|
131
148
|
try {
|
132
149
|
image->writeMetadata();
|
133
150
|
}
|
134
|
-
catch (
|
151
|
+
catch (ExivError error) {
|
135
152
|
rb_raise(basic_error_class, "%s", error.what());
|
136
153
|
}
|
137
154
|
|
@@ -174,10 +191,10 @@ static VALUE image_factory_open(VALUE klass, VALUE path) {
|
|
174
191
|
Exiv2::Image* image;
|
175
192
|
|
176
193
|
try {
|
177
|
-
|
178
|
-
image =
|
194
|
+
ExivImagePtr image_ptr = Exiv2::ImageFactory::open(to_std_string(path));
|
195
|
+
image = image_ptr.release(); // Release the pointer, so we can keep the image around.
|
179
196
|
}
|
180
|
-
catch (
|
197
|
+
catch (ExivError error) {
|
181
198
|
rb_raise(basic_error_class, "%s", error.what());
|
182
199
|
}
|
183
200
|
|
@@ -203,7 +220,7 @@ static VALUE exif_data_add(VALUE self, VALUE key, VALUE value) {
|
|
203
220
|
Exiv2::TypeId typeId = exifKey.defaultTypeId();
|
204
221
|
#endif
|
205
222
|
|
206
|
-
|
223
|
+
ExivValuePtr v = Exiv2::Value::create(typeId);
|
207
224
|
v->read(to_std_string(value));
|
208
225
|
|
209
226
|
data->add(exifKey, v.get());
|
@@ -236,7 +253,7 @@ static VALUE iptc_data_add(VALUE self, VALUE key, VALUE value) {
|
|
236
253
|
Exiv2::IptcKey iptcKey = Exiv2::IptcKey(to_std_string(key));
|
237
254
|
Exiv2::TypeId typeId = Exiv2::IptcDataSets::dataSetType(iptcKey.tag(), iptcKey.record());
|
238
255
|
|
239
|
-
|
256
|
+
ExivValuePtr v = Exiv2::Value::create(typeId);
|
240
257
|
v->read(to_std_string(value));
|
241
258
|
|
242
259
|
if(data->add(iptcKey, v.get())) {
|
@@ -270,7 +287,7 @@ static VALUE xmp_data_add(VALUE self, VALUE key, VALUE value) {
|
|
270
287
|
Exiv2::XmpKey xmpKey = Exiv2::XmpKey(to_std_string(key));
|
271
288
|
Exiv2::TypeId typeId = Exiv2::XmpProperties::propertyType(xmpKey);
|
272
289
|
|
273
|
-
|
290
|
+
ExivValuePtr v = Exiv2::Value::create(typeId);
|
274
291
|
v->read(to_std_string(value));
|
275
292
|
|
276
293
|
if(data->add(xmpKey, v.get())) {
|
data/ext/exiv2/extconf.rb
CHANGED
@@ -1,12 +1,29 @@
|
|
1
1
|
require 'mkmf'
|
2
2
|
|
3
|
-
|
4
|
-
RbConfig::
|
5
|
-
RbConfig::MAKEFILE_CONFIG['CXX'] = ENV['CXX'] if ENV['CXX']
|
6
|
-
RbConfig::MAKEFILE_CONFIG['CXXFLAGS'] = ENV['CXXFLAGS'] if ENV['CXXFLAGS']
|
3
|
+
$CXXFLAGS += " -std=c++11"
|
4
|
+
RbConfig::CONFIG['PKG_CONFIG'] = 'pkg-config'
|
7
5
|
|
8
6
|
if dir_config("exiv2") == [nil, nil]
|
9
7
|
pkg_config("exiv2")
|
10
8
|
end
|
11
9
|
have_library("exiv2")
|
10
|
+
|
11
|
+
# Some extensions are optional in versions <= 0.27 and also don't exist in
|
12
|
+
# versions >= 0.28.
|
13
|
+
# Check if they're enabled in the existing exiv2 headers
|
14
|
+
# configuration and include the relevant libraries.
|
15
|
+
if have_macro("EXV_USE_SSH", "exiv2/exv_conf.h")
|
16
|
+
if dir_config("libssh") == [nil, nil]
|
17
|
+
pkg_config("libssh")
|
18
|
+
end
|
19
|
+
have_library("libssh")
|
20
|
+
end
|
21
|
+
|
22
|
+
if have_macro("EXV_USE_CURL", "exiv2/exv_conf.h")
|
23
|
+
if dir_config("libcurl") == [nil, nil]
|
24
|
+
pkg_config("libcurl")
|
25
|
+
end
|
26
|
+
have_library("libcurl")
|
27
|
+
end
|
28
|
+
|
12
29
|
create_makefile("exiv2/exiv2")
|
data/lib/exiv2/version.rb
CHANGED
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.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pete Yandell
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 1980-01-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -61,9 +61,9 @@ licenses: []
|
|
61
61
|
metadata:
|
62
62
|
bug_tracker_uri: https://github.com/envato/exiv2/issues
|
63
63
|
changelog_uri: https://github.com/envato/exiv2/releases
|
64
|
-
documentation_uri: https://www.rubydoc.info/gems/exiv2/0.1.
|
64
|
+
documentation_uri: https://www.rubydoc.info/gems/exiv2/0.1.2
|
65
65
|
homepage_uri: https://github.com/envato/exiv2
|
66
|
-
source_code_uri: https://github.com/envato/exiv2/tree/v0.1.
|
66
|
+
source_code_uri: https://github.com/envato/exiv2/tree/v0.1.2
|
67
67
|
post_install_message:
|
68
68
|
rdoc_options: []
|
69
69
|
require_paths:
|
@@ -80,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
80
80
|
- !ruby/object:Gem::Version
|
81
81
|
version: '0'
|
82
82
|
requirements: []
|
83
|
-
rubygems_version: 3.
|
83
|
+
rubygems_version: 3.3.26
|
84
84
|
signing_key:
|
85
85
|
specification_version: 4
|
86
86
|
summary: A simple wrapper around Exiv2
|