kasket 3.1.1 → 3.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: cbbbb6b9f11d63c2ad2d8f8124145abb685dfa3a
4
+ data.tar.gz: 5e8df40dcbbcc08410b3922477497d7b70eab7d6
5
+ SHA512:
6
+ metadata.gz: 8222b347d102168e89f29b87054f101e73b41878a284172d2caf1b54ed7392df4fd7e6aca168efbdafb8afbcfc224a9532ce6a10c01cb027f77cf2d74242fe7b
7
+ data.tar.gz: 0ead621748e7e32605d08deec8a5353659ffed31236ba8c983fc35ca32b92f6a11ecfd9027366e33bd83e996bd5b9151ecec097ac01a224fb77595c4acb36d6e
@@ -3,7 +3,7 @@ module Kasket
3
3
  class Version
4
4
  MAJOR = 3
5
5
  MINOR = 1
6
- PATCH = 1
6
+ PATCH = 2
7
7
  STRING = "#{MAJOR}.#{MINOR}.#{PATCH}"
8
8
  PROTOCOL = 4
9
9
  end
@@ -37,6 +37,7 @@ module Kasket
37
37
  end
38
38
 
39
39
  def kasket_keys
40
+ return @kasket_keys if @kasket_keys
40
41
  attribute_sets = [attributes.symbolize_keys]
41
42
 
42
43
  if changed?
@@ -57,10 +58,16 @@ module Kasket
57
58
  keys
58
59
  end
59
60
 
61
+ def remember_kasket_keys
62
+ @kasket_keys = kasket_keys
63
+ end
64
+
60
65
  def clear_kasket_indices
61
66
  kasket_keys.each do |key|
62
67
  Kasket.cache.delete(key)
63
68
  end
69
+ @kasket_keys = nil
70
+ true
64
71
  end
65
72
 
66
73
  def reload_with_kasket_clearing(*args)
@@ -77,8 +84,14 @@ module Kasket
77
84
  model_class.send(:alias_method, :kasket_cacheable?, :default_kasket_cacheable?)
78
85
  end
79
86
 
80
- model_class.after_save :clear_kasket_indices
81
- model_class.after_destroy :clear_kasket_indices
87
+ if model_class.respond_to?(:after_commit)
88
+ model_class.after_save :remember_kasket_keys
89
+ model_class.after_destroy :remember_kasket_keys
90
+ model_class.after_commit :clear_kasket_indices
91
+ else
92
+ model_class.after_save :clear_kasket_indices
93
+ model_class.after_destroy :clear_kasket_indices
94
+ end
82
95
 
83
96
  model_class.alias_method_chain :reload, :kasket_clearing
84
97
 
data/test/helper.rb CHANGED
@@ -2,6 +2,8 @@ require 'rubygems'
2
2
 
3
3
  require 'bundler'
4
4
  Bundler.setup
5
+ # shoulda-matchers dependency:
6
+ require 'active_support/core_ext/module/delegation'
5
7
  Bundler.require(:default, :development)
6
8
 
7
9
  if defined?(Debugger)
@@ -13,6 +15,7 @@ require 'test/unit'
13
15
  require 'mocha'
14
16
  require 'active_record'
15
17
  require 'active_record/fixtures'
18
+ require 'test_after_commit' if ActiveRecord::Base.respond_to?(:after_commit)
16
19
 
17
20
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
18
21
  $LOAD_PATH.unshift(File.dirname(__FILE__))
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kasket
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.1
5
- prerelease:
4
+ version: 3.1.2
6
5
  platform: ruby
7
6
  authors:
8
7
  - Mick Staugaard
@@ -10,14 +9,13 @@ authors:
10
9
  autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2013-06-13 00:00:00.000000000 Z
12
+ date: 2013-09-23 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: activerecord
17
16
  requirement: !ruby/object:Gem::Requirement
18
- none: false
19
17
  requirements:
20
- - - ! '>='
18
+ - - '>='
21
19
  - !ruby/object:Gem::Version
22
20
  version: 2.3.6
23
21
  - - <
@@ -26,9 +24,8 @@ dependencies:
26
24
  type: :runtime
27
25
  prerelease: false
28
26
  version_requirements: !ruby/object:Gem::Requirement
29
- none: false
30
27
  requirements:
31
- - - ! '>='
28
+ - - '>='
32
29
  - !ruby/object:Gem::Version
33
30
  version: 2.3.6
34
31
  - - <
@@ -37,39 +34,34 @@ dependencies:
37
34
  - !ruby/object:Gem::Dependency
38
35
  name: rake
39
36
  requirement: !ruby/object:Gem::Requirement
40
- none: false
41
37
  requirements:
42
- - - ! '>='
38
+ - - '>='
43
39
  - !ruby/object:Gem::Version
44
40
  version: '0'
45
41
  type: :development
46
42
  prerelease: false
47
43
  version_requirements: !ruby/object:Gem::Requirement
48
- none: false
49
44
  requirements:
50
- - - ! '>='
45
+ - - '>='
51
46
  - !ruby/object:Gem::Version
52
47
  version: '0'
53
48
  - !ruby/object:Gem::Dependency
54
49
  name: bundler
55
50
  requirement: !ruby/object:Gem::Requirement
56
- none: false
57
51
  requirements:
58
- - - ! '>='
52
+ - - '>='
59
53
  - !ruby/object:Gem::Version
60
54
  version: '0'
61
55
  type: :development
62
56
  prerelease: false
63
57
  version_requirements: !ruby/object:Gem::Requirement
64
- none: false
65
58
  requirements:
66
- - - ! '>='
59
+ - - '>='
67
60
  - !ruby/object:Gem::Version
68
61
  version: '0'
69
62
  - !ruby/object:Gem::Dependency
70
63
  name: appraisal
71
64
  requirement: !ruby/object:Gem::Requirement
72
- none: false
73
65
  requirements:
74
66
  - - ~>
75
67
  - !ruby/object:Gem::Version
@@ -77,7 +69,6 @@ dependencies:
77
69
  type: :development
78
70
  prerelease: false
79
71
  version_requirements: !ruby/object:Gem::Requirement
80
- none: false
81
72
  requirements:
82
73
  - - ~>
83
74
  - !ruby/object:Gem::Version
@@ -85,39 +76,34 @@ dependencies:
85
76
  - !ruby/object:Gem::Dependency
86
77
  name: shoulda
87
78
  requirement: !ruby/object:Gem::Requirement
88
- none: false
89
79
  requirements:
90
- - - ! '>='
80
+ - - '>='
91
81
  - !ruby/object:Gem::Version
92
82
  version: '0'
93
83
  type: :development
94
84
  prerelease: false
95
85
  version_requirements: !ruby/object:Gem::Requirement
96
- none: false
97
86
  requirements:
98
- - - ! '>='
87
+ - - '>='
99
88
  - !ruby/object:Gem::Version
100
89
  version: '0'
101
90
  - !ruby/object:Gem::Dependency
102
91
  name: mocha
103
92
  requirement: !ruby/object:Gem::Requirement
104
- none: false
105
93
  requirements:
106
- - - ! '>='
94
+ - - '>='
107
95
  - !ruby/object:Gem::Version
108
96
  version: '0'
109
97
  type: :development
110
98
  prerelease: false
111
99
  version_requirements: !ruby/object:Gem::Requirement
112
- none: false
113
100
  requirements:
114
- - - ! '>='
101
+ - - '>='
115
102
  - !ruby/object:Gem::Version
116
103
  version: '0'
117
104
  - !ruby/object:Gem::Dependency
118
105
  name: test-unit
119
106
  requirement: !ruby/object:Gem::Requirement
120
- none: false
121
107
  requirements:
122
108
  - - ~>
123
109
  - !ruby/object:Gem::Version
@@ -125,7 +111,6 @@ dependencies:
125
111
  type: :development
126
112
  prerelease: false
127
113
  version_requirements: !ruby/object:Gem::Requirement
128
- none: false
129
114
  requirements:
130
115
  - - ~>
131
116
  - !ruby/object:Gem::Version
@@ -172,33 +157,26 @@ files:
172
157
  homepage: http://github.com/zendesk/kasket
173
158
  licenses:
174
159
  - Apache License Version 2.0
160
+ metadata: {}
175
161
  post_install_message:
176
162
  rdoc_options: []
177
163
  require_paths:
178
164
  - lib
179
165
  required_ruby_version: !ruby/object:Gem::Requirement
180
- none: false
181
166
  requirements:
182
- - - ! '>='
167
+ - - '>='
183
168
  - !ruby/object:Gem::Version
184
169
  version: '0'
185
- segments:
186
- - 0
187
- hash: -3331408880632426003
188
170
  required_rubygems_version: !ruby/object:Gem::Requirement
189
- none: false
190
171
  requirements:
191
- - - ! '>='
172
+ - - '>='
192
173
  - !ruby/object:Gem::Version
193
174
  version: '0'
194
- segments:
195
- - 0
196
- hash: -3331408880632426003
197
175
  requirements: []
198
176
  rubyforge_project:
199
- rubygems_version: 1.8.25
177
+ rubygems_version: 2.0.7
200
178
  signing_key:
201
- specification_version: 3
179
+ specification_version: 4
202
180
  summary: A write back caching layer on active record
203
181
  test_files:
204
182
  - test/cache_expiry_test.rb