mini_exiftool 1.2.2 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/Changelog CHANGED
@@ -1,3 +1,7 @@
1
+ v1.3.0
2
+ - MiniExiftool is now ready for Ruby 1.9
3
+ All tests in the test suite pass. :)
4
+
1
5
  v1.2.2
2
6
  - Fixing ptore directory naming convention for darwin.
3
7
  Thanks to Denis Barushev for the hint.
@@ -1,3 +1,4 @@
1
+ # -- encoding: utf-8 --
1
2
  require 'open-uri'
2
3
  require 'rubygems'
3
4
  require 'mini_exiftool'
@@ -1,3 +1,4 @@
1
+ # -- encoding: utf-8 --
1
2
  require 'rubygems'
2
3
  require 'mini_exiftool'
3
4
 
@@ -1,3 +1,4 @@
1
+ # -- encoding: utf-8 --
1
2
  require 'rubygems'
2
3
  require 'mini_exiftool'
3
4
 
@@ -1,3 +1,4 @@
1
+ # -- encoding: utf-8 --
1
2
  #
2
3
  # MiniExiftool
3
4
  #
@@ -31,7 +32,7 @@ class MiniExiftool
31
32
  attr_reader :filename
32
33
  attr_accessor :numerical, :composite, :convert_encoding, :errors, :timestamps
33
34
 
34
- VERSION = '1.2.0'
35
+ VERSION = '1.3.0'
35
36
 
36
37
  # +opts+ support at the moment
37
38
  # * <code>:numerical</code> for numerical values, default is +false+
@@ -159,6 +160,9 @@ class MiniExiftool
159
160
  opt_params << (arr_val.detect {|x| x.kind_of?(Numeric)} ? '-n ' : '')
160
161
  opt_params << (@convert_encoding ? '-L ' : '')
161
162
  cmd = %Q(#@@cmd -q -P -overwrite_original #{opt_params} #{tag_params} #{temp_filename})
163
+ if convert_encoding && cmd.respond_to?(:encode)
164
+ cmd.encode('ISO-8859-1')
165
+ end
162
166
  result = run(cmd)
163
167
  unless result
164
168
  all_ok = false
@@ -277,6 +281,9 @@ class MiniExiftool
277
281
  $stderr.puts cmd
278
282
  end
279
283
  @output = `#{cmd} 2>#{@@error_file.path}`
284
+ if convert_encoding && @output.respond_to?(:force_encoding)
285
+ @output.force_encoding('ISO-8859-1')
286
+ end
280
287
  @status = $?
281
288
  unless @status.exitstatus == 0
282
289
  @error_text = File.readlines(@@error_file.path).join
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{mini_exiftool}
5
- s.version = "1.2.2"
5
+ s.version = "1.3.0"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Jan Friedrich"]
9
- s.date = %q{2011-04-05}
9
+ s.date = %q{2011-04-07}
10
10
  s.description = %q{This library is wrapper for the Exiftool command-line application (http://www.sno.phy.queensu.ca/~phil/exiftool).}
11
11
  s.email = %q{janfri26@gmail.com}
12
12
  s.extra_rdoc_files = ["README", "Tutorial", "lib/mini_exiftool.rb"]
@@ -22,7 +22,7 @@ Gem::Specification.new do |s|
22
22
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Mini_exiftool", "--main", "README"]
23
23
  s.require_paths = ["lib"]
24
24
  s.rubyforge_project = %q{mini_exiftool}
25
- s.rubygems_version = %q{1.6.1}
25
+ s.rubygems_version = %q{1.5.0}
26
26
  s.summary = %q{This library is wrapper for the Exiftool command-line application (http://www.sno.phy.queensu.ca/~phil/exiftool).}
27
27
  s.test_files = ["test/helpers_for_test.rb", "test/test_class_methods.rb", "test/test_composite.rb", "test/test_dumping.rb", "test/test_escape_filename.rb", "test/test_read.rb", "test/test_read_numerical.rb", "test/test_save.rb", "test/test_special.rb", "test/test_special_dates.rb", "test/test_write.rb"]
28
28
 
data/setup.rb CHANGED
@@ -1,3 +1,4 @@
1
+ # -- encoding: utf-8 --
1
2
  #
2
3
  # setup.rb
3
4
  #
@@ -1,3 +1,4 @@
1
+ # -- encoding: utf-8 --
1
2
  require 'mini_exiftool'
2
3
  require 'test/unit'
3
4
  begin
@@ -1,3 +1,4 @@
1
+ # -- encoding: utf-8 --
1
2
  require 'helpers_for_test'
2
3
 
3
4
  class TestClassMethods < TestCase
@@ -1,3 +1,4 @@
1
+ # -- encoding: utf-8 --
1
2
  require 'helpers_for_test'
2
3
 
3
4
  class TestComposite < TestCase
@@ -1,3 +1,4 @@
1
+ # -- encoding: utf-8 --
1
2
  require 'helpers_for_test'
2
3
  require 'yaml'
3
4
 
@@ -1,3 +1,4 @@
1
+ # -- encoding: utf-8 --
1
2
  require 'helpers_for_test'
2
3
 
3
4
  class TestRead < TestCase
@@ -40,7 +41,11 @@ class TestRead < TestCase
40
41
  def test_encoding_conversion
41
42
  @mini_exiftool_converted = MiniExiftool.new @filename_test, :convert_encoding => true
42
43
  assert_equal 'Abenddämmerung', @mini_exiftool.title
43
- assert_equal "Abendd\344mmerung", @mini_exiftool_converted.title
44
+ converted = "Abendd\344mmerung"
45
+ if converted.respond_to?(:force_encoding)
46
+ converted.force_encoding('ISO-8859-1')
47
+ end
48
+ assert_equal converted, @mini_exiftool_converted.title
44
49
  end
45
50
 
46
51
  end
@@ -1,3 +1,4 @@
1
+ # -- encoding: utf-8 --
1
2
  require 'helpers_for_test'
2
3
 
3
4
  class TestReadNumerical < TestCase
@@ -1,3 +1,4 @@
1
+ # -- encoding: utf-8 --
1
2
  require 'digest/md5'
2
3
  require 'fileutils'
3
4
  require 'tempfile'
@@ -49,16 +50,24 @@ class TestSave < TestCase
49
50
  end
50
51
 
51
52
  def test_encoding_conversion
52
- special_string = 'ÄÖÜ'
53
+ special_string = 'äöü'
54
+ if special_string.respond_to?(:encode)
55
+ special_string_latin1 = special_string.encode('ISO-8859-1')
56
+ else
57
+ special_string_latin1 = "\xE4\xF6\xFC"
58
+ end
53
59
  @mini_exiftool.title = special_string
54
60
  assert @mini_exiftool.save
55
61
  assert_equal false, @mini_exiftool.convert_encoding
56
62
  assert_equal special_string, @mini_exiftool.title
57
63
  @mini_exiftool.convert_encoding = true
58
- @mini_exiftool.title = special_string
64
+ @mini_exiftool.title = special_string_latin1
59
65
  assert @mini_exiftool.save
60
66
  assert_equal true, @mini_exiftool.convert_encoding
61
- assert_equal special_string, @mini_exiftool.title
67
+ if special_string_latin1.respond_to?(:encode)
68
+ special_string_latin1.encode!('ISO-8859-1')
69
+ end
70
+ assert_equal special_string_latin1, @mini_exiftool.title
62
71
  end
63
72
 
64
73
  end
@@ -1,3 +1,4 @@
1
+ # -- encoding: utf-8 --
1
2
  require 'fileutils'
2
3
  require 'tempfile'
3
4
  require 'helpers_for_test'
@@ -1,3 +1,5 @@
1
+ # -- encoding: utf-8 --
2
+ require 'date'
1
3
  require 'fileutils'
2
4
  require 'tempfile'
3
5
  require 'helpers_for_test'
@@ -1,3 +1,4 @@
1
+ # -- encoding: utf-8 --
1
2
  require 'digest/md5'
2
3
  require 'fileutils'
3
4
  require 'tempfile'
@@ -58,7 +59,7 @@ class TestWrite < TestCase
58
59
  t = Time.now
59
60
  @mini_exiftool_num['DateTimeOriginal'] = t
60
61
  assert_kind_of Time, @mini_exiftool_num['DateTimeOriginal']
61
- assert true, @mini_exiftool_num.changed_tags.include?('DateTimeOriginal')
62
+ assert_equal true, @mini_exiftool_num.changed_tags.include?('DateTimeOriginal')
62
63
  @mini_exiftool_num.save
63
64
  assert_equal false, @mini_exiftool_num.changed?
64
65
  assert_kind_of Time, @mini_exiftool_num['DateTimeOriginal']
@@ -70,7 +71,7 @@ class TestWrite < TestCase
70
71
  new_time = @mini_exiftool_num['BrightnessValue'] + 1
71
72
  @mini_exiftool_num['BrightnessValue'] = new_time
72
73
  assert_equal new_time, @mini_exiftool_num['BrightnessValue']
73
- assert true, @mini_exiftool_num.changed_tags.include?('BrightnessValue')
74
+ assert_equal true, @mini_exiftool_num.changed_tags.include?('BrightnessValue')
74
75
  @mini_exiftool_num.save
75
76
  assert_kind_of Float, @mini_exiftool_num['BrightnessValue']
76
77
  assert_equal new_time, @mini_exiftool_num['BrightnessValue']
metadata CHANGED
@@ -1,13 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mini_exiftool
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
5
4
  prerelease:
6
- segments:
7
- - 1
8
- - 2
9
- - 2
10
- version: 1.2.2
5
+ version: 1.3.0
11
6
  platform: ruby
12
7
  authors:
13
8
  - Jan Friedrich
@@ -15,7 +10,7 @@ autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
12
 
18
- date: 2011-04-05 00:00:00 +02:00
13
+ date: 2011-04-07 00:00:00 +02:00
19
14
  default_executable:
20
15
  dependencies: []
21
16
 
@@ -83,24 +78,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
83
78
  requirements:
84
79
  - - ">="
85
80
  - !ruby/object:Gem::Version
86
- hash: 3
87
- segments:
88
- - 0
89
81
  version: "0"
90
82
  required_rubygems_version: !ruby/object:Gem::Requirement
91
83
  none: false
92
84
  requirements:
93
85
  - - ">="
94
86
  - !ruby/object:Gem::Version
95
- hash: 11
96
- segments:
97
- - 1
98
- - 2
99
87
  version: "1.2"
100
88
  requirements: []
101
89
 
102
90
  rubyforge_project: mini_exiftool
103
- rubygems_version: 1.6.1
91
+ rubygems_version: 1.5.0
104
92
  signing_key:
105
93
  specification_version: 3
106
94
  summary: This library is wrapper for the Exiftool command-line application (http://www.sno.phy.queensu.ca/~phil/exiftool).