archiver 1.0.1 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "archiver"
8
- s.version = "1.0.1"
8
+ s.version = "1.1.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Thomas Boerger"]
12
- s.date = "2012-11-02"
12
+ s.date = "2012-12-09"
13
13
  s.description = "Archiver is a simple gem to rename photos and videos depending on creation date and exif informations to archive directories in subfolders by year. It sorts out duplicate files to"
14
14
  s.email = "tboerger@tbpro.de"
15
15
  s.executables = ["archiver"]
@@ -15,17 +15,24 @@ module Archiver
15
15
  end
16
16
 
17
17
  def filename(counter = 0)
18
- append = if counter > 0
19
- sprintf('-%03d', counter)
18
+ if created
19
+ append = if counter > 0
20
+ sprintf('-%03d', counter)
21
+ else
22
+ nil
23
+ end
24
+
25
+ [
26
+ created.strftime('%Y%m%d-%H%M%S'),
27
+ append,
28
+ extension
29
+ ].compact.join
20
30
  else
21
- nil
31
+ [
32
+ sprintf('%05d', counter),
33
+ extension
34
+ ].compact.join
22
35
  end
23
-
24
- [
25
- created.strftime('%Y%m%d-%H%M%S'),
26
- append,
27
- extension
28
- ].compact.join
29
36
  end
30
37
 
31
38
  def extension
@@ -56,7 +63,11 @@ module Archiver
56
63
  if exif_data and exif_data.date_time_original
57
64
  exif_data.date_time_original
58
65
  else
59
- File.mtime(path)
66
+ if image?
67
+
68
+ else
69
+ File.mtime(path)
70
+ end
60
71
  end
61
72
  end
62
73
 
@@ -123,7 +134,7 @@ module Archiver
123
134
  end
124
135
 
125
136
  def segment
126
- created.strftime('%Y')
137
+ created ? created.strftime('%Y') : '0000'
127
138
  end
128
139
 
129
140
  protected
@@ -6,8 +6,8 @@
6
6
  module Archiver
7
7
  module Version
8
8
  MAJOR = 1
9
- MINOR = 0
10
- PATCH = 1
9
+ MINOR = 1
10
+ PATCH = 0
11
11
  BUILD = nil
12
12
 
13
13
  STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join('.')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: archiver
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-02 00:00:00.000000000 Z
12
+ date: 2012-12-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: exifr
@@ -128,7 +128,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
128
128
  version: '0'
129
129
  segments:
130
130
  - 0
131
- hash: -4308012420230902379
131
+ hash: -3660788461220623772
132
132
  required_rubygems_version: !ruby/object:Gem::Requirement
133
133
  none: false
134
134
  requirements: