ar-resque-counter-cache 1.0.2 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -19,14 +19,10 @@ Gem::Specification.new do |s|
19
19
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
20
  s.require_paths = ["lib"]
21
21
 
22
- s.add_dependency "activerecord", "~> 2.3.5"
23
- s.add_dependency "resque", "~> 1.10"
24
- s.add_dependency "resque-lock-timeout", "~> 0.3.1"
25
- s.add_dependency "after_commit", "~> 1.0.6"
22
+ s.add_dependency "activerecord", "~> 3.0.0"
23
+ s.add_dependency "resque", "~> 1.10.0"
24
+ s.add_dependency "resque-lock-timeout", "~> 0.2.1"
26
25
 
27
- s.add_development_dependency "rspec", "~> 1.3.0"
26
+ s.add_development_dependency "rspec", "~> 2.4.0"
28
27
  s.add_development_dependency "sqlite3-ruby", "~> 1.3.3"
29
- s.add_development_dependency "SystemTimer", "~> 1.2.2"
30
- s.add_development_dependency "rake"
31
- s.add_development_dependency "yajl-ruby"
32
28
  end
@@ -1,5 +1,3 @@
1
- require 'after_commit'
2
-
3
1
  module ArAsyncCounterCache
4
2
 
5
3
  module ActiveRecord
@@ -51,7 +49,7 @@ module ArAsyncCounterCache
51
49
  ArAsyncCounterCache::IncrementCountersWorker.cache_and_enqueue(parent_class, parent_id, column, :increment)
52
50
  end
53
51
  end
54
- after_commit_on_create(method_name)
52
+ after_commit(method_name, :on => :create)
55
53
  # Define after_destroy callback method.
56
54
  method_name = "#{base_method_name}_after_destroy".to_sym
57
55
  define_method(method_name) do
@@ -59,7 +57,7 @@ module ArAsyncCounterCache
59
57
  ArAsyncCounterCache::IncrementCountersWorker.cache_and_enqueue(parent_class, parent_id, column, :decrement)
60
58
  end
61
59
  end
62
- after_commit_on_destroy(method_name)
60
+ after_commit(method_name, :on => :destroy)
63
61
  end
64
62
 
65
63
  def async_counter_cache_column(opt)
@@ -1,3 +1,3 @@
1
1
  module ArAsyncCounterCache
2
- VERSION = "1.0.2"
2
+ VERSION = "2.0.0"
3
3
  end
@@ -37,16 +37,16 @@ describe "integration" do
37
37
  @post1.reload.count_of_comments.should == 0
38
38
  @post2.reload.count_of_comments.should == 0
39
39
 
40
- # [ArAsyncCounterCache::IncrementCountersWorker, "User", 2, "comments_count"]
40
+ # [ArAsyncCounterCache::IncrementCountersWorker, "Post", 1, "count_of_comments"]
41
41
  perform_next_job
42
42
  @user1.reload.posts_count.should == 2
43
43
  @user1.reload.comments_count.should == 0
44
44
  @user2.reload.posts_count.should == 0
45
- @user2.reload.comments_count.should == 2
46
- @post1.reload.count_of_comments.should == 0
45
+ @user2.reload.comments_count.should == 0
46
+ @post1.reload.count_of_comments.should == 2
47
47
  @post2.reload.count_of_comments.should == 0
48
48
 
49
- # [ArAsyncCounterCache::IncrementCountersWorker, "Post", 1, "count_of_comments"]
49
+ # [ArAsyncCounterCache::IncrementCountersWorker, "User", 2, "comments_count"]
50
50
  perform_next_job
51
51
  @user1.reload.posts_count.should == 2
52
52
  @user1.reload.comments_count.should == 0
@@ -2,12 +2,6 @@ daemonize yes
2
2
  pidfile ./redis-test.pid
3
3
  port 9736
4
4
  timeout 300
5
- save 900 1
6
- save 300 10
7
- save 60 10000
8
- dbfilename ./dump.rdb
9
5
  dir .
10
6
  loglevel debug
11
7
  logfile stdout
