exiv2 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/ext/exiv2/exiv2.cpp +8 -1
- data/lib/exiv2/shared_methods.rb +0 -2
- data/lib/exiv2/version.rb +1 -1
- data/spec/exiv2_spec.rb +14 -1
- metadata +13 -8
- data/.rbenv-version +0 -1
data/Gemfile.lock
CHANGED
data/ext/exiv2/exiv2.cpp
CHANGED
@@ -3,7 +3,14 @@
|
|
3
3
|
|
4
4
|
// Create a Ruby string from a C++ std::string.
|
5
5
|
static VALUE to_ruby_string(const std::string& string) {
|
6
|
-
|
6
|
+
VALUE str = rb_str_new(string.data(), string.length());
|
7
|
+
|
8
|
+
// force UTF-8 encoding in Ruby 1.9+
|
9
|
+
ID forceEncodingId = rb_intern("force_encoding");
|
10
|
+
if(rb_respond_to(str, forceEncodingId)) {
|
11
|
+
rb_funcall(str, forceEncodingId, 1, rb_str_new("UTF-8", 5));
|
12
|
+
}
|
13
|
+
return str;
|
7
14
|
}
|
8
15
|
|
9
16
|
// Create a C++ std::string from a Ruby string.
|
data/lib/exiv2/shared_methods.rb
CHANGED
data/lib/exiv2/version.rb
CHANGED
data/spec/exiv2_spec.rb
CHANGED
@@ -35,9 +35,22 @@ describe Exiv2 do
|
|
35
35
|
image = Exiv2::ImageFactory.open(Pathname.new("spec/files/photo_with_utf8_description.jpg").to_s)
|
36
36
|
image.read_metadata
|
37
37
|
description = image.exif_data["Exif.Image.ImageDescription"]
|
38
|
-
description.encoding
|
38
|
+
if description.respond_to? :encoding # Only in Ruby 1.9+
|
39
|
+
description.encoding.should == Encoding::UTF_8
|
40
|
+
end
|
39
41
|
description.should == 'UTF-8 description. ☃ł㌎'
|
40
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
|
+
key.encoding.should == Encoding::UTF_8
|
50
|
+
value.encoding.should == Encoding::UTF_8
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
41
54
|
|
42
55
|
let(:image) do
|
43
56
|
image = Exiv2::ImageFactory.open("spec/files/test.jpg")
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: exiv2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-02-
|
12
|
+
date: 2012-02-24 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &2157752580 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2157752580
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rake-compiler
|
27
|
-
requirement: &
|
27
|
+
requirement: &2157751940 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2157751940
|
36
36
|
description: A simple wrapper around the C++ Exiv2 libary for reading image metadata
|
37
37
|
email:
|
38
38
|
- pete@envato.com
|
@@ -42,7 +42,6 @@ extensions:
|
|
42
42
|
extra_rdoc_files: []
|
43
43
|
files:
|
44
44
|
- .gitignore
|
45
|
-
- .rbenv-version
|
46
45
|
- .rspec
|
47
46
|
- Gemfile
|
48
47
|
- Gemfile.lock
|
@@ -74,15 +73,21 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
74
73
|
- - ! '>='
|
75
74
|
- !ruby/object:Gem::Version
|
76
75
|
version: '0'
|
76
|
+
segments:
|
77
|
+
- 0
|
78
|
+
hash: 1767711018481939965
|
77
79
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
78
80
|
none: false
|
79
81
|
requirements:
|
80
82
|
- - ! '>='
|
81
83
|
- !ruby/object:Gem::Version
|
82
84
|
version: '0'
|
85
|
+
segments:
|
86
|
+
- 0
|
87
|
+
hash: 1767711018481939965
|
83
88
|
requirements: []
|
84
89
|
rubyforge_project: exiv2
|
85
|
-
rubygems_version: 1.8.
|
90
|
+
rubygems_version: 1.8.10
|
86
91
|
signing_key:
|
87
92
|
specification_version: 3
|
88
93
|
summary: A simple wrapper around Exiv2
|
data/.rbenv-version
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
1.9.3-p125
|