expire 0.2.0 → 0.2.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.
- checksums.yaml +4 -4
- data/Gemfile.lock +81 -93
- data/README.md +2 -4
- data/expire.gemspec +5 -5
- data/lib/expire/backup.rb +15 -7
- data/lib/expire/backup_from_path_service.rb +12 -12
- data/lib/expire/backup_list.rb +2 -2
- data/lib/expire/cli.rb +1 -0
- data/lib/expire/from_now_keep_adjective_for_rule_base.rb +3 -3
- data/lib/expire/from_now_keep_most_recent_for_rule.rb +3 -3
- data/lib/expire/from_range_value.rb +1 -1
- data/lib/expire/keep_most_recent_for_rule.rb +2 -2
- data/lib/expire/playground.rb +3 -3
- data/lib/expire/purge_service.rb +1 -1
- data/lib/expire/rules.rb +2 -2
- data/lib/expire/version.rb +1 -1
- metadata +18 -18
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2d4ddc1687a8426af756b2f05b58b00593a913c9456ffc4dcae598b5d584dd09
|
|
4
|
+
data.tar.gz: d7411d8f08e1ee04e555b80185cafd8ae8201f05ae728a870dc5aab2a6093601
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 357a3b63616fcb927df32c30fb6b6bdec735466558577aca56281b85220f68f9f21b07594d86b5e960e9dd533d177095368b64d428d50a93d2e27a3567229409
|
|
7
|
+
data.tar.gz: cabf11400e9be4d03a9291095e21b31cc7859c3edf86f92bee0b378b1414ab33740f7022ba880c32decd8c34963ecf7c5edd972596d31bcf4aa8b355f0ea60a7
|
data/Gemfile.lock
CHANGED
|
@@ -1,145 +1,133 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
expire (0.2.
|
|
5
|
-
activesupport (~>
|
|
4
|
+
expire (0.2.1)
|
|
5
|
+
activesupport (~> 7.0)
|
|
6
6
|
pastel (~> 0.8)
|
|
7
|
-
thor (~> 1.
|
|
7
|
+
thor (~> 1.2)
|
|
8
8
|
zeitwerk (~> 2.4)
|
|
9
9
|
|
|
10
10
|
GEM
|
|
11
11
|
remote: https://rubygems.org/
|
|
12
12
|
specs:
|
|
13
|
-
activesupport (
|
|
13
|
+
activesupport (7.0.4.2)
|
|
14
14
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
15
15
|
i18n (>= 1.6, < 2)
|
|
16
16
|
minitest (>= 5.1)
|
|
17
17
|
tzinfo (~> 2.0)
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
aruba (2.1.0)
|
|
19
|
+
bundler (>= 1.17, < 3.0)
|
|
20
20
|
childprocess (>= 2.0, < 5.0)
|
|
21
|
-
contracts (
|
|
22
|
-
cucumber (>=
|
|
21
|
+
contracts (>= 0.16.0, < 0.18.0)
|
|
22
|
+
cucumber (>= 4.0, < 9.0)
|
|
23
23
|
rspec-expectations (~> 3.4)
|
|
24
24
|
thor (~> 1.0)
|
|
25
25
|
ast (2.4.2)
|
|
26
26
|
builder (3.2.4)
|
|
27
27
|
byebug (11.1.3)
|
|
28
|
-
childprocess (4.
|
|
29
|
-
concurrent-ruby (1.
|
|
30
|
-
contracts (0.
|
|
31
|
-
cucumber (
|
|
28
|
+
childprocess (4.1.0)
|
|
29
|
+
concurrent-ruby (1.2.0)
|
|
30
|
+
contracts (0.17)
|
|
31
|
+
cucumber (8.0.0)
|
|
32
32
|
builder (~> 3.2, >= 3.2.4)
|
|
33
|
-
cucumber-
|
|
34
|
-
cucumber-
|
|
35
|
-
cucumber-cucumber-expressions (~>
|
|
36
|
-
cucumber-gherkin (~>
|
|
37
|
-
cucumber-html-formatter (~>
|
|
38
|
-
cucumber-messages (~>
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
multi_test (~>
|
|
42
|
-
sys-uname (~> 1.2, >= 1.2.
|
|
43
|
-
cucumber-
|
|
44
|
-
|
|
45
|
-
cucumber-
|
|
46
|
-
cucumber-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
cucumber-
|
|
52
|
-
cucumber-messages (~>
|
|
53
|
-
cucumber-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
cucumber-core (~> 8.0, >= 8.0.1)
|
|
60
|
-
cucumber-cucumber-expressions (~> 10.3, >= 10.3.0)
|
|
61
|
-
cucumber-messages (~> 13.0, >= 13.0.1)
|
|
62
|
-
diff-lcs (1.4.4)
|
|
63
|
-
docile (1.3.5)
|
|
64
|
-
ffi (1.14.2)
|
|
65
|
-
i18n (1.8.9)
|
|
33
|
+
cucumber-ci-environment (~> 9.0, >= 9.0.4)
|
|
34
|
+
cucumber-core (~> 11.0, >= 11.0.0)
|
|
35
|
+
cucumber-cucumber-expressions (~> 15.1, >= 15.1.1)
|
|
36
|
+
cucumber-gherkin (~> 23.0, >= 23.0.1)
|
|
37
|
+
cucumber-html-formatter (~> 19.1, >= 19.1.0)
|
|
38
|
+
cucumber-messages (~> 18.0, >= 18.0.0)
|
|
39
|
+
diff-lcs (~> 1.5, >= 1.5.0)
|
|
40
|
+
mime-types (~> 3.4, >= 3.4.1)
|
|
41
|
+
multi_test (~> 1.1, >= 1.1.0)
|
|
42
|
+
sys-uname (~> 1.2, >= 1.2.2)
|
|
43
|
+
cucumber-ci-environment (9.1.0)
|
|
44
|
+
cucumber-core (11.0.0)
|
|
45
|
+
cucumber-gherkin (~> 23.0, >= 23.0.1)
|
|
46
|
+
cucumber-messages (~> 18.0, >= 18.0.0)
|
|
47
|
+
cucumber-tag-expressions (~> 4.1, >= 4.1.0)
|
|
48
|
+
cucumber-cucumber-expressions (15.2.0)
|
|
49
|
+
cucumber-gherkin (23.0.1)
|
|
50
|
+
cucumber-messages (~> 18.0, >= 18.0.0)
|
|
51
|
+
cucumber-html-formatter (19.2.0)
|
|
52
|
+
cucumber-messages (~> 18.0, >= 18.0.0)
|
|
53
|
+
cucumber-messages (18.0.0)
|
|
54
|
+
cucumber-tag-expressions (4.1.0)
|
|
55
|
+
diff-lcs (1.5.0)
|
|
56
|
+
docile (1.4.0)
|
|
57
|
+
ffi (1.15.5)
|
|
58
|
+
i18n (1.12.0)
|
|
66
59
|
concurrent-ruby (~> 1.0)
|
|
60
|
+
json (2.6.3)
|
|
67
61
|
kwalify (0.7.2)
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
62
|
+
mime-types (3.4.1)
|
|
63
|
+
mime-types-data (~> 3.2015)
|
|
64
|
+
mime-types-data (3.2022.0105)
|
|
65
|
+
minitest (5.17.0)
|
|
66
|
+
multi_test (1.1.0)
|
|
67
|
+
parallel (1.22.1)
|
|
68
|
+
parser (3.1.3.0)
|
|
73
69
|
ast (~> 2.4.1)
|
|
74
70
|
pastel (0.8.0)
|
|
75
71
|
tty-color (~> 0.5)
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
thor
|
|
80
|
-
thread_safe
|
|
81
|
-
psych (3.3.0)
|
|
82
|
-
rainbow (3.0.0)
|
|
83
|
-
rake (13.0.3)
|
|
84
|
-
reek (6.0.3)
|
|
72
|
+
rainbow (3.1.1)
|
|
73
|
+
rake (13.0.6)
|
|
74
|
+
reek (6.1.2)
|
|
85
75
|
kwalify (~> 0.7.0)
|
|
86
|
-
parser (~> 3.
|
|
87
|
-
psych (~> 3.1)
|
|
76
|
+
parser (~> 3.1.0)
|
|
88
77
|
rainbow (>= 2.0, < 4.0)
|
|
89
|
-
regexp_parser (2.
|
|
90
|
-
rexml (3.2.
|
|
91
|
-
rspec (3.
|
|
92
|
-
rspec-core (~> 3.
|
|
93
|
-
rspec-expectations (~> 3.
|
|
94
|
-
rspec-mocks (~> 3.
|
|
95
|
-
rspec-core (3.
|
|
96
|
-
rspec-support (~> 3.
|
|
97
|
-
rspec-expectations (3.
|
|
78
|
+
regexp_parser (2.6.1)
|
|
79
|
+
rexml (3.2.5)
|
|
80
|
+
rspec (3.12.0)
|
|
81
|
+
rspec-core (~> 3.12.0)
|
|
82
|
+
rspec-expectations (~> 3.12.0)
|
|
83
|
+
rspec-mocks (~> 3.12.0)
|
|
84
|
+
rspec-core (3.12.0)
|
|
85
|
+
rspec-support (~> 3.12.0)
|
|
86
|
+
rspec-expectations (3.12.0)
|
|
98
87
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
99
|
-
rspec-support (~> 3.
|
|
100
|
-
rspec-mocks (3.
|
|
88
|
+
rspec-support (~> 3.12.0)
|
|
89
|
+
rspec-mocks (3.12.1)
|
|
101
90
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
102
|
-
rspec-support (~> 3.
|
|
103
|
-
rspec-support (3.
|
|
104
|
-
rubocop (1.
|
|
91
|
+
rspec-support (~> 3.12.0)
|
|
92
|
+
rspec-support (3.12.0)
|
|
93
|
+
rubocop (1.40.0)
|
|
94
|
+
json (~> 2.3)
|
|
105
95
|
parallel (~> 1.10)
|
|
106
|
-
parser (>= 3.
|
|
96
|
+
parser (>= 3.1.2.1)
|
|
107
97
|
rainbow (>= 2.2.2, < 4.0)
|
|
108
98
|
regexp_parser (>= 1.8, < 3.0)
|
|
109
|
-
rexml
|
|
110
|
-
rubocop-ast (>= 1.
|
|
99
|
+
rexml (>= 3.2.5, < 4.0)
|
|
100
|
+
rubocop-ast (>= 1.23.0, < 2.0)
|
|
111
101
|
ruby-progressbar (~> 1.7)
|
|
112
102
|
unicode-display_width (>= 1.4.0, < 3.0)
|
|
113
|
-
rubocop-ast (1.
|
|
114
|
-
parser (>=
|
|
115
|
-
rubocop-rspec (2.
|
|
116
|
-
rubocop (~> 1.
|
|
117
|
-
rubocop-ast (>= 1.1.0)
|
|
103
|
+
rubocop-ast (1.24.0)
|
|
104
|
+
parser (>= 3.1.1.0)
|
|
105
|
+
rubocop-rspec (2.16.0)
|
|
106
|
+
rubocop (~> 1.33)
|
|
118
107
|
ruby-progressbar (1.11.0)
|
|
119
108
|
simplecov (0.21.2)
|
|
120
109
|
docile (~> 1.1)
|
|
121
110
|
simplecov-html (~> 0.11)
|
|
122
111
|
simplecov_json_formatter (~> 0.1)
|
|
123
112
|
simplecov-html (0.12.3)
|
|
124
|
-
simplecov_json_formatter (0.1.
|
|
113
|
+
simplecov_json_formatter (0.1.4)
|
|
125
114
|
sys-uname (1.2.2)
|
|
126
115
|
ffi (~> 1.1)
|
|
127
|
-
thor (1.1
|
|
128
|
-
thread_safe (0.3.6)
|
|
116
|
+
thor (1.2.1)
|
|
129
117
|
tty-color (0.6.0)
|
|
130
|
-
tzinfo (2.0.
|
|
118
|
+
tzinfo (2.0.6)
|
|
131
119
|
concurrent-ruby (~> 1.0)
|
|
132
|
-
unicode-display_width (2.
|
|
133
|
-
zeitwerk (2.
|
|
120
|
+
unicode-display_width (2.3.0)
|
|
121
|
+
zeitwerk (2.6.6)
|
|
134
122
|
|
|
135
123
|
PLATFORMS
|
|
136
124
|
ruby
|
|
137
125
|
|
|
138
126
|
DEPENDENCIES
|
|
139
|
-
aruba (~> 1
|
|
140
|
-
bundler (~> 2.
|
|
127
|
+
aruba (~> 2.1)
|
|
128
|
+
bundler (~> 2.3)
|
|
141
129
|
byebug (~> 11.1)
|
|
142
|
-
cucumber (~>
|
|
130
|
+
cucumber (~> 8.0)
|
|
143
131
|
expire!
|
|
144
132
|
rake (~> 13.0)
|
|
145
133
|
reek (~> 6.0)
|
|
@@ -149,4 +137,4 @@ DEPENDENCIES
|
|
|
149
137
|
simplecov (~> 0.21)
|
|
150
138
|
|
|
151
139
|
BUNDLED WITH
|
|
152
|
-
2.
|
|
140
|
+
2.3.26
|
data/README.md
CHANGED
|
@@ -68,7 +68,7 @@ The `purge` command is used to calculate and delete expired backups.
|
|
|
68
68
|
It is invoked as follows:
|
|
69
69
|
|
|
70
70
|
``` shell
|
|
71
|
-
expire path/to/backups <rules>
|
|
71
|
+
expire purge path/to/backups <rules>
|
|
72
72
|
```
|
|
73
73
|
|
|
74
74
|
This would delete, according to the rules, all expired backups under `path/to/backups`.
|
|
@@ -81,7 +81,7 @@ The `--simulate` option is suitable for this purpose.
|
|
|
81
81
|
To check the expire-rules you can call `expire purge` with the `--simulate` option:
|
|
82
82
|
|
|
83
83
|
``` shell
|
|
84
|
-
expire path/to/backups <rules> --simulate
|
|
84
|
+
expire purge path/to/backups <rules> --simulate
|
|
85
85
|
```
|
|
86
86
|
|
|
87
87
|
When `purge` is called this way it will calculate the expired backups
|
|
@@ -427,8 +427,6 @@ Some **invalid** filenames:
|
|
|
427
427
|
2021011911134501 # 16 digits are too much
|
|
428
428
|
```
|
|
429
429
|
|
|
430
|
-
Date detection via ctime or mtime is planned for a future release.
|
|
431
|
-
|
|
432
430
|
## Newest
|
|
433
431
|
|
|
434
432
|
The `newest` command shows the newest backup:
|
data/expire.gemspec
CHANGED
|
@@ -36,15 +36,15 @@ Gem::Specification.new do |spec|
|
|
|
36
36
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
37
37
|
spec.require_paths = ["lib"]
|
|
38
38
|
|
|
39
|
-
spec.add_dependency 'activesupport', '~>
|
|
39
|
+
spec.add_dependency 'activesupport', '~> 7.0'
|
|
40
40
|
spec.add_dependency 'pastel', '~> 0.8'
|
|
41
|
-
spec.add_dependency 'thor', '~> 1.
|
|
41
|
+
spec.add_dependency 'thor', '~> 1.2'
|
|
42
42
|
spec.add_dependency 'zeitwerk', "~> 2.4"
|
|
43
43
|
|
|
44
|
-
spec.add_development_dependency 'aruba', '~> 1
|
|
45
|
-
spec.add_development_dependency 'bundler', '~> 2.
|
|
44
|
+
spec.add_development_dependency 'aruba', '~> 2.1'
|
|
45
|
+
spec.add_development_dependency 'bundler', '~> 2.3'
|
|
46
46
|
spec.add_development_dependency 'byebug', '~> 11.1'
|
|
47
|
-
spec.add_development_dependency 'cucumber', '~>
|
|
47
|
+
spec.add_development_dependency 'cucumber', '~> 8.0'
|
|
48
48
|
spec.add_development_dependency 'rake', '~> 13.0'
|
|
49
49
|
spec.add_development_dependency 'reek', '~> 6.0'
|
|
50
50
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
data/lib/expire/backup.rb
CHANGED
|
@@ -5,8 +5,8 @@ module Expire
|
|
|
5
5
|
class Backup < Delegator
|
|
6
6
|
include Comparable
|
|
7
7
|
|
|
8
|
-
def initialize(
|
|
9
|
-
@
|
|
8
|
+
def initialize(time:, pathname:)
|
|
9
|
+
@time = time
|
|
10
10
|
@pathname = pathname
|
|
11
11
|
|
|
12
12
|
# @reasons_to_keep is a Set so a reason can added multiple times
|
|
@@ -14,8 +14,8 @@ module Expire
|
|
|
14
14
|
@reasons_to_keep = Set.new
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
-
attr_reader :
|
|
18
|
-
alias __getobj__
|
|
17
|
+
attr_reader :time, :pathname, :reasons_to_keep
|
|
18
|
+
alias __getobj__ time
|
|
19
19
|
|
|
20
20
|
def same_hour?(other)
|
|
21
21
|
return false unless same_day?(other)
|
|
@@ -52,17 +52,21 @@ module Expire
|
|
|
52
52
|
# The <=> method seems not to be delegated so we need to implement it
|
|
53
53
|
# Note that this Class includes the Comparable module
|
|
54
54
|
def <=>(other)
|
|
55
|
-
|
|
55
|
+
time <=> other.time
|
|
56
56
|
end
|
|
57
57
|
|
|
58
58
|
def add_reason_to_keep(reason)
|
|
59
59
|
reasons_to_keep << reason
|
|
60
60
|
end
|
|
61
61
|
|
|
62
|
-
# def
|
|
63
|
-
# backup.
|
|
62
|
+
# def time
|
|
63
|
+
# backup.time
|
|
64
64
|
# end
|
|
65
65
|
|
|
66
|
+
def cweek
|
|
67
|
+
time&.strftime('%V').to_i
|
|
68
|
+
end
|
|
69
|
+
|
|
66
70
|
def expired?
|
|
67
71
|
reasons_to_keep.empty?
|
|
68
72
|
end
|
|
@@ -70,5 +74,9 @@ module Expire
|
|
|
70
74
|
def keep?
|
|
71
75
|
reasons_to_keep.any?
|
|
72
76
|
end
|
|
77
|
+
|
|
78
|
+
def to_s
|
|
79
|
+
time.strftime('%Y-%m-%dT%H:%M')
|
|
80
|
+
end
|
|
73
81
|
end
|
|
74
82
|
end
|
|
@@ -3,26 +3,23 @@
|
|
|
3
3
|
module Expire
|
|
4
4
|
# Take a path and return an instance of Expire::Backup
|
|
5
5
|
class BackupFromPathService
|
|
6
|
-
def self.call(path
|
|
7
|
-
new(path: path
|
|
6
|
+
def self.call(path:)
|
|
7
|
+
new(path: path).call
|
|
8
8
|
end
|
|
9
9
|
|
|
10
|
-
def initialize(path
|
|
11
|
-
@by = by
|
|
10
|
+
def initialize(path:)
|
|
12
11
|
@pathname = Pathname.new(path)
|
|
13
|
-
|
|
14
|
-
raise ArgumentError, "by: must be :ctime, :mtime or :path, not #{by}" unless %i[ctime mtime path].include?(by)
|
|
15
12
|
end
|
|
16
13
|
|
|
17
14
|
attr_reader :by, :pathname
|
|
18
15
|
|
|
19
16
|
def call
|
|
20
|
-
Backup.new(
|
|
17
|
+
Backup.new(time: time, pathname: pathname)
|
|
21
18
|
end
|
|
22
19
|
|
|
23
20
|
private
|
|
24
21
|
|
|
25
|
-
def
|
|
22
|
+
def time
|
|
26
23
|
digits = extract_digits
|
|
27
24
|
|
|
28
25
|
year = digits[0..3].to_i
|
|
@@ -31,13 +28,16 @@ module Expire
|
|
|
31
28
|
hour = digits[8..9].to_i
|
|
32
29
|
minute = digits[10..11].to_i
|
|
33
30
|
|
|
34
|
-
|
|
31
|
+
time_for(year, month, day, hour, minute)
|
|
35
32
|
end
|
|
36
33
|
|
|
37
|
-
def
|
|
38
|
-
|
|
34
|
+
def time_for(year, month, day, hour, minute)
|
|
35
|
+
Date.new(year, month, day)
|
|
36
|
+
Time.new(year, month, day, hour, minute)
|
|
39
37
|
rescue Date::Error
|
|
40
|
-
raise InvalidPathError, "can't construct date and time from #{pathname}"
|
|
38
|
+
raise InvalidPathError, "can't construct date and time from #{pathname}"
|
|
39
|
+
rescue ArgumentError
|
|
40
|
+
raise InvalidPathError, "can't construct date and time from #{pathname}"
|
|
41
41
|
end
|
|
42
42
|
|
|
43
43
|
def extract_digits
|
data/lib/expire/backup_list.rb
CHANGED
|
@@ -46,8 +46,8 @@ module Expire
|
|
|
46
46
|
backups.min
|
|
47
47
|
end
|
|
48
48
|
|
|
49
|
-
def not_older_than(
|
|
50
|
-
sort.select { |backup| backup.
|
|
49
|
+
def not_older_than(reference_time)
|
|
50
|
+
sort.select { |backup| backup.time >= reference_time }
|
|
51
51
|
end
|
|
52
52
|
|
|
53
53
|
def expired
|
data/lib/expire/cli.rb
CHANGED
|
@@ -20,9 +20,9 @@ module Expire
|
|
|
20
20
|
|
|
21
21
|
attr_reader :unit
|
|
22
22
|
|
|
23
|
-
def apply(backups,
|
|
24
|
-
|
|
25
|
-
kept = backups.one_per(spacing).not_older_than(
|
|
23
|
+
def apply(backups, reference_time)
|
|
24
|
+
minimal_time = reference_time - amount.send(unit)
|
|
25
|
+
kept = backups.one_per(spacing).not_older_than(minimal_time)
|
|
26
26
|
|
|
27
27
|
kept.each { |backup| backup.add_reason_to_keep(reason_to_keep) }
|
|
28
28
|
end
|
|
@@ -21,9 +21,9 @@ module Expire
|
|
|
21
21
|
|
|
22
22
|
attr_reader :unit
|
|
23
23
|
|
|
24
|
-
def apply(backups,
|
|
25
|
-
|
|
26
|
-
kept = backups.not_older_than(
|
|
24
|
+
def apply(backups, time_now)
|
|
25
|
+
reference_time = time_now - amount.send(unit)
|
|
26
|
+
kept = backups.not_older_than(reference_time)
|
|
27
27
|
|
|
28
28
|
kept.each do |backup|
|
|
29
29
|
backup.add_reason_to_keep(reason_to_keep)
|
data/lib/expire/playground.rb
CHANGED
|
@@ -33,7 +33,7 @@ module Expire
|
|
|
33
33
|
def create
|
|
34
34
|
raise_if_backups_dir_exists
|
|
35
35
|
|
|
36
|
-
oldest_backup =
|
|
36
|
+
oldest_backup = Time.now
|
|
37
37
|
|
|
38
38
|
STEP_WIDTHS.each do |adjective, noun|
|
|
39
39
|
options[adjective.to_sym].times do
|
|
@@ -45,8 +45,8 @@ module Expire
|
|
|
45
45
|
|
|
46
46
|
private
|
|
47
47
|
|
|
48
|
-
def mkbackup(
|
|
49
|
-
backup_name =
|
|
48
|
+
def mkbackup(time)
|
|
49
|
+
backup_name = time.strftime('%Y-%m-%dT%H:%M')
|
|
50
50
|
FileUtils.mkdir_p("#{backups_dir}/#{backup_name}")
|
|
51
51
|
end
|
|
52
52
|
|
data/lib/expire/purge_service.rb
CHANGED
data/lib/expire/rules.rb
CHANGED
|
@@ -35,8 +35,8 @@ module Expire
|
|
|
35
35
|
rules.any?
|
|
36
36
|
end
|
|
37
37
|
|
|
38
|
-
def apply(backups,
|
|
39
|
-
rules.sort.each { |rule| rule.apply(backups,
|
|
38
|
+
def apply(backups, reference_time)
|
|
39
|
+
rules.sort.each { |rule| rule.apply(backups, reference_time) }
|
|
40
40
|
|
|
41
41
|
backups
|
|
42
42
|
end
|
data/lib/expire/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: expire
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Thomas Regnet
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2023-02-02 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|
|
@@ -16,14 +16,14 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - "~>"
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: '
|
|
19
|
+
version: '7.0'
|
|
20
20
|
type: :runtime
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
24
|
- - "~>"
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: '
|
|
26
|
+
version: '7.0'
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: pastel
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -44,14 +44,14 @@ dependencies:
|
|
|
44
44
|
requirements:
|
|
45
45
|
- - "~>"
|
|
46
46
|
- !ruby/object:Gem::Version
|
|
47
|
-
version: '1.
|
|
47
|
+
version: '1.2'
|
|
48
48
|
type: :runtime
|
|
49
49
|
prerelease: false
|
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
51
|
requirements:
|
|
52
52
|
- - "~>"
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
|
-
version: '1.
|
|
54
|
+
version: '1.2'
|
|
55
55
|
- !ruby/object:Gem::Dependency
|
|
56
56
|
name: zeitwerk
|
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -72,28 +72,28 @@ dependencies:
|
|
|
72
72
|
requirements:
|
|
73
73
|
- - "~>"
|
|
74
74
|
- !ruby/object:Gem::Version
|
|
75
|
-
version: '1
|
|
75
|
+
version: '2.1'
|
|
76
76
|
type: :development
|
|
77
77
|
prerelease: false
|
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
|
79
79
|
requirements:
|
|
80
80
|
- - "~>"
|
|
81
81
|
- !ruby/object:Gem::Version
|
|
82
|
-
version: '1
|
|
82
|
+
version: '2.1'
|
|
83
83
|
- !ruby/object:Gem::Dependency
|
|
84
84
|
name: bundler
|
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
|
86
86
|
requirements:
|
|
87
87
|
- - "~>"
|
|
88
88
|
- !ruby/object:Gem::Version
|
|
89
|
-
version: '2.
|
|
89
|
+
version: '2.3'
|
|
90
90
|
type: :development
|
|
91
91
|
prerelease: false
|
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
|
93
93
|
requirements:
|
|
94
94
|
- - "~>"
|
|
95
95
|
- !ruby/object:Gem::Version
|
|
96
|
-
version: '2.
|
|
96
|
+
version: '2.3'
|
|
97
97
|
- !ruby/object:Gem::Dependency
|
|
98
98
|
name: byebug
|
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -114,14 +114,14 @@ dependencies:
|
|
|
114
114
|
requirements:
|
|
115
115
|
- - "~>"
|
|
116
116
|
- !ruby/object:Gem::Version
|
|
117
|
-
version: '
|
|
117
|
+
version: '8.0'
|
|
118
118
|
type: :development
|
|
119
119
|
prerelease: false
|
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
|
121
121
|
requirements:
|
|
122
122
|
- - "~>"
|
|
123
123
|
- !ruby/object:Gem::Version
|
|
124
|
-
version: '
|
|
124
|
+
version: '8.0'
|
|
125
125
|
- !ruby/object:Gem::Dependency
|
|
126
126
|
name: rake
|
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -206,8 +206,8 @@ dependencies:
|
|
|
206
206
|
- - "~>"
|
|
207
207
|
- !ruby/object:Gem::Version
|
|
208
208
|
version: '0.21'
|
|
209
|
-
description:
|
|
210
|
-
email:
|
|
209
|
+
description:
|
|
210
|
+
email:
|
|
211
211
|
executables:
|
|
212
212
|
- expire
|
|
213
213
|
extensions: []
|
|
@@ -299,7 +299,7 @@ licenses:
|
|
|
299
299
|
metadata:
|
|
300
300
|
homepage_uri: https://github.com/thomasregnet/expire
|
|
301
301
|
source_code_uri: https://github.com/thomasregnet/expire
|
|
302
|
-
post_install_message:
|
|
302
|
+
post_install_message:
|
|
303
303
|
rdoc_options: []
|
|
304
304
|
require_paths:
|
|
305
305
|
- lib
|
|
@@ -314,8 +314,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
314
314
|
- !ruby/object:Gem::Version
|
|
315
315
|
version: '0'
|
|
316
316
|
requirements: []
|
|
317
|
-
rubygems_version: 3.
|
|
318
|
-
signing_key:
|
|
317
|
+
rubygems_version: 3.4.1
|
|
318
|
+
signing_key:
|
|
319
319
|
specification_version: 4
|
|
320
320
|
summary: Calculate expired backups.
|
|
321
321
|
test_files: []
|