mini_exiftool 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/Changelog ADDED
@@ -0,0 +1,6 @@
1
+ Version 0.1.0
2
+ - New method "revert"
3
+ - More tests
4
+
5
+ Version 0.0.1
6
+ - Initial release
data/Rakefile CHANGED
@@ -11,7 +11,7 @@ PROJECT = "MiniExiftool"
11
11
  MY_NAME = "Jan Friedrich"
12
12
 
13
13
  # Your email address, used in packaging.
14
- MY_EMAIL = "janfri@web.de"
14
+ MY_EMAIL = "miniexiftool@googlemail.com"
15
15
 
16
16
  # Short summary of your project, used in packaging.
17
17
  PROJECT_SUMMARY = 'A library for nice OO access to the Exiftool commandline application written by Phil Harvey.'
@@ -77,7 +77,7 @@ BIN_FILES = FileList["bin/*"]
77
77
  # This filelist is used to create source packages.
78
78
  # Include all Ruby and RDoc files.
79
79
  DIST_FILES = FileList["**/*.rb", "**/*.rdoc"]
80
- DIST_FILES.include("Rakefile", "COPYING")
80
+ DIST_FILES.include("Rakefile", "COPYING", 'Changelog')
81
81
  DIST_FILES.include(BIN_FILES)
82
82
  DIST_FILES.include("data/**/*", "test/data/**/*")
83
83
  DIST_FILES.include("#{WEBSITE_DIR}/**/*.{html,css}", "man/*.[0-9]")
data/lib/mini_exiftool.rb CHANGED
@@ -13,6 +13,7 @@
13
13
  #
14
14
 
15
15
  require 'fileutils'
16
+ require 'open3'
16
17
  require 'tempfile'
17
18
 
18
19
  # Simple OO access to the Exiftool command-line application.
@@ -24,7 +25,7 @@ class MiniExiftool
24
25
  attr_reader :filename
25
26
  attr_accessor :numerical
26
27
 
27
- Version = '0.0.1'
28
+ Version = '0.1.0'
28
29
 
29
30
  # opts at the moment only support :numerical for numerical values
30
31
  # (the -n parameter in the command line)
@@ -77,13 +78,16 @@ class MiniExiftool
77
78
  end
78
79
  end
79
80
 
80
- def temp_filename
81
- unless @temp_filename
82
- temp_file = Tempfile.new('mini-exiftool')
83
- FileUtils.cp(@filename, temp_file.path)
84
- @temp_filename = temp_file.path
81
+ def revert tag=nil
82
+ if tag
83
+ unified_tag = unify tag
84
+ val = @changed_values.delete(unified_tag)
85
+ res = val != nil
86
+ else
87
+ res = @changed_values.size > 0
88
+ @changed_values.clear
85
89
  end
86
- @temp_filename
90
+ res
87
91
  end
88
92
 
89
93
  def tags
@@ -167,6 +171,15 @@ class MiniExiftool
167
171
  return [tag, value]
168
172
  end
169
173
 
174
+ def temp_filename
175
+ unless @temp_filename
176
+ temp_file = Tempfile.new('mini-exiftool')
177
+ FileUtils.cp(@filename, temp_file.path)
178
+ @temp_filename = temp_file.path
179
+ end
180
+ @temp_filename
181
+ end
182
+
170
183
  class MiniExiftool::Error < Exception; end
171
184
 
172
185
  end
data/test/test_read.rb CHANGED
@@ -18,11 +18,14 @@ class TestRead < Test::Unit::TestCase
18
18
  assert_raises MiniExiftool::Error do
19
19
  MiniExiftool.new ''
20
20
  end
21
+ assert_raises MiniExiftool::Error do
22
+ MiniExiftool.new 'not_existing_file'
23
+ end
21
24
  end
22
25
 
23
- def test_initialize
26
+ def test_wrong_file
24
27
  assert_raises MiniExiftool::Error do
25
- MiniExiftool.new 'not_existing_file'
28
+ MiniExiftool.new __FILE__ # file type wich Exiftool can not handle
26
29
  end
27
30
  end
28
31
 
data/test/test_write.rb CHANGED
@@ -90,6 +90,28 @@ class TestWrite < Test::Unit::TestCase
90
90
  assert_equal new_mode, @mini_exiftool_num['MeteringMode']
91
91
  end
92
92
 
93
+ def test_revert_one
94
+ @mini_exiftool_num['Orientation'] = 2
95
+ @mini_exiftool_num['ISO'] = 200
96
+ res = @mini_exiftool_num.revert 'Orientation'
97
+ assert_equal 1, @mini_exiftool_num['Orientation']
98
+ assert_equal 200, @mini_exiftool_num['ISO']
99
+ assert_equal true, res
100
+ res = @mini_exiftool_num.revert 'Orientation'
101
+ assert_equal false, res
102
+ end
103
+
104
+ def test_revert_all
105
+ @mini_exiftool_num['Orientation'] = 2
106
+ @mini_exiftool_num['ISO'] = 200
107
+ res = @mini_exiftool_num.revert
108
+ assert_equal 1, @mini_exiftool_num['Orientation']
109
+ assert_equal 400, @mini_exiftool_num['ISO']
110
+ assert_equal true, res
111
+ res = @mini_exiftool_num.revert
112
+ assert_equal false, res
113
+ end
114
+
93
115
  def test_save
94
116
  org_md5 = Digest::MD5.hexdigest(File.read(@org_filename))
95
117
  temp_md5 = Digest::MD5.hexdigest(File.read(@temp_filename))
metadata CHANGED
@@ -3,12 +3,12 @@ rubygems_version: 0.9.0
3
3
  specification_version: 1
4
4
  name: mini_exiftool
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.0.1
7
- date: 2007-01-20 00:00:00 +01:00
6
+ version: 0.1.0
7
+ date: 2007-01-23 00:00:00 +01:00
8
8
  summary: A library for nice OO access to the Exiftool commandline application written by Phil Harvey.
9
9
  require_paths:
10
10
  - lib
11
- email: janfri@web.de
11
+ email: miniexiftool@googlemail.com
12
12
  homepage: http://miniexiftool.rubyforge.org/
13
13
  rubyforge_project: miniexiftool
14
14
  description:
@@ -34,6 +34,7 @@ files:
34
34
  - test/test_read.rb
35
35
  - Rakefile
36
36
  - COPYING
37
+ - Changelog
37
38
  - test/data/test.jpg
38
39
  - README
39
40
  test_files: