db2fog 0.5.2 → 0.5.4
Sign up to get free protection for your applications and to get access to all the features.
- data/HISTORY +4 -0
- data/lib/db2fog.rb +6 -4
- metadata +5 -5
data/HISTORY
CHANGED
data/lib/db2fog.rb
CHANGED
@@ -24,13 +24,16 @@ class DB2Fog
|
|
24
24
|
|
25
25
|
def clean
|
26
26
|
to_keep = []
|
27
|
-
|
28
|
-
|
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
|
-
|
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
|
-
-
|
9
|
-
version: 0.5.
|
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-
|
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
|
-
|
59
|
-
version: "0.9"
|
59
|
+
version: "1.0"
|
60
60
|
type: :runtime
|
61
61
|
version_requirements: *id003
|
62
62
|
- !ruby/object:Gem::Dependency
|