mini_exiftool 2.13.0 → 2.14.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/Changelog +11 -0
  3. data/README.md +5 -2
  4. data/lib/mini_exiftool.rb +19 -10
  5. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dbcf3b035e8e2bfe73392ee5ef8e63ff2125d88b1c1ec32b1d8d86dba15f7f5a
4
- data.tar.gz: ba2b4c2e8ea43a0cd1ac79283d7b83cdfbf4a8551b8a70ba22529b1fd94f984e
3
+ metadata.gz: 2eb71098832b8fa3c931588d9b35ced2a05241d3f88abd85eccd9b0404c7bbe2
4
+ data.tar.gz: 2deb86595f46b8a4a13e026ff54754b915723a24730a9d4c5bccf66054f50e1b
5
5
  SHA512:
6
- metadata.gz: 0acb2a5a18ceba9f3e8750882510cd14570d036caa868d90a8ffe2132c3e85068b5d81a8c7b182024609c4d08418e1843dc15d68d1eaf43696b034eb56ca5810
7
- data.tar.gz: baea546851320c8068c3c1b91726f2b96fa96a03fd4c11d95bf6c2d36e6e0a1ed46144560aff1a3717c6100505650cb3917b5a94d5a003fa60830898c36e510a
6
+ metadata.gz: edb5a2802070c2e99f9222d3b3c55fc22f546f793258f501d70fed4655036cf81bbae4f0e4ba635d19be2268f14c3f879004481ee3fe5d072af90291b734435a
7
+ data.tar.gz: 2dbd2e65dfbbf3711f8b2910a0a956324fb4ffd95add844b50fce2786198ab910e52d9ef04a521b8ae216f8594691b1f60b2c31044bab4e11bd6c92b5d43f904
data/Changelog CHANGED
@@ -1,3 +1,14 @@
1
+ 2.14.0
2
+ - Change default pstore_dir to subdir in Gem.cache_home or under USERPROFILE
3
+ or Dir.tmpdir if some not defined. So it's now XDG conform and also Ruby
4
+ ecosystem conform. Thanks a lot to Ryan Lue again for his effort and
5
+ support (github issue #51).
6
+ - Add the possibility to change the pstore_dir by setting the environment
7
+ variable MINI_EXIFTOOL_PSTORE_DIR.
8
+
9
+ 2.13.1
10
+ - Second try to fix bug when using Pathname instances of filenames.
11
+
1
12
  2.13.0
2
13
  - Fix bug when using Pathname instances of filenames.
3
14
  Thanks Ryan Lue for reporting this problem (github issue #50).
data/README.md CHANGED
@@ -53,8 +53,11 @@ MiniExiftool.command = '/path/to/my/exiftool'
53
53
 
54
54
  In addition, you can also tell MiniExiftool where to store the PStore files with tags
55
55
  which exiftool supports. The PStore files are used for performance issues.
56
- Per default the PStore files are stored in a sub directory `.mini_exiftool` or
57
- `_mini_exiftool` under your home directory.
56
+ Per default the PStore files are stored in a sub directory `mini_exiftool` in
57
+ `Gem.cache' or if this is not defined under `USERPROFILE` or `Dir.tmpdir`.
58
+
59
+ You can change it by setting the environment variable
60
+ `MINI_EXIFTOOL_PSTORE_DIR` or programmatically, as follows.
58
61
 
59
62
  ```ruby
60
63
  MiniExiftool.pstore_dir = '/path/to/pstore/dir'
data/lib/mini_exiftool.rb CHANGED
@@ -17,6 +17,7 @@
17
17
  require 'fileutils'
18
18
  require 'json'
19
19
  require 'open3'
20
+ require 'pathname'
20
21
  require 'pstore'
21
22
  require 'rational'
22
23
  require 'rbconfig'
@@ -28,7 +29,7 @@ require 'yaml'
28
29
  # Simple OO access to the ExifTool command-line application.
29
30
  class MiniExiftool
30
31
 
31
- VERSION = '2.13.0'
32
+ VERSION = '2.14.0'
32
33
 
33
34
  # Name of the ExifTool command-line application
34
35
  @@cmd = 'exiftool'
@@ -132,17 +133,19 @@ class MiniExiftool
132
133
 
133
134
  # Load the tags of filename or io.
134
135
  def load filename_or_io
135
- if filename_or_io.respond_to? :read # IO-like
136
- @io = filename_or_io
137
- @filename = '-'
138
- else
136
+ if filename_or_io.respond_to?(:to_str) || filename_or_io.kind_of?(Pathname) # String-like
139
137
  unless filename_or_io && File.exist?(filename_or_io)
140
138
  raise MiniExiftool::Error.new("File '#{filename_or_io}' does not exist.")
141
139
  end
142
140
  if File.directory?(filename_or_io)
143
141
  raise MiniExiftool::Error.new("'#{filename_or_io}' is a directory.")
144
142
  end
145
- @filename = filename_or_io.to_str
143
+ @filename = filename_or_io.to_s
144
+ elsif filename_or_io.respond_to? :read # IO-like
145
+ @io = filename_or_io
146
+ @filename = '-'
147
+ else
148
+ raise MiniExiftool::Error.new("Could not open filename_or_io.")
146
149
  end
147
150
  @values.clear
148
151
  @changed_values.clear
@@ -363,10 +366,16 @@ class MiniExiftool
363
366
 
364
367
  def self.pstore_dir
365
368
  unless defined? @@pstore_dir
366
- # This will hopefully work on *NIX and Windows systems
367
- home = ENV['HOME'] || ENV['HOMEDRIVE'] + ENV['HOMEPATH'] || ENV['USERPROFILE']
368
- subdir = @@running_on_windows ? '_mini_exiftool' : '.mini_exiftool'
369
- @@pstore_dir = File.join(home, subdir)
369
+ @@pstore_dir =
370
+ if env = ENV['MINI_EXIFTOOL_PSTORE_DIR']
371
+ env
372
+ elsif defined?(Gem.cache_home) && File.writable?(Gem.cache_home)
373
+ File.join(Gem.cache_home, 'mini_exiftool')
374
+ else
375
+ # This fallback will hopefully work on *NIX and Windows systems
376
+ cache_dir = ENV['USERPROFILE'] || Dir.tmpdir
377
+ File.join(cache_dir, 'mini_exiftool')
378
+ end
370
379
  end
371
380
  @@pstore_dir
372
381
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mini_exiftool
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.13.0
4
+ version: 2.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Friedrich
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2024-12-30 00:00:00.000000000 Z
10
+ date: 2025-01-14 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: ostruct