12
- databases 16
13
- glueoutputbuf yes
@@ -2,35 +2,35 @@ spec_dir = File.expand_path(File.dirname(__FILE__))
2
2
  $:.unshift(File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib')))
3
3
 
4
4
  require 'rubygems'
5
- # Ensure resque for tests.
6
5
  require 'resque'
7
6
  require 'ar-resque-counter-cache'
8
- require 'spec'
7
+ require 'rspec'
9
8
  require 'models'
10
9
 
11
- cwd = Dir.getwd
12
- Dir.chdir(spec_dir)
13
-
14
10
  if !system("which redis-server")
15
11
  puts '', "** can't find `redis-server` in your path"
16
12
  abort ''
17
13
  end
18
14
 
19
15
  at_exit do
20
- if (pid = `cat redis-test.pid`.strip) =~ /^\d+$/
21
- puts "Killing test redis server with pid #{pid}..."
22
- `rm -f dump.rdb`
23
- `rm -f redis-test.pid`
24
- Process.kill("KILL", pid.to_i)
25
- Dir.chdir(cwd)
16
+ Dir.chdir(spec_dir) do
17
+ if (pid = `cat redis-test.pid`.strip) =~ /^\d+$/
18
+ puts "Killing test redis server with pid #{pid}..."
19
+ `rm -f dump.rdb`
20
+ `rm -f redis-test.pid`
21
+ Process.kill("KILL", pid.to_i)
22
+ end
26
23
  end
27
24
  end
28
25
 
29
26
  puts "Starting redis for testing at localhost:9736..."
30
- `redis-server #{spec_dir}/redis-test.conf`
27
+ Dir.chdir(spec_dir) do
28
+ `redis-server #{spec_dir}/redis-test.conf`
29
+ end
30
+
31
31
  Resque.redis = '127.0.0.1:9736'
32
32
 
33
- Spec::Runner.configure do |config|
33
+ RSpec.configure do |config|
34
34
  config.before(:all) do
35
35
  ArAsyncCounterCache.resque_job_queue = :testing
36
36
  end
metadata CHANGED
@@ -1,123 +1,83 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: ar-resque-counter-cache
3
- version: !ruby/object:Gem::Version
4
- version: 1.0.2
3
+ version: !ruby/object:Gem::Version
5
4
  prerelease:
5
+ version: 2.0.0
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Aaron Gibralter
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-08-29 00:00:00.000000000Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
12
+
13
+ date: 2011-02-02 00:00:00 -05:00
14
+ default_executable:
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
15
17
  name: activerecord
16
- requirement: &2153626680 !ruby/object:Gem::Requirement
17
- none: false
18
- requirements:
19
- - - ~>
20
- - !ruby/object:Gem::Version
21
- version: 2.3.5
22
- type: :runtime
23
18
  prerelease: false
24
- version_requirements: *2153626680
25
- - !ruby/object:Gem::Dependency
26
- name: resque
27
- requirement: &2153626180 !ruby/object:Gem::Requirement
19
+ requirement: &id001 !ruby/object:Gem::Requirement
28
20
  none: false
29
- requirements:
21
+ requirements:
30
22
  - - ~>
31
- - !ruby/object:Gem::Version
32
- version: '1.10'
23
+ - !ruby/object:Gem::Version
24
+ version: 3.0.0
33
25
  type: :runtime
26
+ version_requirements: *id001
27
+ - !ruby/object:Gem::Dependency
28
+ name: resque
34
29
  prerelease: false
35
- version_requirements: *2153626180
36
- - !ruby/object:Gem::Dependency
37
- name: resque-lock-timeout
38
- requirement: &2153625720 !ruby/object:Gem::Requirement
30
+ requirement: &id002 !ruby/object:Gem::Requirement
39
31
  none: false
40
- requirements:
32
+ requirements:
41
33
  - - ~>
42
- - !ruby/object:Gem::Version
43
- version: 0.3.1
34
+ - !ruby/object:Gem::Version
35
+ version: 1.10.0
44
36
  type: :runtime
37
+ version_requirements: *id002
38
+ - !ruby/object:Gem::Dependency
39
+ name: resque-lock-timeout
45
40
  prerelease: false
46
- version_requirements: *2153625720
47
- - !ruby/object:Gem::Dependency
48
- name: after_commit
49
- requirement: &2153625260 !ruby/object:Gem::Requirement
41
+ requirement: &id003 !ruby/object:Gem::Requirement
50
42
  none: false
51
- requirements:
43
+ requirements:
52
44
  - - ~>
53
- - !ruby/object:Gem::Version
54
- version: 1.0.6
45
+ - !ruby/object:Gem::Version
46
+ version: 0.2.1
55
47
  type: :runtime
56
- prerelease: false
57
- version_requirements: *2153625260
58
- - !ruby/object:Gem::Dependency
48
+ version_requirements: *id003
49
+ - !ruby/object:Gem::Dependency
59
50
  name: rspec
60
- requirement: &2153624800 !ruby/object:Gem::Requirement
61
- none: false
62
- requirements:
63
- - - ~>
64
- - !ruby/object:Gem::Version
65
- version: 1.3.0
66
- type: :development
67
51
  prerelease: false
68
- version_requirements: *2153624800
69
- - !ruby/object:Gem::Dependency
70
- name: sqlite3-ruby
71
- requirement: &2153624340 !ruby/object:Gem::Requirement
52
+ requirement: &id004 !ruby/object:Gem::Requirement
72
53
  none: false
73
- requirements:
54
+ requirements:
74
55
  - - ~>
75
- - !ruby/object:Gem::Version
76
- version: 1.3.3
56
+ - !ruby/object:Gem::Version
57
+ version: 2.4.0
77
58
  type: :development
59
+ version_requirements: *id004
60
+ - !ruby/object:Gem::Dependency
61
+ name: sqlite3-ruby
78
62
  prerelease: false
79
- version_requirements: *2153624340
80
- - !ruby/object:Gem::Dependency
81
- name: SystemTimer
82
- requirement: &2153623880 !ruby/object:Gem::Requirement
63
+ requirement: &id005 !ruby/object:Gem::Requirement
83
64
  none: false
84
- requirements:
65
+ requirements:
85
66
  - - ~>
86
- - !ruby/object:Gem::Version
87
- version: 1.2.2
88
- type: :development
89
- prerelease: false
90
- version_requirements: *2153623880
91
- - !ruby/object:Gem::Dependency
92
- name: rake
93
- requirement: &2153623500 !ruby/object:Gem::Requirement
94
- none: false
95
- requirements:
96
- - - ! '>='
97
- - !ruby/object:Gem::Version
98
- version: '0'
99
- type: :development
100
- prerelease: false
101
- version_requirements: *2153623500
102
- - !ruby/object:Gem::Dependency
103
- name: yajl-ruby
104
- requirement: &2153623040 !ruby/object:Gem::Requirement
105
- none: false
106
- requirements:
107
- - - ! '>='
108
- - !ruby/object:Gem::Version
109
- version: '0'
67
+ - !ruby/object:Gem::Version
68
+ version: 1.3.3
110
69
  type: :development
111
- prerelease: false
112
- version_requirements: *2153623040
113
- description: Increment ActiveRecord's counter cache column asynchronously using Resque
114
- (and resque-lock-timeout).
115
- email:
70
+ version_requirements: *id005
71
+ description: Increment ActiveRecord's counter cache column asynchronously using Resque (and resque-lock-timeout).
72
+ email:
116
73
  - aaron.gibralter@gmail.com
117
74
  executables: []
75
+
118
76
  extensions: []
77
+
119
78
  extra_rdoc_files: []
120
- files:
79
+
80
+ files:
121
81
  - .gitignore
122
82
  - Gemfile
123
83
  - LICENSE
@@ -134,32 +94,35 @@ files:
134
94
  - spec/models.rb
135
95
  - spec/redis-test.conf
136
96
  - spec/spec_helper.rb
97
+ has_rdoc: true
137
98
  homepage: http://github.com/agibralter/ar-resque-counter-cache
138
99
  licenses: []
100
+
139
101
  post_install_message:
140
102
  rdoc_options: []
141
- require_paths:
103
+
104
+ require_paths:
142
105
  - lib
143
- required_ruby_version: !ruby/object:Gem::Requirement
106
+ required_ruby_version: !ruby/object:Gem::Requirement
144
107
  none: false
145
- requirements:
146
- - - ! '>='
147
- - !ruby/object:Gem::Version
148
- version: '0'
149
- required_rubygems_version: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - ">="
110
+ - !ruby/object:Gem::Version
111
+ version: "0"
112
+ required_rubygems_version: !ruby/object:Gem::Requirement
150
113
  none: false
151
- requirements:
152
- - - ! '>='
153
- - !ruby/object:Gem::Version
154
- version: '0'
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: "0"
155
118
  requirements: []
119
+
156
120
  rubyforge_project: ar-resque-counter-cache
157
- rubygems_version: 1.8.6
121
+ rubygems_version: 1.5.0
158
122
  signing_key:
159
123
  specification_version: 3
160
- summary: Increment ActiveRecord's counter cache column asynchronously using Resque
161
- (and resque-lock-timeout).
162
- test_files:
124
+ summary: Increment ActiveRecord's counter cache column asynchronously using Resque (and resque-lock-timeout).
125
+ test_files:
163
126
  - spec/ar_resque_counter_cache/active_record_spec.rb
164
127
  - spec/integration_spec.rb
165
128
  - spec/models.rb