surrender 0.8.0 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Surrender
2
2
 
3
+ [![Build Status](https://travis-ci.org/francois/surrender.png?branch=master)](https://travis-ci.org/francois/surrender)
4
+
3
5
  Returns the list of files which should be surrendered to the ether.
4
6
 
5
7
  ## Installation
@@ -20,12 +22,14 @@ Or install it yourself as:
20
22
 
21
23
  Acts as a filter, returning files which should be removed from a backup scheme:
22
24
 
23
- $ find /var/backup/database -type f | sort | surrender --minimum-files=7 --most-recent=2 --weekly=2 --monthly=12 --yearly=2 | xargs rm
25
+ $ find /var/backup/database -type f | sort | surrender --most-recent=7 --weekly=5 --monthly=12 --yearly=2 | xargs rm
26
+
27
+ Would keep the most recent 7 files, irrespective of their dates, the 5 most recent
28
+ weekly backups, the 12 most recent monthly backups, and the 2 most recent yearly
29
+ backups. Backup dates are determined from the file's path, which must match the
30
+ following regular expression:
24
31
 
25
- Would keep at a minimum 4 files, but only 2 weekly (the 2 most recent weekly backups),
26
- the 12 most recent monthly backups and the 2 most recent yearly backups. Backup dates
27
- are determined from the file's path, which must match the following regular
28
- expression: `/\b(?:19|2\d)\d{2}(.)?(?:0\d|1[012])\1(?:[012]\d|3[01])(?:T|\b)`.
32
+ /\b((?:19|2\d)\d{2})(.)?(0\d|1[012])\2?([012]\d|3[01])(?:T|\b)/
29
33
 
30
34
  This regular expression matches schemes like this:
31
35
 
@@ -35,8 +39,6 @@ This regular expression matches schemes like this:
35
39
 
36
40
  which seems to be common enough.
37
41
 
38
- No attempt is made to validate the date: 2013-02-31 is a perfectly valid date for surrender.
39
-
40
42
  Anything that does not match the regular expression is reported as a warning on STDERR, and filtered from
41
43
  STDOUT, implying the file must be kept.
42
44
 
@@ -1,3 +1,3 @@
1
1
  module Surrender
2
- VERSION = "0.8.0"
2
+ VERSION = "0.8.1"
3
3
  end
data/lib/surrender.rb CHANGED
@@ -9,7 +9,7 @@ module Surrender
9
9
  DEFAULT_ARGUMENTS = {
10
10
  most_recent: 7,
11
11
  weekly: 5,
12
- monthly: 2,
12
+ monthly: 12,
13
13
  yearly: 2
14
14
  }.freeze
15
15
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: surrender
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: