db2fog 0.5.2 → 0.5.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/HISTORY +4 -0
  2. data/lib/db2fog.rb +6 -4
  3. metadata +5 -5
data/HISTORY CHANGED
@@ -1,3 +1,7 @@
1
+ v0.5.4 (17th October 2011)
2
+ - only clean files that were created by db2fog
3
+ v0.5.3 (12th October 2011)
4
+ - improve robustness of clean task
1
5
  v0.5.2 (15th September 2011)
2
6
  - fix restoring of postgresql databases (thanks Dan Neighman)
3
7
  v0.5.1 (29th August 2011)
data/lib/db2fog.rb CHANGED
@@ -24,13 +24,16 @@ class DB2Fog
24
24
 
25
25
  def clean
26
26
  to_keep = []
27
- filelist = store.list
28
- files = filelist.reject {|file| file.ends_with?(most_recent_dump_file_name) }.collect do |file|
27
+ # only consider files that belong to db2fog. Other files are ignored
28
+ filelist = store.list.select {|file|
29
+ file.include?(db_credentials[:database]) && file.match(/\d{12}.sql.gz\Z/)
30
+ }
31
+ files = filelist.map { |file|
29
32
  {
30
33
  :path => file,
31
34
  :date => Time.parse(file.split('-').last.split('.').first)
32
35
  }
33
- end
36
+ }
34
37
  # Keep all backups from the past day
35
38
  files.select {|x| x[:date] >= 1.day.ago }.each do |backup_for_day|
36
39
  to_keep << backup_for_day
@@ -47,7 +50,6 @@ class DB2Fog
47
50
  end
48
51
 
49
52
  to_destroy = filelist - to_keep.uniq.collect {|x| x[:path] }
50
- to_destroy.delete_if {|x| x.ends_with?(most_recent_dump_file_name) }
51
53
  to_destroy.each do |file|
52
54
  store.delete(file.split('/').last)
53
55
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 5
8
- - 2
9
- version: 0.5.2
8
+ - 4
9
+ version: 0.5.4
10
10
  platform: ruby
11
11
  authors:
12
12
  - James Healy
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-09-15 00:00:00 +10:00
17
+ date: 2011-10-17 00:00:00 +11:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -54,9 +54,9 @@ dependencies:
54
54
  - - ~>
55
55
  - !ruby/object:Gem::Version
56
56
  segments:
57
+ - 1
57
58
  - 0
58
- - 9
59
- version: "0.9"
59
+ version: "1.0"
60
60
  type: :runtime
61
61
  version_requirements: *id003
62
62
  - !ruby/object:Gem::Dependency