exiv2 0.1.1 → 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 +23 -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());
|
@@ -121,7 +134,7 @@ static VALUE image_read_metadata(VALUE self) {
|
|
121
134
|
try {
|
122
135
|
image->readMetadata();
|
123
136
|
}
|
124
|
-
catch (
|
137
|
+
catch (ExivError error) {
|
125
138
|
rb_raise(basic_error_class, "%s", error.what());
|
126
139
|
}
|
127
140
|
|
@@ -135,7 +148,7 @@ static VALUE image_write_metadata(VALUE self) {
|
|
135
148
|
try {
|
136
149
|
image->writeMetadata();
|
137
150
|
}
|
138
|
-
catch (
|
151
|
+
catch (ExivError error) {
|
139
152
|
rb_raise(basic_error_class, "%s", error.what());
|
140
153
|
}
|
141
154
|
|
@@ -178,10 +191,10 @@ static VALUE image_factory_open(VALUE klass, VALUE path) {
|
|
178
191
|
Exiv2::Image* image;
|
179
192
|
|
180
193
|
try {
|
181
|
-
|
182
|
-
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.
|
183
196
|
}
|
184
|
-
catch (
|
197
|
+
catch (ExivError error) {
|
185
198
|
rb_raise(basic_error_class, "%s", error.what());
|
186
199
|
}
|
187
200
|
|
@@ -207,7 +220,7 @@ static VALUE exif_data_add(VALUE self, VALUE key, VALUE value) {
|
|
207
220
|
Exiv2::TypeId typeId = exifKey.defaultTypeId();
|
208
221
|
#endif
|
209
222
|
|
210
|
-
|
223
|
+
ExivValuePtr v = Exiv2::Value::create(typeId);
|
211
224
|
v->read(to_std_string(value));
|
212
225
|
|
213
226
|
data->add(exifKey, v.get());
|
@@ -240,7 +253,7 @@ static VALUE iptc_data_add(VALUE self, VALUE key, VALUE value) {
|
|
240
253
|
Exiv2::IptcKey iptcKey = Exiv2::IptcKey(to_std_string(key));
|
241
254
|
Exiv2::TypeId typeId = Exiv2::IptcDataSets::dataSetType(iptcKey.tag(), iptcKey.record());
|
242
255
|
|
243
|
-
|
256
|
+
ExivValuePtr v = Exiv2::Value::create(typeId);
|
244
257
|
v->read(to_std_string(value));
|
245
258
|
|
246
259
|
if(data->add(iptcKey, v.get())) {
|
@@ -274,7 +287,7 @@ static VALUE xmp_data_add(VALUE self, VALUE key, VALUE value) {
|
|
274
287
|
Exiv2::XmpKey xmpKey = Exiv2::XmpKey(to_std_string(key));
|
275
288
|
Exiv2::TypeId typeId = Exiv2::XmpProperties::propertyType(xmpKey);
|
276
289
|
|
277
|
-
|
290
|
+
ExivValuePtr v = Exiv2::Value::create(typeId);
|
278
291
|
v->read(to_std_string(value));
|
279
292
|
|
280
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
|