padrino-cache 0.12.4 → 0.12.5

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: 0ac0df7b073b59210a93e186e5b1db6f3538ea14
4
- data.tar.gz: 364ef351e0ffc8a5290d14f2ae5164135d349f26
3
+ metadata.gz: 4577c95f9efa61aba692677d3d8e5c0e337f39de
4
+ data.tar.gz: b0d649693289a1221867df1f28ac2efa39a88239
5
5
  SHA512:
6
- metadata.gz: 01b773adf36bfd56da7e3d1dc40335e01670501b5db24d5505a772336f89676104c0de75a62d345b6fd269def2d67d2d1eedd08951a568b53a6cf33cf6f46cc5
7
- data.tar.gz: 28fc7e4ea62c7697cc195027b9f7dcf02f0a53cc696d6cd3cf19a9fc766b1896c947a15e30d757b15ba611c1bf0677d704e1de5518b9bc000acbe8341205eacb
6
+ metadata.gz: 7db82e2e36d002c87ee1a6ea8f3835e1fa63b7a98dc32de57562e0a07f57e1d4f5831e39566ac8a751d3c74a797f01475013c1c9cb293a718af188e6f7f78c7b
7
+ data.tar.gz: c704a5c3adf1f89e75cd6e72a719fb126c98ed7fe84e9d0dfdbd69489a701535c2258b39d09d26f7e816411247d60a3db5b7708329c686a49442195f7ce2d6ed
data/lib/padrino-cache.rb CHANGED
@@ -98,9 +98,11 @@ module Padrino
98
98
  app.helpers Padrino::Cache::Helpers::CacheStore
99
99
  app.helpers Padrino::Cache::Helpers::Fragment
100
100
  app.helpers Padrino::Cache::Helpers::Page
101
- app.set :cache, Padrino::Cache.new(:File,
102
- :dir => Padrino.root('tmp', defined?(app.app_name) ? app.app_name.to_s : '', 'cache'))
103
- app.disable :caching
101
+ unless app.respond_to?(:cache)
102
+ cache_dir = Padrino.root('tmp', defined?(app.app_name) ? app.app_name.to_s : '', 'cache')
103
+ app.set :cache, Padrino::Cache.new(:File, :dir => cache_dir)
104
+ end
105
+ app.disable :caching unless app.respond_to?(:caching)
104
106
  included(app)
105
107
  end
106
108
 
@@ -457,4 +457,22 @@ describe "PadrinoCache" do
457
457
  assert_equal 4, called_times_a
458
458
  assert_equal 2, called_times_b
459
459
  end
460
+
461
+ it "preserve the app's `caching` setting if set before registering the module" do
462
+ mock_app do
463
+ enable :caching
464
+ register Padrino::Cache
465
+ end
466
+
467
+ assert @app.caching
468
+ end
469
+
470
+ it "preserve the app's `cache` setting if set before registering the module" do
471
+ mock_app do
472
+ set :cache, Padrino::Cache.new(:Memory)
473
+ register Padrino::Cache
474
+ end
475
+
476
+ assert @app.cache.adapter.adapter.is_a?(Moneta::Adapters::Memory)
477
+ end
460
478
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: padrino-cache
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.4
4
+ version: 0.12.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Padrino Team
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2014-10-19 00:00:00.000000000 Z
14
+ date: 2015-03-04 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: padrino-core
@@ -19,28 +19,28 @@ dependencies:
19
19
  requirements:
20
20
  - - '='
21
21
  - !ruby/object:Gem::Version
22
- version: 0.12.4
22
+ version: 0.12.5
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - '='
28
28
  - !ruby/object:Gem::Version
29
- version: 0.12.4
29
+ version: 0.12.5
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: padrino-helpers
32
32
  requirement: !ruby/object:Gem::Requirement
33
33
  requirements:
34
34
  - - '='
35
35
  - !ruby/object:Gem::Version
36
- version: 0.12.4
36
+ version: 0.12.5
37
37
  type: :runtime
38
38
  prerelease: false
39
39
  version_requirements: !ruby/object:Gem::Requirement
40
40
  requirements:
41
41
  - - '='
42
42
  - !ruby/object:Gem::Version
43
- version: 0.12.4
43
+ version: 0.12.5
44
44
  - !ruby/object:Gem::Dependency
45
45
  name: moneta
46
46
  requirement: !ruby/object:Gem::Requirement