incrdecr_cached_counts 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 933d0e94e08544064f20c36691f4c82fc581a843
4
- data.tar.gz: d60e51a4e1f2f3be7329f41999199ee04c471675
2
+ SHA256:
3
+ metadata.gz: 7cd8f3d3415798c444232ccdee444dc06f963f987958bf8837a1b34df44a0a72
4
+ data.tar.gz: f1929127f81ef136d1a610ad0420d76ebc2d7d289d3abc2155d20303cc7e3e6c
5
5
  SHA512:
6
- metadata.gz: 0e83facc3fb470a922d4dbbca8fbefdfe525a8a03016a49a9e3f244b97f8ca46e4c77a1d46143fd9ad84046c98d5bc1d9c46ab50fbd861f58c15d618947e9c7b
7
- data.tar.gz: c7fb4d8e58784e72ac21884abb76412050a18c6e55520d470b65fc336c49336728ff2677bf2f6b5760c2c6a5bba2ed8683ff44280ebd1967e4982b1125b80352
6
+ metadata.gz: 60dd0c5dfe91552e3f8ec55fdc3bf29fff67c6974e0be6c19d60db593e5c3a96cce9f206b0cc0f07d1749e0b1ac527ffceb1e7139a4bb145f655b56e1484412b
7
+ data.tar.gz: 0fc2644e785fb6e0bb9be3c2ce154b20b9b7e8062f3ec9120830b8331f6b5173b8c53438bdf174ba15c5d39c77d279fd3cff3f92f1320a57ce0f0530b2cff256
@@ -0,0 +1,59 @@
1
+ version: 2
2
+
3
+ jobs:
4
+ build:
5
+ docker:
6
+ - image: circleci/ruby:2.2
7
+ steps:
8
+ - checkout
9
+
10
+ # There's probably a better way of doing this that avoids the repetition and manual
11
+ # deletion of Gemfile.lock.
12
+ - restore_cache:
13
+ key: rails-4.2.9-{{ checksum "Gemfile" }}
14
+ - run:
15
+ name: bundle install
16
+ command: bundle install --path vendor/bundle
17
+ environment:
18
+ ACTIVERECORD_VERSION: 4.2.9
19
+ - save_cache:
20
+ key: rails-4.2.9-{{ checksum "Gemfile" }}
21
+ paths:
22
+ - vendor/bundle
23
+ - run:
24
+ name: Test with Rails 4.2.9
25
+ command: bundle exec rspec
26
+
27
+ - run: rm Gemfile.lock
28
+ - restore_cache:
29
+ key: rails-5.0.6-{{ checksum "Gemfile" }}
30
+ - run:
31
+ name: bundle install
32
+ command: bundle install --path vendor/bundle
33
+ environment:
34
+ ACTIVERECORD_VERSION: 5.0.6
35
+ - save_cache:
36
+ key: rails-5.0.6-{{ checksum "Gemfile" }}
37
+ paths:
38
+ - vendor/bundle
39
+ - restore_cache:
40
+ key: rails-5.0.6-{{ checksum "Gemfile" }}
41
+ - run:
42
+ name: Test with Rails 5.0.6
43
+ command: bundle exec rspec
44
+
45
+ - run: rm Gemfile.lock
46
+ - restore_cache:
47
+ key: rails-5.1.4-{{ checksum "Gemfile" }}
48
+ - run:
49
+ name: bundle install
50
+ command: bundle install --path vendor/bundle
51
+ environment:
52
+ ACTIVERECORD_VERSION: 5.1.4
53
+ - save_cache:
54
+ key: rails-5.1.4-{{ checksum "Gemfile" }}
55
+ paths:
56
+ - vendor/bundle
57
+ - run:
58
+ name: Test with Rails 5.1.4
59
+ command: bundle exec rspec
data/README.rdoc CHANGED
@@ -1,5 +1,7 @@
1
1
  = CachedCounts
2
2
 
