ar-resque-counter-cache 0.0.2 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +5 -0
- data/Gemfile +4 -0
- data/Rakefile +2 -0
- data/VERSION +1 -0
- data/ar-resque-counter-cache.gemspec +30 -0
- data/lib/ar-resque-counter-cache.rb +2 -2
- data/lib/{ar_resque_counter_cache → ar-resque-counter-cache}/active_record.rb +4 -2
- data/lib/{ar_resque_counter_cache → ar-resque-counter-cache}/increment_counters_worker.rb +0 -0
- data/lib/ar-resque-counter-cache/version.rb +3 -0
- data/spec/redis-test.conf +13 -0
- metadata +85 -13
data/Gemfile
ADDED
data/Rakefile
ADDED
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.2
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "ar-resque-counter-cache/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "ar-resque-counter-cache"
|
7
|
+
s.version = ArAsyncCounterCache::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Aaron Gibralter"]
|
10
|
+
s.email = ["aaron.gibralter@gmail.com"]
|
11
|
+
s.homepage = "http://github.com/agibralter/ar-resque-counter-cache"
|
12
|
+
s.summary = %q{Increment ActiveRecord's counter cache column asynchronously using Resque (and resque-lock-timeout).}
|
13
|
+
s.description = %q{Increment ActiveRecord's counter cache column asynchronously using Resque (and resque-lock-timeout).}
|
14
|
+
|
15
|
+
s.rubyforge_project = "ar-resque-counter-cache"
|
16
|
+
|
17
|
+
s.files = `git ls-files`.split("\n")
|
18
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
|
+
s.require_paths = ["lib"]
|
21
|
+
|
22
|
+
s.add_dependency "activerecord", "~> 2.3.5"
|
23
|
+
s.add_dependency "resque", "~> 1.10.0"
|
24
|
+
s.add_dependency "resque-lock-timeout", "~> 0.2.1"
|
25
|
+
s.add_dependency "after_commit", "~> 1.0.6"
|
26
|
+
|
27
|
+
s.add_development_dependency "rspec", "~> 1.3.0"
|
28
|
+
s.add_development_dependency "sqlite3-ruby", "~> 1.3.3"
|
29
|
+
s.add_development_dependency "SystemTimer", "~> 1.2.2"
|
30
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'active_record'
|
2
|
-
require '
|
3
|
-
require '
|
2
|
+
require 'ar-resque-counter-cache/increment_counters_worker'
|
3
|
+
require 'ar-resque-counter-cache/active_record'
|
4
4
|
|
5
5
|
ActiveRecord::Base.send(:include, ArAsyncCounterCache::ActiveRecord)
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'after_commit'
|
2
|
+
|
1
3
|
module ArAsyncCounterCache
|
2
4
|
|
3
5
|
module ActiveRecord
|
@@ -49,7 +51,7 @@ module ArAsyncCounterCache
|
|
49
51
|
ArAsyncCounterCache::IncrementCountersWorker.cache_and_enqueue(parent_class, parent_id, column, :increment)
|
50
52
|
end
|
51
53
|
end
|
52
|
-
|
54
|
+
after_commit_on_create(method_name)
|
53
55
|
# Define after_destroy callback method.
|
54
56
|
method_name = "#{base_method_name}_after_destroy".to_sym
|
55
57
|
define_method(method_name) do
|
@@ -57,7 +59,7 @@ module ArAsyncCounterCache
|
|
57
59
|
ArAsyncCounterCache::IncrementCountersWorker.cache_and_enqueue(parent_class, parent_id, column, :decrement)
|
58
60
|
end
|
59
61
|
end
|
60
|
-
|
62
|
+
after_commit_on_destroy(method_name)
|
61
63
|
end
|
62
64
|
|
63
65
|
def async_counter_cache_column(opt)
|
File without changes
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ar-resque-counter-cache
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
|
+
- 1
|
7
8
|
- 0
|
8
9
|
- 0
|
9
|
-
|
10
|
-
version: 0.0.2
|
10
|
+
version: 1.0.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Aaron Gibralter
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2011-01-30 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -66,32 +66,103 @@ dependencies:
|
|
66
66
|
version: 0.2.1
|
67
67
|
type: :runtime
|
68
68
|
version_requirements: *id003
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: after_commit
|
71
|
+
prerelease: false
|
72
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
hash: 27
|
78
|
+
segments:
|
79
|
+
- 1
|
80
|
+
- 0
|
81
|
+
- 6
|
82
|
+
version: 1.0.6
|
83
|
+
type: :runtime
|
84
|
+
version_requirements: *id004
|
85
|
+
- !ruby/object:Gem::Dependency
|
86
|
+
name: rspec
|
87
|
+
prerelease: false
|
88
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ~>
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
hash: 27
|
94
|
+
segments:
|
95
|
+
- 1
|
96
|
+
- 3
|
97
|
+
- 0
|
98
|
+
version: 1.3.0
|
99
|
+
type: :development
|
100
|
+
version_requirements: *id005
|
101
|
+
- !ruby/object:Gem::Dependency
|
102
|
+
name: sqlite3-ruby
|
103
|
+
prerelease: false
|
104
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ~>
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
hash: 29
|
110
|
+
segments:
|
111
|
+
- 1
|
112
|
+
- 3
|
113
|
+
- 3
|
114
|
+
version: 1.3.3
|
115
|
+
type: :development
|
116
|
+
version_requirements: *id006
|
117
|
+
- !ruby/object:Gem::Dependency
|
118
|
+
name: SystemTimer
|
119
|
+
prerelease: false
|
120
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ~>
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
hash: 27
|
126
|
+
segments:
|
127
|
+
- 1
|
128
|
+
- 2
|
129
|
+
- 2
|
130
|
+
version: 1.2.2
|
131
|
+
type: :development
|
132
|
+
version_requirements: *id007
|
69
133
|
description: Increment ActiveRecord's counter cache column asynchronously using Resque (and resque-lock-timeout).
|
70
|
-
email:
|
134
|
+
email:
|
135
|
+
- aaron.gibralter@gmail.com
|
71
136
|
executables: []
|
72
137
|
|
73
138
|
extensions: []
|
74
139
|
|
75
|
-
extra_rdoc_files:
|
76
|
-
|
77
|
-
- README.md
|
140
|
+
extra_rdoc_files: []
|
141
|
+
|
78
142
|
files:
|
143
|
+
- .gitignore
|
144
|
+
- Gemfile
|
79
145
|
- LICENSE
|
80
146
|
- README.md
|
147
|
+
- Rakefile
|
148
|
+
- VERSION
|
149
|
+
- ar-resque-counter-cache.gemspec
|
81
150
|
- lib/ar-resque-counter-cache.rb
|
82
|
-
- lib/
|
83
|
-
- lib/
|
151
|
+
- lib/ar-resque-counter-cache/active_record.rb
|
152
|
+
- lib/ar-resque-counter-cache/increment_counters_worker.rb
|
153
|
+
- lib/ar-resque-counter-cache/version.rb
|
84
154
|
- spec/ar_resque_counter_cache/active_record_spec.rb
|
85
155
|
- spec/integration_spec.rb
|
86
156
|
- spec/models.rb
|
157
|
+
- spec/redis-test.conf
|
87
158
|
- spec/spec_helper.rb
|
88
159
|
has_rdoc: true
|
89
160
|
homepage: http://github.com/agibralter/ar-resque-counter-cache
|
90
161
|
licenses: []
|
91
162
|
|
92
163
|
post_install_message:
|
93
|
-
rdoc_options:
|
94
|
-
|
164
|
+
rdoc_options: []
|
165
|
+
|
95
166
|
require_paths:
|
96
167
|
- lib
|
97
168
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -114,7 +185,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
114
185
|
version: "0"
|
115
186
|
requirements: []
|
116
187
|
|
117
|
-
rubyforge_project:
|
188
|
+
rubyforge_project: ar-resque-counter-cache
|
118
189
|
rubygems_version: 1.3.7
|
119
190
|
signing_key:
|
120
191
|
specification_version: 3
|
@@ -123,4 +194,5 @@ test_files:
|
|
123
194
|
- spec/ar_resque_counter_cache/active_record_spec.rb
|
124
195
|
- spec/integration_spec.rb
|
125
196
|
- spec/models.rb
|
197
|
+
- spec/redis-test.conf
|
126
198
|
- spec/spec_helper.rb
|