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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 761c445f78f11c818de079f0dbb5510d29bed7d9
4
- data.tar.gz: d2b39db8989b61e69b8c5bb90b752975b53dbb91
3
+ metadata.gz: b5cd8c3faadcd6085476fbc3dac6f1d4454ce634
4
+ data.tar.gz: e4cd40ae88b8e3e24f85ab1bcf5d22ee838735b3
5
5
  SHA512:
6
- metadata.gz: 647303450d28ec294209a89222b21bb8996dff93b2230ff33f52d9a283a9a42d615585bf97623198f4ec058e25f0985352c8d270ee9f8466f51ad913374c76bd
7
- data.tar.gz: 66153dd8bbbc16444e0d21b4190646a0ddb7383de587b91005db5011778779e966b8eb4861000ae865019ee05eb5ac51ed2cf809312b46150e3e7ce91e75835b
6
+ metadata.gz: bbe5696146f64efdb9c3c0cc54b9c14f64da721f428fb8f5ae12537cc2a747759584866105a713920e2239867337c55fc2b2a2aee06e87e3d4dbadf864d43467
7
+ data.tar.gz: 6bced695414d447ec449eaa40fc3c3a20742b70f6640e8e4b1767fcb38e648a9d9a7322b0e1a5bb061a9edddbe7ede0734e3899e0163338354fa3ebb952a0fbe
@@ -233,7 +233,9 @@ module BiblioTech
233
233
  end
234
234
 
235
235
  def prune_schedules
236
- local_get(:prune_schedule).map do |frequency, limit|
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.5.1
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-20 00:00:00.000000000 Z
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.5.1 Documentation
133
+ - bibliotech-0.6.0 Documentation
134
134
  require_paths:
135
135
  - lib/
136
136
  required_ruby_version: !ruby/object:Gem::Requirement