bibliotech 0.5.1 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bibliotech/config.rb +9 -2
- data/spec/bibliotech/config_spec.rb +35 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b5cd8c3faadcd6085476fbc3dac6f1d4454ce634
|
4
|
+
data.tar.gz: e4cd40ae88b8e3e24f85ab1bcf5d22ee838735b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bbe5696146f64efdb9c3c0cc54b9c14f64da721f428fb8f5ae12537cc2a747759584866105a713920e2239867337c55fc2b2a2aee06e87e3d4dbadf864d43467
|
7
|
+
data.tar.gz: 6bced695414d447ec449eaa40fc3c3a20742b70f6640e8e4b1767fcb38e648a9d9a7322b0e1a5bb061a9edddbe7ede0734e3899e0163338354fa3ebb952a0fbe
|
data/lib/bibliotech/config.rb
CHANGED
@@ -233,7 +233,9 @@ module BiblioTech
|
|
233
233
|
end
|
234
234
|
|
235
235
|
def prune_schedules
|
236
|
-
local_get(:prune_schedule)
|
236
|
+
prune_hash = local_get(:prune_schedule)
|
237
|
+
prune_hash.map do |frequency, limit|
|
238
|
+
next if limit == "none"
|
237
239
|
real_frequency = regularize_frequency(frequency)
|
238
240
|
unless real_frequency % backup_frequency == 0
|
239
241
|
raise "Pruning frequency #{real_frequency}:#{frequency} is not a multiple of backup frequency: #{backup_frequency}:#{local_get(:backup_frequency)}"
|
@@ -246,8 +248,13 @@ module BiblioTech
|
|
246
248
|
Integer(limit)
|
247
249
|
end
|
248
250
|
[frequency, real_frequency, limit]
|
249
|
-
end.sort_by do |freq_name, frequency, limit|
|
251
|
+
end.compact.sort_by do |freq_name, frequency, limit|
|
250
252
|
frequency
|
253
|
+
end.tap do |list|
|
254
|
+
if list.empty?
|
255
|
+
require 'pp'
|
256
|
+
raise "No backups will be kept by prune schedule: #{prune_hash.pretty_inspect}"
|
257
|
+
end
|
251
258
|
end.map do |freq_name, frequency, limit|
|
252
259
|
Backups::Scheduler.new(freq_name, frequency, limit)
|
253
260
|
end
|
@@ -163,6 +163,41 @@ module BiblioTech
|
|
163
163
|
end
|
164
164
|
end
|
165
165
|
|
166
|
+
|
167
|
+
context "with 'none'" do
|
168
|
+
let :config_hash do
|
169
|
+
{ "backups" => {
|
170
|
+
"frequency" => "daily",
|
171
|
+
"keep" => {
|
172
|
+
"hourly" => "none",
|
173
|
+
"daily" => "all"
|
174
|
+
}
|
175
|
+
}}
|
176
|
+
end
|
177
|
+
|
178
|
+
it "should not raise error" do
|
179
|
+
expect(schedule_array).to contain_exactly([60*24, nil])
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
183
|
+
context "accidentally empty" do
|
184
|
+
let :config_hash do
|
185
|
+
{ "backups" => {
|
186
|
+
"frequency" => "daily",
|
187
|
+
"keep" => {
|
188
|
+
"hourly" => "none",
|
189
|
+
"daily" => "none"
|
190
|
+
}
|
191
|
+
}}
|
192
|
+
end
|
193
|
+
|
194
|
+
it "should raise an error" do
|
195
|
+
expect do
|
196
|
+
schedule_array
|
197
|
+
end.to raise_error
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
166
201
|
context "with shorthand words" do
|
167
202
|
let :config_hash do
|
168
203
|
{ "backups" => {
|
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.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Evan Dorn
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-05-
|
12
|
+
date: 2015-05-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: caliph
|
@@ -130,7 +130,7 @@ rdoc_options:
|
|
130
130
|
- --main
|
131
131
|
- doc/README
|
132
132
|
- --title
|
133
|
-
- bibliotech-0.
|
133
|
+
- bibliotech-0.6.0 Documentation
|
134
134
|
require_paths:
|
135
135
|
- lib/
|
136
136
|
required_ruby_version: !ruby/object:Gem::Requirement
|