diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 93bf0c6..693cb7d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,7 +30,7 @@ jobs: strategy: fail-fast: false matrix: - ruby: ["2.7", "3.0", "3.1", "3.2"] + ruby: ["3.0", "3.1", "3.2", "3.3"] name: ${{ matrix.ruby }} diff --git a/.rubocop.yml b/.rubocop.yml index db38c07..5869bb4 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -2,7 +2,7 @@ inherit_gem: rubocop-config-umbrellio: lib/rubocop.yml AllCops: - TargetRubyVersion: 2.7 + TargetRubyVersion: 3.0 Include: - bin/* - lib/**/*.rb diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c1dbce..86d0a43 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,19 @@ # Changelog All notable changes to this project will be documented in this file. +## [6.5.0] - 2024-03-19 +### Added +- Add ruby 3.3 to ci workflow + +### Changed +- Add expiration time for cache used in debouncing sync +- Update dependencies +- Fix rubocop issue +- Drop ruby 2.7 support + +### Removed +- Remove ruby 2.7 from ci workflow + ## [6.4.2] - 2023-11-14 ### Added - Required fields allow accepting empty collections. diff --git a/Gemfile.lock b/Gemfile.lock index 8fa09f1..a53704c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - table_sync (6.4.2) + table_sync (6.5.0) memery rabbit_messaging (~> 0.13) rails @@ -10,67 +10,67 @@ PATH GEM remote: https://rubygems.org/ specs: - actioncable (7.0.7.1) - actionpack (= 7.0.7.1) - activesupport (= 7.0.7.1) + actioncable (7.0.8.1) + actionpack (= 7.0.8.1) + activesupport (= 7.0.8.1) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (7.0.7.1) - actionpack (= 7.0.7.1) - activejob (= 7.0.7.1) - activerecord (= 7.0.7.1) - activestorage (= 7.0.7.1) - activesupport (= 7.0.7.1) + actionmailbox (7.0.8.1) + actionpack (= 7.0.8.1) + activejob (= 7.0.8.1) + activerecord (= 7.0.8.1) + activestorage (= 7.0.8.1) + activesupport (= 7.0.8.1) mail (>= 2.7.1) net-imap net-pop net-smtp - actionmailer (7.0.7.1) - actionpack (= 7.0.7.1) - actionview (= 7.0.7.1) - activejob (= 7.0.7.1) - activesupport (= 7.0.7.1) + actionmailer (7.0.8.1) + actionpack (= 7.0.8.1) + actionview (= 7.0.8.1) + activejob (= 7.0.8.1) + activesupport (= 7.0.8.1) mail (~> 2.5, >= 2.5.4) net-imap net-pop net-smtp rails-dom-testing (~> 2.0) - actionpack (7.0.7.1) - actionview (= 7.0.7.1) - activesupport (= 7.0.7.1) + actionpack (7.0.8.1) + actionview (= 7.0.8.1) + activesupport (= 7.0.8.1) rack (~> 2.0, >= 2.2.4) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (7.0.7.1) - actionpack (= 7.0.7.1) - activerecord (= 7.0.7.1) - activestorage (= 7.0.7.1) - activesupport (= 7.0.7.1) + actiontext (7.0.8.1) + actionpack (= 7.0.8.1) + activerecord (= 7.0.8.1) + activestorage (= 7.0.8.1) + activesupport (= 7.0.8.1) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.0.7.1) - activesupport (= 7.0.7.1) + actionview (7.0.8.1) + activesupport (= 7.0.8.1) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (7.0.7.1) - activesupport (= 7.0.7.1) + activejob (7.0.8.1) + activesupport (= 7.0.8.1) globalid (>= 0.3.6) - activemodel (7.0.7.1) - activesupport (= 7.0.7.1) - activerecord (7.0.7.1) - activemodel (= 7.0.7.1) - activesupport (= 7.0.7.1) - activestorage (7.0.7.1) - actionpack (= 7.0.7.1) - activejob (= 7.0.7.1) - activerecord (= 7.0.7.1) - activesupport (= 7.0.7.1) + activemodel (7.0.8.1) + activesupport (= 7.0.8.1) + activerecord (7.0.8.1) + activemodel (= 7.0.8.1) + activesupport (= 7.0.8.1) + activestorage (7.0.8.1) + actionpack (= 7.0.8.1) + activejob (= 7.0.8.1) + activerecord (= 7.0.8.1) + activesupport (= 7.0.8.1) marcel (~> 1.0) mini_mime (>= 1.1.0) - activesupport (7.0.7.1) + activesupport (7.0.8.1) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) @@ -106,7 +106,7 @@ GEM net-imap net-pop net-smtp - marcel (1.0.2) + marcel (1.0.4) memery (1.5.0) ruby2_keywords (~> 0.0.2) method_source (1.0.0) @@ -123,7 +123,7 @@ GEM net-smtp (0.3.3) net-protocol nio4r (2.5.9) - nokogiri (1.15.4) + nokogiri (1.16.3) mini_portile2 (~> 2.8.2) racc (~> 1.4) parallel (1.23.0) @@ -141,23 +141,23 @@ GEM sneakers (~> 2.0) tainbox racc (1.7.1) - rack (2.2.8) + rack (2.2.8.1) rack-test (2.1.0) rack (>= 1.3) - rails (7.0.7.1) - actioncable (= 7.0.7.1) - actionmailbox (= 7.0.7.1) - actionmailer (= 7.0.7.1) - actionpack (= 7.0.7.1) - actiontext (= 7.0.7.1) - actionview (= 7.0.7.1) - activejob (= 7.0.7.1) - activemodel (= 7.0.7.1) - activerecord (= 7.0.7.1) - activestorage (= 7.0.7.1) - activesupport (= 7.0.7.1) + rails (7.0.8.1) + actioncable (= 7.0.8.1) + actionmailbox (= 7.0.8.1) + actionmailer (= 7.0.8.1) + actionpack (= 7.0.8.1) + actiontext (= 7.0.8.1) + actionview (= 7.0.8.1) + activejob (= 7.0.8.1) + activemodel (= 7.0.8.1) + activerecord (= 7.0.8.1) + activestorage (= 7.0.8.1) + activesupport (= 7.0.8.1) bundler (>= 1.15.0) - railties (= 7.0.7.1) + railties (= 7.0.8.1) rails-dom-testing (2.2.0) activesupport (>= 5.0.0) minitest @@ -165,9 +165,9 @@ GEM rails-html-sanitizer (1.6.0) loofah (~> 2.21) nokogiri (~> 1.14) - railties (7.0.7.1) - actionpack (= 7.0.7.1) - activesupport (= 7.0.7.1) + railties (7.0.8.1) + actionpack (= 7.0.8.1) + activesupport (= 7.0.8.1) method_source rake (>= 12.2) thor (~> 1.0) diff --git a/lib/table_sync/publishing/helpers/debounce.rb b/lib/table_sync/publishing/helpers/debounce.rb index bcab2ff..f84b186 100644 --- a/lib/table_sync/publishing/helpers/debounce.rb +++ b/lib/table_sync/publishing/helpers/debounce.rb @@ -124,7 +124,11 @@ def debounced_sync_time end def cache_next_sync_time - Rails.cache.write(cache_key, next_sync_time) + Rails.cache.write( + cache_key, + next_sync_time, + expires_at: next_sync_time + debounce_time.seconds, + ) end def cache_key diff --git a/lib/table_sync/version.rb b/lib/table_sync/version.rb index 80d4215..73e7bdc 100644 --- a/lib/table_sync/version.rb +++ b/lib/table_sync/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module TableSync - VERSION = "6.4.2" + VERSION = "6.5.0" end diff --git a/spec/publishing/helpers/debounce_spec.rb b/spec/publishing/helpers/debounce_spec.rb index db6db02..82a3bfc 100644 --- a/spec/publishing/helpers/debounce_spec.rb +++ b/spec/publishing/helpers/debounce_spec.rb @@ -63,10 +63,17 @@ def set_cached_sync_time(time) let(:expected_time) { current_time } let(:cached_time) { current_time - 30.seconds } - before { set_cached_sync_time(cached_time) } + context "cache existed" do + before { set_cached_sync_time(cached_time) } - include_examples "skip? returns", false - include_examples "returns correct next_sync_time" + include_examples "skip? returns", false + include_examples "returns correct next_sync_time" + end + + context "cache expired" do + include_examples "skip? returns", false + include_examples "returns correct next_sync_time" + end end context "case 2.2: debounce time not passed yet" do diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 4d1daaa..1b17f25 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -24,7 +24,7 @@ require "rabbit/test_helpers" # NOTE: from rabbit_messaging require "table_sync" -Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].sort.each { |file| require file } +Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |file| require file } TableSync::TestEnv.setup! diff --git a/spec/support/cache_utils.rb b/spec/support/cache_utils.rb index 07d35a8..8743aa1 100644 --- a/spec/support/cache_utils.rb +++ b/spec/support/cache_utils.rb @@ -7,7 +7,7 @@ def read(key) store[key] end - def write(key, value) + def write(key, value, _options = nil) store[key] = value end diff --git a/table_sync.gemspec b/table_sync.gemspec index 0f50a79..cbeda5d 100644 --- a/table_sync.gemspec +++ b/table_sync.gemspec @@ -5,7 +5,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require "table_sync/version" Gem::Specification.new do |spec| - spec.required_ruby_version = ">= 2.7.0" + spec.required_ruby_version = ">= 3.0.0" spec.name = "table_sync" spec.version = TableSync::VERSION