surrender 0.8.0 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +9 -7
- data/lib/surrender/version.rb +1 -1
- data/lib/surrender.rb +1 -1
- metadata +1 -1
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 --
|
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
|
-
|
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
|
|
data/lib/surrender/version.rb
CHANGED
data/lib/surrender.rb
CHANGED