masamune 0.18.6 → 0.18.7
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/lib/masamune/data_plan/rule.rb +10 -2
- data/lib/masamune/version.rb +1 -1
- data/spec/masamune/data_plan/rule_spec.rb +44 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e886df417cffdf88380ab29c2bf209f12ae2fa5e
|
4
|
+
data.tar.gz: d94a89c271bd19c15d8a368e2e5a2e40a7def4e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c6b60f88135189d1bf95f88123f371f0f082fe7be93612e40ddf90d32c15e7b4a1cc76eb4a827164826c3cc66a73413192ea60af97ca94bf6eaa8c2aa7a3ce54
|
7
|
+
data.tar.gz: 34c1cb0aa9a851f06157046a1f9de8f71b1d686e175d1bf9751353fe21a961e948a38e63071c872f360fa7982d72522580b7d49437a7c63cc6e55da9105cecff
|
@@ -253,6 +253,16 @@ class Masamune::DataPlan::Rule
|
|
253
253
|
end
|
254
254
|
|
255
255
|
def cache_depth
|
256
|
+
[max_cache_depth, step_cache_depth].min
|
257
|
+
end
|
258
|
+
|
259
|
+
private
|
260
|
+
|
261
|
+
def max_cache_depth
|
262
|
+
pattern.split('/').select { |x| x.include?('%') || x.include?('*') }.count
|
263
|
+
end
|
264
|
+
|
265
|
+
def step_cache_depth
|
256
266
|
case time_step
|
257
267
|
when :hour, :hours
|
258
268
|
2
|
@@ -263,8 +273,6 @@ class Masamune::DataPlan::Rule
|
|
263
273
|
end
|
264
274
|
end
|
265
275
|
|
266
|
-
private
|
267
|
-
|
268
276
|
def time_step_to_format(step)
|
269
277
|
case step
|
270
278
|
when :hour, :hours
|
data/lib/masamune/version.rb
CHANGED
@@ -464,4 +464,48 @@ describe Masamune::DataPlan::Rule do
|
|
464
464
|
it { is_expected.to be(true) }
|
465
465
|
end
|
466
466
|
end
|
467
|
+
|
468
|
+
describe '#cache_depth' do
|
469
|
+
subject { instance.cache_depth }
|
470
|
+
|
471
|
+
context 'with flat glob' do
|
472
|
+
let(:pattern) { 'logs/*.log' }
|
473
|
+
it { is_expected.to be(1) }
|
474
|
+
end
|
475
|
+
|
476
|
+
context 'with nested glob' do
|
477
|
+
let(:pattern) { 'logs/%Y-%m-%d/*.log' }
|
478
|
+
it { is_expected.to be(1) }
|
479
|
+
end
|
480
|
+
|
481
|
+
context 'with flat :hourly' do
|
482
|
+
let(:pattern) { 'logs/*%H-s.log' }
|
483
|
+
it { is_expected.to be(1) }
|
484
|
+
end
|
485
|
+
|
486
|
+
context 'with nested :hourly' do
|
487
|
+
let(:pattern) { 'report/%Y-%m-%d/%H' }
|
488
|
+
it { is_expected.to be(2) }
|
489
|
+
end
|
490
|
+
|
491
|
+
context 'with flat :daily' do
|
492
|
+
let(:pattern) { 'report/%Y-%m-%d' }
|
493
|
+
it { is_expected.to be(1) }
|
494
|
+
end
|
495
|
+
|
496
|
+
context 'with nested :daily' do
|
497
|
+
let(:pattern) { 'report/%Y-%m/%d' }
|
498
|
+
it { is_expected.to be(1) }
|
499
|
+
end
|
500
|
+
|
501
|
+
context 'with flat :monthly' do
|
502
|
+
let(:pattern) { 'report/%Y-%m' }
|
503
|
+
it { is_expected.to be(0) }
|
504
|
+
end
|
505
|
+
|
506
|
+
context 'with nested :monthly' do
|
507
|
+
let(:pattern) { 'report/%Y/%m' }
|
508
|
+
it { is_expected.to be(0) }
|
509
|
+
end
|
510
|
+
end
|
467
511
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: masamune
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.18.
|
4
|
+
version: 0.18.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Andrews
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-11-
|
11
|
+
date: 2016-11-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|