bibliotech 0.2.3 → 0.2.4

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: 0d3db00ae690a5cadb9e6ba8f82c57880ac90ae7
4
- data.tar.gz: 3bfaba7cd66defa3099e1fa1b368652c0e31f8ec
3
+ metadata.gz: 0569649a33c1d1e8beefd3356bdad02c255a6651
4
+ data.tar.gz: e5886669625ea859ac9517e71252839f22417874
5
5
  SHA512:
6
- metadata.gz: db6a21821e71a1669902aa2d08ddaa91f876e74b04508da8ea725504c604c4dc07b724b92791141b2dae6ca2166500e5278ad719ec51f2bf40fbd47bfe9a3fcb
7
- data.tar.gz: a9bb0ed38331a9c0221de3c6a3a09569c8a2d1a2b157612fe3ab5f0ba44f843e0fa78f567e67cb369095b74da8c4481a536fa1e203b02e40270c6612381fa193
6
+ metadata.gz: c0e52b37f2d456599bbef875e785b5b01d0a1fba566bbae1dad901da125bc723f44a049bab18d813ded874d609b34d77328ec4a1384c2dd142ad16c3381a4c7f
7
+ data.tar.gz: 6c8cb30fa712665d5b86a14bccf062e7aab7af22fa5b17eee59ad96b38e4dbeedcce2968a534f5ade5cd1669d13360a579bb70ddeae5bdd326b339b6e505e637
@@ -28,6 +28,8 @@ module BiblioTech
28
28
  end
29
29
 
30
30
  def backup_needed?(time)
31
+ most_recent = most_recent()
32
+ return true if most_recent.nil?
31
33
  time - most_recent.timestamp < config.backup_frequency * 60
32
34
  end
33
35
 
@@ -7,15 +7,35 @@ module BiblioTech
7
7
 
8
8
  before :each do
9
9
  sandbox.new :directory => "db_backups"
10
- sandbox.new :file => "db_backups/backup-2014-08-12_00:00.sql.7z"
11
10
  end
12
11
 
13
12
  let :app do
14
13
  App.new
15
14
  end
16
15
 
17
- it "should something latest" do
18
- expect(app.latest("local" => "production")).to eql "db_backups/backup-2014-08-12_00:00.sql.7z"
16
+ let :pruner do
17
+ app.pruner({:backups => {
18
+ :frequency => "daily",
19
+ :prefix => "testing",
20
+ :keep => {:daily => 100},
21
+ :dir => "db_backups"
22
+ }})
23
+ end
24
+
25
+ context "without existing files" do
26
+ it "should return true from #backup_needed?" do
27
+ expect(pruner.backup_needed?(Time.now.utc)).to be_truthy
28
+ end
29
+ end
30
+
31
+ context "with an existing file" do
32
+ before :each do
33
+ sandbox.new :file => "db_backups/backup-2014-08-12_00:00.sql.7z"
34
+ end
35
+
36
+ it "should something latest" do
37
+ expect(app.latest("local" => "production")).to eql "db_backups/backup-2014-08-12_00:00.sql.7z"
38
+ end
19
39
  end
20
40
 
21
41
  end
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.3
4
+ version: 0.2.4
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.3 Documentation
131
+ - bibliotech-0.2.4 Documentation
132
132
  require_paths:
133
133
  - lib/
134
134
  required_ruby_version: !ruby/object:Gem::Requirement