3
+ {<img src="http://circleci.com/gh/academia-edu/cached_counts.svg?style=svg" />}[https://circleci.com/gh/academia-edu/cached_counts]
4
+
3
5
  A replacement for Rails' counter caches, using memcached.
4
6
 
5
7
  Caches counts of models in a scope or association in memcached, and keeps the
@@ -19,7 +19,7 @@ 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 "rails", ">= 4.0"
22
+ s.add_dependency "rails", ">= 4.2"
23
23
  s.add_dependency "dalli"
24
24
 
25
25
  s.add_development_dependency "sqlite3"
@@ -1,3 +1,3 @@
1
1
  module CachedCounts
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
data/lib/cached_counts.rb CHANGED
@@ -266,7 +266,7 @@ module CachedCounts
266
266
  end
267
267
 
268
268
  def add_counting_hooks(attribute_name, key_getter, counted_class, options)
269
- increment_hook = "increment_#{attribute_name}_count"
269
+ increment_hook = "increment_#{attribute_name}_count".to_sym
270
270
  counted_class.send :define_method, increment_hook do
271
271
  if (key = instance_exec &key_getter)
272
272
  Rails.cache.increment(
@@ -277,7 +277,7 @@ module CachedCounts
277
277
  end
278
278
  end
279
279
 
280
- decrement_hook = "decrement_#{attribute_name}_count"
280
+ decrement_hook = "decrement_#{attribute_name}_count".to_sym
281
281
  counted_class.send :define_method, decrement_hook do
282
282
  if (key = instance_exec &key_getter)
283
283
  Rails.cache.decrement(
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: incrdecr_cached_counts
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Judd
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-06 00:00:00.000000000 Z
11
+ date: 2019-07-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '4.0'
19
+ version: '4.2'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '4.0'
26
+ version: '4.2'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: dalli
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -130,7 +130,7 @@ executables: []
130
130
  extensions: []
131
131
  extra_rdoc_files: []
132
132
  files:
133
- - ".circleci-matrix.yml"
133
+ - ".circleci/config.yml"
134
134
  - ".gitignore"
135
135
  - ".travis.yml"
136
136
  - ".yardopts"
@@ -138,7 +138,6 @@ files:
138
138
  - MIT-LICENSE
139
139
  - README.rdoc
140
140
  - Rakefile
141
- - circle.yml
142
141
  - incrdecr_cached_counts.gemspec
143
142
  - lib/cached_counts.rb
144
143
  - lib/cached_counts/connection_for.rb
@@ -174,10 +173,17 @@ required_rubygems_version: !ruby/object:Gem::Requirement
174
173
  - !ruby/object:Gem::Version
175
174
  version: '0'
176
175
  requirements: []
177
- rubyforge_project:
178
- rubygems_version: 2.5.1
176
+ rubygems_version: 3.0.3
179
177
  signing_key:
180
178
  specification_version: 4
181
179
  summary: A replacement for Rails' counter caches using memcached (via Dalli)
182
- test_files: []
183
- has_rdoc:
180
+ test_files:
181
+ - spec/caches_count_of_spec.rb
182
+ - spec/caches_count_where_spec.rb
183
+ - spec/database.yml
184
+ - spec/fixtures.rb
185
+ - spec/fixtures/department.rb
186
+ - spec/fixtures/following.rb
187
+ - spec/fixtures/university.rb
188
+ - spec/fixtures/user.rb
189
+ - spec/spec_helper.rb
data/.circleci-matrix.yml DELETED
@@ -1,8 +0,0 @@
1
- env:
2
- - ACTIVERECORD_VERSION=4.2.6
3
- - ACTIVERECORD_VERSION=4.1.15
4
- - ACTIVERECORD_VERSION=4.0.13
5
-
6
- command:
7
- - rm -f Gemfile.lock && ACTIVERECORD_VERSION=$ACTIVERECORD_VERSION bundle
8
- - bundle exec rake
data/circle.yml DELETED
@@ -1,10 +0,0 @@
1
- machine:
2
- ruby:
3
- version: 2.2.3
4
-
5
- dependencies:
6
- pre:
7
- - curl -fsSL https://git.io/v2Ifn | bash
8
-
9
- database:
10
- override: