counter_culture 2.1.4 → 2.2.0

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
  SHA256:
3
- metadata.gz: a7eb651872e81e3ab6f49970fcfc99e578c4faad126137cee4e72d85be233f3e
4
- data.tar.gz: 5cd7b7ea96f8d6b7ab0e90ed803d734d5777506e870f9d7fe319209cf979f88d
3
+ metadata.gz: b5637cebe0df178e1b1f77843a82f82a08405eb9c82aa82ac30af0dd82c88c91
4
+ data.tar.gz: e125436305f7181c9e4aba3d4459b6f83b0f57c41512c20f804d42b9c1f99a79
5
5
  SHA512:
6
- metadata.gz: 7af00566af755096a6eccca05a1426795a05e852ed8a8c792910fc2f6399cf3747bc849b0ffa7725cc691cc22ffa617901d31013ff0be920a6938f5480ae5174
7
- data.tar.gz: a53c2371b56e1d7f83fae4def6c6e9cfa54ad0fa74aad6aec4d5498c2f935b350c1fc692eedee03bff79d730d8aaf195a92ec1a37df7141a0903c528d25a2d57
6
+ metadata.gz: 4fca0f938a9dd9afc261ba9af247c5e9ba5773e16ec3219274cde22d5c02268555e29a39a8d4bc4e403d05b2dba53aa868e119f804dc3f53a644d17b3aee448d
7
+ data.tar.gz: 9de907bfc4baa6746f1072845c66a0ebb6f0c00009a7818ba1b4422a7bf0cd0fbea72544097b85ff3ed1ff262d24e06e5b8c1a95e5237ba97d364394353d78c9
@@ -1,37 +1,16 @@
1
1
  language: ruby
2
2
  rvm:
3
- - "2.2.10"
4
- - "2.3.7"
5
- - "2.4.4"
6
- - "2.5.1"
3
+ - "2.3.8"
4
+ - "2.4.6"
5
+ - "2.5.5"
6
+ - "2.6.2"
7
7
  env:
8
- - 'RAILS_VERSION="~> 3.2.0"'
9
- - 'RAILS_VERSION="~> 4.0.0"'
10
- - 'RAILS_VERSION="~> 4.1.0"'
11
8
  - 'RAILS_VERSION="~> 4.2.0"'
12
9
  - 'RAILS_VERSION="~> 5.0.0"'
13
10
  - 'RAILS_VERSION="= 5.1.4"'
14
11
  - 'RAILS_VERSION="= 5.1.5"'
15
12
  - 'RAILS_VERSION="~> 5.1.5"'
16
13
  - 'RAILS_VERSION="~> 5.2.0"'
17
- matrix:
18
- exclude:
19
- - rvm: "2.2.10"
20
- env: 'RAILS_VERSION="= 5.1.4"'
21
- - rvm: "2.2.10"
22
- env: 'RAILS_VERSION="= 5.1.5"'
23
- - rvm: "2.4.4"
24
- env: 'RAILS_VERSION="~> 3.2.0"'
25
- - rvm: "2.4.4"
26
- env: 'RAILS_VERSION="~> 4.0.0"'
27
- - rvm: "2.4.4"
28
- env: 'RAILS_VERSION="~> 4.1.0"'
29
- - rvm: "2.5.1"
30
- env: 'RAILS_VERSION="~> 3.2.0"'
31
- - rvm: "2.5.1"
32
- env: 'RAILS_VERSION="~> 4.0.0"'
33
- - rvm: "2.5.1"
34
- env: 'RAILS_VERSION="~> 4.1.0"'
35
14
  before_install:
36
15
  - gem uninstall -v '>= 2' -i $(rvm gemdir)@global -ax bundler || true
37
16
  - gem install bundler -v '< 2'
@@ -1,3 +1,13 @@
1
+ ## 2.2.0 (April 9, 2019)
2
+
3
+ Improvements:
4
+ - Add `where` option to `counter_culture_fix_counts` (#250)
5
+ - Add `verbose` option to `counter_culture_fix_counts` (#251)
6
+
7
+ Changes:
8
+ - Dropped support for Ruby 2.2
9
+ - Dropped support for Rails 3.2, 4.0 and 4.1
10
+
1
11
  ## 2.1.4 (January 21, 2019)
2
12
 
3
13
  Improvements:
data/Gemfile CHANGED
@@ -4,8 +4,8 @@ source "https://rubygems.org"
4
4
  # gem "activesupport", ">= 2.3.5"
5
5
 
6
6
  gem "after_commit_action", "~> 1.0"
7
- gem "activerecord", ">= 3.0.0"
8
- gem "activesupport", ">= 3.0.0"
7
+ gem "activerecord", ">= 4.2.0"
8
+ gem "activesupport", ">= 4.2.0"
9
9
 
10
10
  # Add dependencies to develop your gem here.
11
11
  # Include everything needed to run rake, tests, features, etc.
@@ -16,7 +16,7 @@ group :development, :test do
16
16
  when "master"
17
17
  { github: "rails/rails" }
18
18
  when nil, ""
19
- ">= 3.1.0"
19
+ ">= 4.2.0"
20
20
  else
21
21
  ENV["RAILS_VERSION"]
22
22
  end
@@ -27,22 +27,9 @@ group :development, :test do
27
27
  gem "timecop"
28
28
 
29
29
  # To test integrations
30
-
31
- # Both the paranoia and discard integrations require Rails > 4.2
32
- # Actually parsing the resolved rails version is complicated, so
33
- # we're basing this on the incompatible Rails version strings from
34
- # .travis.yml
35
-
36
- unless ['~> 3.2.0', '~> 4.0.0', '~> 4.1.0'].include?(rails)
37
- gem "discard"
38
- gem "paranoia"
39
- end
40
-
41
- if RUBY_VERSION < "2.3.0"
42
- gem "paper_trail", "< 9.0.0"
43
- else
44
- gem "paper_trail"
45
- end
30
+ gem "discard"
31
+ gem "paranoia"
32
+ gem "paper_trail"
46
33
  end
47
34
 
48
35
  group :development do
@@ -52,7 +39,10 @@ group :development do
52
39
  end
53
40
 
54
41
  group :test do
55
- gem "sqlite3"
42
+ # something's going on with sqlite 1.4 that doesn't work with ActiveRecord, see
43
+ # https://stackoverflow.com/questions/54527277/cant-activate-sqlite3-1-3-6-already-activated-sqlite3-1-4-0
44
+ # this seems like a hack but it works, so...
45
+ gem 'sqlite3', '~> 1.3.13'
56
46
  gem "rspec-extra-formatters"
57
47
  gem "database_cleaner", ">= 1.1.1"
58
48
  end
data/README.md CHANGED
@@ -237,6 +237,12 @@ Product.counter_culture_fix_counts only: [[:subcategory, :category]]
237
237
  # will automatically fix counts only on the two-level [:subcategory, :category] relation on Product
238
238
 
239
239
  # :except and :only also accept arrays
240
+
241
+ Product.counter_culture_fix_counts verbose: true
242
+ # prints some logs to STDOUT
243
+
244
+ Product.counter_culture_fix_counts only: :category, where: { categories: { id: 1 } }
245
+ # will automatically fix counts only on the :category with id 1 relation on Product
240
246
  ```
241
247
 
242
248
  The ```counter_culture_fix_counts``` counts method uses batch processing of records to keep the memory consumption low. The default batch size is 1000 but is configurable like so
data/Rakefile CHANGED
@@ -21,6 +21,7 @@ Jeweler::Tasks.new do |gem|
21
21
  gem.description = %Q{counter_culture provides turbo-charged counter caches that are kept up-to-date not just on create and destroy, that support multiple levels of indirection through relationships, allow dynamic column names and that avoid deadlocks by updating in the after_commit callback.}
22
22
  gem.email = "magnus@vonkoeller.de"
23
23
  gem.authors = ["Magnus von Koeller"]
24
+ gem.required_ruby_version = '>= 2.3.0'
24
25
  end
25
26
  Jeweler::RubygemsDotOrgTasks.new
26
27
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.1.4
1
+ 2.2.0
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: counter_culture 2.1.4 ruby lib
5
+ # stub: counter_culture 2.2.0 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "counter_culture".freeze
9
- s.version = "2.1.4"
9
+ s.version = "2.2.0"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib".freeze]
13
13
  s.authors = ["Magnus von Koeller".freeze]
14
- s.date = "2019-01-22"
14
+ s.date = "2019-04-09"
15
15
  s.description = "counter_culture provides turbo-charged counter caches that are kept up-to-date not just on create and destroy, that support multiple levels of indirection through relationships, allow dynamic column names and that avoid deadlocks by updating in the after_commit callback.".freeze
16
16
  s.email = "magnus@vonkoeller.de".freeze
17
17
  s.extra_rdoc_files = [
@@ -122,7 +122,8 @@ Gem::Specification.new do |s|
122
122
  ]
123
123
  s.homepage = "http://github.com/magnusvk/counter_culture".freeze
124
124
  s.licenses = ["MIT".freeze]
125
- s.rubygems_version = "2.7.6".freeze
125
+ s.required_ruby_version = Gem::Requirement.new(">= 2.3.0".freeze)
126
+ s.rubygems_version = "3.0.3".freeze
126
127
  s.summary = "Turbo-charged counter caches for your Rails app.".freeze
127
128
 
128
129
  if s.respond_to? :specification_version then
@@ -130,10 +131,10 @@ Gem::Specification.new do |s|
130
131
 
131
132
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
132
133
  s.add_runtime_dependency(%q<after_commit_action>.freeze, ["~> 1.0"])
133
- s.add_runtime_dependency(%q<activerecord>.freeze, [">= 3.0.0"])
134
- s.add_runtime_dependency(%q<activesupport>.freeze, [">= 3.0.0"])
134
+ s.add_runtime_dependency(%q<activerecord>.freeze, [">= 4.2.0"])
135
+ s.add_runtime_dependency(%q<activesupport>.freeze, [">= 4.2.0"])
135
136
  s.add_development_dependency(%q<rake>.freeze, [">= 0"])
136
- s.add_development_dependency(%q<rails>.freeze, [">= 3.1.0"])
137
+ s.add_development_dependency(%q<rails>.freeze, [">= 4.2.0"])
137
138
  s.add_development_dependency(%q<rspec>.freeze, ["~> 3.0"])
138
139
  s.add_development_dependency(%q<awesome_print>.freeze, [">= 0"])
139
140
  s.add_development_dependency(%q<timecop>.freeze, [">= 0"])
@@ -145,10 +146,10 @@ Gem::Specification.new do |s|
145
146
  s.add_development_dependency(%q<jeweler>.freeze, ["~> 2.1"])
146
147
  else
147
148
  s.add_dependency(%q<after_commit_action>.freeze, ["~> 1.0"])
148
- s.add_dependency(%q<activerecord>.freeze, [">= 3.0.0"])
149
- s.add_dependency(%q<activesupport>.freeze, [">= 3.0.0"])
149
+ s.add_dependency(%q<activerecord>.freeze, [">= 4.2.0"])
150
+ s.add_dependency(%q<activesupport>.freeze, [">= 4.2.0"])
150
151
  s.add_dependency(%q<rake>.freeze, [">= 0"])
151
- s.add_dependency(%q<rails>.freeze, [">= 3.1.0"])
152
+ s.add_dependency(%q<rails>.freeze, [">= 4.2.0"])
152
153
  s.add_dependency(%q<rspec>.freeze, ["~> 3.0"])
153
154
  s.add_dependency(%q<awesome_print>.freeze, [">= 0"])
154
155
  s.add_dependency(%q<timecop>.freeze, [">= 0"])
@@ -161,10 +162,10 @@ Gem::Specification.new do |s|
161
162
  end
162
163
  else
163
164
  s.add_dependency(%q<after_commit_action>.freeze, ["~> 1.0"])
164
- s.add_dependency(%q<activerecord>.freeze, [">= 3.0.0"])
165
- s.add_dependency(%q<activesupport>.freeze, [">= 3.0.0"])
165
+ s.add_dependency(%q<activerecord>.freeze, [">= 4.2.0"])
166
+ s.add_dependency(%q<activesupport>.freeze, [">= 4.2.0"])
166
167
  s.add_dependency(%q<rake>.freeze, [">= 0"])
167
- s.add_dependency(%q<rails>.freeze, [">= 3.1.0"])
168
+ s.add_dependency(%q<rails>.freeze, [">= 4.2.0"])
168
169
  s.add_dependency(%q<rspec>.freeze, ["~> 3.0"])
169
170
  s.add_dependency(%q<awesome_print>.freeze, [">= 0"])
170
171
  s.add_dependency(%q<timecop>.freeze, [">= 0"])
@@ -81,7 +81,7 @@ module CounterCulture
81
81
  next if options[:exclude] && options[:exclude].include?(counter.relation)
82
82
  next if options[:only] && !options[:only].include?(counter.relation)
83
83
 
84
- reconciler = CounterCulture::Reconciler.new(counter, options.slice(:skip_unsupported, :batch_size, :touch))
84
+ reconciler = CounterCulture::Reconciler.new(counter, options.slice(:skip_unsupported, :batch_size, :touch, :where, :verbose))
85
85
  reconciler.reconcile!
86
86
  reconciler.changes
87
87
  end.compact
@@ -67,6 +67,7 @@ module CounterCulture
67
67
  end
68
68
 
69
69
  def perform
70
+ log "Performing reconciling of #{counter.model}##{counter.relation.to_sentence}.\n"
70
71
  # if we're provided a custom set of column names with conditions, use them; just use the
71
72
  # column name otherwise
72
73
  # which class does this relation ultimately point to? that's where we have to start
@@ -97,16 +98,22 @@ module CounterCulture
97
98
  # instances and we try to load all their counts at once
98
99
  batch_size = options.fetch(:batch_size, CounterCulture.config.batch_size)
99
100
 
101
+ counts_query = counts_query.where(options[:where])
102
+
100
103
  counts_query.group(full_primary_key(relation_class)).find_in_batches(batch_size: batch_size) do |records|
101
104
  # now iterate over all the models and see whether their counts are right
102
105
  update_count_for_batch(column_name, records)
103
106
  end
104
107
  end
108
+ log "\n"
109
+ log "Finished reconciling of #{counter.model}##{counter.relation.to_sentence}.\n"
105
110
  end
106
111
 
107
112
  private
108
113
 
109
114
  def update_count_for_batch(column_name, records)
115
+ log "."
116
+
110
117
  ActiveRecord::Base.transaction do
111
118
  records.each do |record|
112
119
  count = record.read_attribute('count') || 0
@@ -132,6 +139,16 @@ module CounterCulture
132
139
  end
133
140
  end
134
141
 
142
+ def log(message)
143
+ return unless log?
144
+
145
+ Rails.logger.info(message)
146
+ end
147
+
148
+ def log?
149
+ options[:verbose] && Rails.logger
150
+ end
151
+
135
152
  # keep track of what we fixed, e.g. for a notification email
136
153
  def track_change(record, column_name, count)
137
154
  @changes_holder << {
@@ -1319,8 +1319,6 @@ describe "CounterCulture" do
1319
1319
  end
1320
1320
 
1321
1321
  it "should work correctly with string keys" do
1322
- skip("Unsupported in this version of Rails") if Rails.version < "4.0.0"
1323
-
1324
1322
  string_id = HasStringId.create(id: "1")
1325
1323
  string_id2 = HasStringId.create(id: "abc")
1326
1324
 
@@ -1359,6 +1357,28 @@ describe "CounterCulture" do
1359
1357
  expect { Category.counter_culture_fix_counts }.to raise_error "No counter cache defined on Category"
1360
1358
  end
1361
1359
 
1360
+ it "should log if verbose option is true" do
1361
+ logger = Rails.logger
1362
+ io = StringIO.new
1363
+ io_logger = Logger.new(io)
1364
+ Rails.logger = io_logger
1365
+
1366
+ # first, clean up
1367
+ SimpleDependent.delete_all
1368
+ SimpleMain.delete_all
1369
+
1370
+ main = SimpleMain.create
1371
+ 3.times { main.simple_dependents.create }
1372
+
1373
+ SimpleDependent.counter_culture_fix_counts :batch_size => A_BATCH, verbose: true
1374
+
1375
+ expect(io.string).to include(
1376
+ "Performing reconciling of SimpleDependent#simple_main.")
1377
+ expect(io.string).to include(
1378
+ "Finished reconciling of SimpleDependent#simple_main.")
1379
+ Rails.logger = logger
1380
+ end
1381
+
1362
1382
  MANY = CI_TEST_RUN ? 1000 : 20
1363
1383
  A_FEW = CI_TEST_RUN ? 50: 10
1364
1384
  A_BATCH = CI_TEST_RUN ? 100: 10
@@ -1378,6 +1398,19 @@ describe "CounterCulture" do
1378
1398
  SimpleDependent.counter_culture_fix_counts :batch_size => A_BATCH
1379
1399
  end
1380
1400
 
1401
+ it "should correctly fix the counter caches with conditionals" do
1402
+ updated = SimpleMain.create
1403
+ updated.simple_dependents.create
1404
+ not_updated = SimpleMain.create
1405
+ not_updated.simple_dependents.create
1406
+ SimpleMain.all.update_all simple_dependents_count: 3
1407
+
1408
+ SimpleDependent.counter_culture_fix_counts only: :simple_main, where: { simple_mains: { id: updated.id } }
1409
+
1410
+ expect(updated.reload.simple_dependents_count).to eq(1)
1411
+ expect(not_updated.reload.simple_dependents_count).to eq(3)
1412
+ end
1413
+
1381
1414
  it "should correctly fix the counter caches with thousands of records" do
1382
1415
  # first, clean up
1383
1416
  SimpleDependent.delete_all
@@ -1562,8 +1595,6 @@ describe "CounterCulture" do
1562
1595
  end
1563
1596
 
1564
1597
  it "should use primary key on counted records table correctly when fixing counts" do
1565
- skip("Unsupported in this version of Rails") if Rails.version < "4.0.0"
1566
-
1567
1598
  subcateg = Subcateg.create :subcat_id => Subcateg::SUBCAT_1
1568
1599
  post = Post.new
1569
1600
  post.subcateg = subcateg
@@ -1580,8 +1611,6 @@ describe "CounterCulture" do
1580
1611
  end
1581
1612
 
1582
1613
  it "should use multi-level relation primary key on counter destination table correctly when fixing counts" do
1583
- skip("Unsupported in this version of Rails") if Rails.version < "4.0.0"
1584
-
1585
1614
  categ = Categ.create :cat_id => Categ::CAT_1
1586
1615
  subcateg = Subcateg.new :subcat_id => Subcateg::SUBCAT_1
1587
1616
  subcateg.categ = categ
@@ -1732,7 +1761,6 @@ describe "CounterCulture" do
1732
1761
 
1733
1762
  describe "when using discard for soft deletes" do
1734
1763
  it "works" do
1735
- skip("Unsupported in this version of Rails") if Rails.version < "4.2.0"
1736
1764
  company = Company.create!
1737
1765
  expect(company.soft_delete_discards_count).to eq(0)
1738
1766
  sd = SoftDeleteDiscard.create!(company_id: company.id)
@@ -1753,7 +1781,6 @@ describe "CounterCulture" do
1753
1781
  end
1754
1782
 
1755
1783
  it "runs destroy callback only once" do
1756
- skip("Unsupported in this version of Rails") if Rails.version < "4.2.0"
1757
1784
 
1758
1785
  company = Company.create!
1759
1786
  sd = SoftDeleteDiscard.create!(company_id: company.id)
@@ -1768,8 +1795,6 @@ describe "CounterCulture" do
1768
1795
  end
1769
1796
 
1770
1797
  it "runs restore callback only once" do
1771
- skip("Unsupported in this version of Rails") if Rails.version < "4.2.0"
1772
-
1773
1798
  company = Company.create!
1774
1799
  sd = SoftDeleteDiscard.create!(company_id: company.id)
1775
1800
 
@@ -1787,8 +1812,6 @@ describe "CounterCulture" do
1787
1812
 
1788
1813
  describe "when calling hard-destroy" do
1789
1814
  it "does not run destroy callback for discarded records" do
1790
- skip("Unsupported in this version of Rails") if Rails.version < "4.2.0"
1791
-
1792
1815
  company = Company.create!
1793
1816
  sd = SoftDeleteDiscard.create!(company_id: company.id)
1794
1817
 
@@ -1802,8 +1825,6 @@ describe "CounterCulture" do
1802
1825
  end
1803
1826
 
1804
1827
  it "runs destroy callback for undiscarded records" do
1805
- skip("Unsupported in this version of Rails") if Rails.version < "4.2.0"
1806
-
1807
1828
  company = Company.create!
1808
1829
  sd = SoftDeleteDiscard.create!(company_id: company.id)
1809
1830
 
@@ -1817,8 +1838,6 @@ describe "CounterCulture" do
1817
1838
  describe "dynamic column names with totaling instead of counting" do
1818
1839
  describe 'when updating discarded records' do
1819
1840
  it 'does not update sum' do
1820
- skip("Unsupported in this version of Rails") if Rails.version < "4.2.0"
1821
-
1822
1841
  company = Company.create!
1823
1842
  sd = SoftDeleteDiscard.create!(company_id: company.id, value: 5)
1824
1843
 
@@ -1834,8 +1853,6 @@ describe "CounterCulture" do
1834
1853
 
1835
1854
  describe 'when updating undiscarded records' do
1836
1855
  it 'updates sum' do
1837
- skip("Unsupported in this version of Rails") if Rails.version < "4.2.0"
1838
-
1839
1856
  company = Company.create!
1840
1857
  sd = SoftDeleteDiscard.create!(company_id: company.id, value: 5)
1841
1858
 
@@ -1850,7 +1867,6 @@ describe "CounterCulture" do
1850
1867
 
1851
1868
  describe "when using paranoia for soft deletes" do
1852
1869
  it "works" do
1853
- skip("Unsupported in this version of Rails") if Rails.version < "4.2.0"
1854
1870
  company = Company.create!
1855
1871
  expect(company.soft_delete_paranoia_count).to eq(0)
1856
1872
  sd = SoftDeleteParanoia.create!(company_id: company.id)
@@ -1871,8 +1887,6 @@ describe "CounterCulture" do
1871
1887
  end
1872
1888
 
1873
1889
  it "runs destroy callback only once" do
1874
- skip("Unsupported in this version of Rails") if Rails.version < "4.2.0"
1875
-
1876
1890
  company = Company.create!
1877
1891
  sd = SoftDeleteParanoia.create!(company_id: company.id)
1878
1892
 
@@ -1886,8 +1900,6 @@ describe "CounterCulture" do
1886
1900
  end
1887
1901
 
1888
1902
  it "runs restore callback only once" do
1889
- skip("Unsupported in this version of Rails") if Rails.version < "4.2.0"
1890
-
1891
1903
  company = Company.create!
1892
1904
  sd = SoftDeleteParanoia.create!(company_id: company.id)
1893
1905
 
@@ -1905,8 +1917,6 @@ describe "CounterCulture" do
1905
1917
 
1906
1918
  describe "when calling paranoia really destroy" do
1907
1919
  it "does not run destroy callback for paranoia destroyed records" do
1908
- skip("Unsupported in this version of Rails") if Rails.version < "4.2.0"
1909
-
1910
1920
  company = Company.create!
1911
1921
  sd = SoftDeleteParanoia.create!(company_id: company.id)
1912
1922
 
@@ -1920,7 +1930,6 @@ describe "CounterCulture" do
1920
1930
  end
1921
1931
 
1922
1932
  it "runs really destroy callback for paranoia undestroyed records" do
1923
- skip("Unsupported in this version of Rails") if Rails.version < "4.2.0"
1924
1933
  company = Company.create!
1925
1934
  expect(company.soft_delete_paranoia_count).to eq(0)
1926
1935
  sd = SoftDeleteParanoia.create!(company_id: company.id)
@@ -1935,8 +1944,6 @@ describe "CounterCulture" do
1935
1944
  describe "dynamic column names with totaling instead of counting" do
1936
1945
  describe 'when updating soft deleted records' do
1937
1946
  it 'does not update sum' do
1938
- skip("Unsupported in this version of Rails") if Rails.version < "4.2.0"
1939
-
1940
1947
  company = Company.create!
1941
1948
  sd = SoftDeleteParanoia.create!(company_id: company.id, value: 5)
1942
1949
 
@@ -1952,8 +1959,6 @@ describe "CounterCulture" do
1952
1959
 
1953
1960
  describe 'when updating undestroyed records' do
1954
1961
  it 'updates sum' do
1955
- skip("Unsupported in this version of Rails") if Rails.version < "4.2.0"
1956
-
1957
1962
  company = Company.create!
1958
1963
  sd = SoftDeleteParanoia.create!(company_id: company.id, value: 5)
1959
1964
 
@@ -2242,7 +2247,6 @@ describe "CounterCulture" do
2242
2247
  private
2243
2248
  def papertrail_supported_here?
2244
2249
  return false if Rails.version < "5.0.0"
2245
- return false if RUBY_VERSION < "2.3.0" && Rails.version >= "5.2.0"
2246
2250
  true
2247
2251
  end
2248
2252
  end
@@ -4,19 +4,22 @@ set -e
4
4
 
5
5
  source /usr/local/share/chruby/chruby.sh
6
6
 
7
- for RUBY_VERSION in "2.2.10" "2.3.7" "2.4.4" "2.5.1"; do
7
+ for RUBY_VERSION in "2.3.8" "2.4.6" "2.5.5" "2.6.2"; do
8
8
  chruby $RUBY_VERSION
9
- for RAILS_VERSION in "~> 3.2.0" "~> 4.0.0" "~> 4.1.0" "~> 4.2.0" "~> 5.0.0" "= 5.1.4" "= 5.1.5" "~> 5.1.6" "~> 5.2.0"; do
9
+ for RAILS_VERSION in "~> 4.2.0" "~> 5.0.0" "= 5.1.4" "= 5.1.5" "~> 5.1.6" "~> 5.2.0"; do
10
10
  echo "Ruby $RUBY_VERSION; Rails $RAILS_VERSION"
11
- if ( [ "$RUBY_VERSION" == "2.2.10" ] && ( [ "$RAILS_VERSION" == "= 5.1.4" ] || [ "$RAILS_VERSION" == "= 5.1.5" ] ) ) || \
12
- ( ( [ "$RUBY_VERSION" == "2.4.4" ] || ( [ "$RUBY_VERSION" == "2.5.1" ] ) && ( [ "$RAILS_VERSION" == "~> 3.2.0" ] || [ "$RAILS_VERSION" == "~> 4.0.0" ] || [ "$RAILS_VERSION" == "~> 4.1.0" ] ) ) ); then
13
- echo "Skipping"
14
- continue
11
+ if ( [ "$RAILS_VERSION" == "~> 4.2.0" ] ); then
12
+ BUNDLE_VERSION='1.17.3'
13
+ else
14
+ BUNDLE_VERSION='2.0.1'
15
15
  fi
16
16
  export RAILS_VERSION
17
- type bundle > /dev/null || gem install bundler
18
- bundle update
19
- bundle exec rspec spec
17
+ gem install bundler -v "$BUNDLE_VERSION"
18
+ if [ -f Gemfile.lock ]; then
19
+ rm Gemfile.lock
20
+ fi
21
+ bundle _"$BUNDLE_VERSION"_ update
22
+ bundle _"$BUNDLE_VERSION"_ exec rspec spec
20
23
  done
21
24
  done
22
25
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: counter_culture
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.4
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Magnus von Koeller
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-01-22 00:00:00.000000000 Z
11
+ date: 2019-04-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: after_commit_action
@@ -30,28 +30,28 @@ dependencies:
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 3.0.0
33
+ version: 4.2.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: 3.0.0
40
+ version: 4.2.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: activesupport
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: 3.0.0
47
+ version: 4.2.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: 3.0.0
54
+ version: 4.2.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: 3.1.0
75
+ version: 4.2.0
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: 3.1.0
82
+ version: 4.2.0
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rspec
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -329,15 +329,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
329
329
  requirements:
330
330
  - - ">="
331
331
  - !ruby/object:Gem::Version
332
- version: '0'
332
+ version: 2.3.0
333
333
  required_rubygems_version: !ruby/object:Gem::Requirement
334
334
  requirements:
335
335
  - - ">="
336
336
  - !ruby/object:Gem::Version
337
337
  version: '0'
338
338
  requirements: []
339
- rubyforge_project:
340
- rubygems_version: 2.7.6
339
+ rubygems_version: 3.0.3
341
340
  signing_key:
342
341
  specification_version: 4
343
342
  summary: Turbo-charged counter caches for your Rails app.