masamune 0.18.6 → 0.18.7

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: 0ccbb4687f3e0f907f1b679d494904de9d6e473a
4
- data.tar.gz: 769aa5dc646399ff25512e4cfcd213f47ec4f3cd
3
+ metadata.gz: e886df417cffdf88380ab29c2bf209f12ae2fa5e
4
+ data.tar.gz: d94a89c271bd19c15d8a368e2e5a2e40a7def4e6
5
5
  SHA512:
6
- metadata.gz: b9bd7f5d4e52e9164faf4880e6ae8770b172e7edda34ddb72b631ddf6ad1f433773437ba5d3c3fb2b8b9b34241a725510e0647e8533ece7213bab94fba0c6c9c
7
- data.tar.gz: f604d683e7eb70f78b95deae96a8cfcac8b1762e28672759f705bf9ddc0bb55539fd6a7df9b6e459f3098b3517cadd9a8554e6707d2ac98457a2169917ba64d7
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
@@ -21,5 +21,5 @@
21
21
  # THE SOFTWARE.
22
22
 
23
23
  module Masamune
24
- VERSION = '0.18.6'.freeze
24
+ VERSION = '0.18.7'.freeze
25
25
  end
@@ -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.6
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-10 00:00:00.000000000 Z
11
+ date: 2016-11-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor