bibliotech 0.2.10 → 0.2.11
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 78931ee4f81a0aad3515900a1ae81c8701e7d9a4
|
4
|
+
data.tar.gz: 1b041221fb2870192453e8b91593cd495e383303
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a8f215b830a6bbcc1b38138e870cef3108d3b211f77f411be2a477a2cb6e60353efec6ab3feb25ec7faa59befb5be50339265f6a840b4d7fa1bca87b5174725c
|
7
|
+
data.tar.gz: 4367fbb3f7795f4c36cd72843df9fb505bcf45e1889dd3bc160346cabbd867f58ffac9a409172947af3cfc7eeff24713c5088e49274a1f4f63f2eb67a56de7d0
|
@@ -30,18 +30,17 @@ module BiblioTech
|
|
30
30
|
def backup_needed?(time)
|
31
31
|
most_recent = most_recent()
|
32
32
|
return true if most_recent.nil?
|
33
|
-
time - most_recent.timestamp
|
33
|
+
(time - most_recent.timestamp) > (config.backup_frequency * 60)
|
34
34
|
end
|
35
35
|
|
36
36
|
def list
|
37
|
-
@list ||=
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
end
|
37
|
+
@list ||= PruneList.new(path, name).list
|
38
|
+
end
|
39
|
+
|
40
|
+
def mark_list
|
41
|
+
schedules.each do |schedule|
|
42
|
+
schedule.mark(list)
|
43
|
+
end
|
45
44
|
end
|
46
45
|
|
47
46
|
def most_recent
|
@@ -55,6 +54,7 @@ module BiblioTech
|
|
55
54
|
end
|
56
55
|
|
57
56
|
def pruneable
|
57
|
+
mark_list
|
58
58
|
list.select do |record|
|
59
59
|
!record.keep?
|
60
60
|
end
|
data/lib/bibliotech/config.rb
CHANGED
@@ -203,12 +203,16 @@ module BiblioTech
|
|
203
203
|
end
|
204
204
|
|
205
205
|
def each_prune_schedule
|
206
|
-
local_get(:prune_schedule).
|
206
|
+
local_get(:prune_schedule).map do |frequency, limit|
|
207
207
|
real_frequency = regularize_frequency(frequency)
|
208
208
|
unless real_frequency % backup_frequency == 0
|
209
209
|
raise "Pruning frequency #{real_frequency}:#{frequency} is not a multiple of backup frequency: #{backup_frequency}:#{local_get(:backup_frequency)}"
|
210
210
|
end
|
211
|
-
|
211
|
+
[real_frequency, limit]
|
212
|
+
end.sort_by do |frequency, limit|
|
213
|
+
frequency
|
214
|
+
end.each do |frequency, limit|
|
215
|
+
yield(frequency, limit)
|
212
216
|
end
|
213
217
|
end
|
214
218
|
|
@@ -42,6 +42,25 @@ module BiblioTech
|
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
|
+
context "with a recent file" do
|
46
|
+
before :each do
|
47
|
+
sandbox.new :file => "db_backups/#{pruner.filename_for(Time.now.utc - 120)}"
|
48
|
+
end
|
49
|
+
|
50
|
+
it "should return false from #backup_needed?" do
|
51
|
+
expect(pruner.backup_needed?(Time.now.utc)).to be_falsey
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
context "with an old file" do
|
56
|
+
before :each do
|
57
|
+
sandbox.new :file => "db_backups/#{pruner.filename_for(Time.now.utc - (24 * 60 * 60 + 120))}"
|
58
|
+
end
|
59
|
+
|
60
|
+
it "should return true from #backup_needed?" do
|
61
|
+
expect(pruner.backup_needed?(Time.now.utc)).to be_truthy
|
62
|
+
end
|
63
|
+
end
|
45
64
|
end
|
46
65
|
|
47
66
|
describe Backups::PruneList do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bibliotech
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Evan Dorn
|
@@ -128,7 +128,7 @@ rdoc_options:
|
|
128
128
|
- --main
|
129
129
|
- doc/README
|
130
130
|
- --title
|
131
|
-
- bibliotech-0.2.
|
131
|
+
- bibliotech-0.2.11 Documentation
|
132
132
|
require_paths:
|
133
133
|
- lib/
|
134
134
|
required_ruby_version: !ruby/object:Gem::Requirement
|