diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 623876d..1630b5c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,6 +2,7 @@ name: Build on: push: + branches: [master] pull_request: jobs: @@ -11,15 +12,15 @@ jobs: strategy: matrix: - ruby-version: ["3.0", "3.1", "3.2"] + ruby-version: ["3.1", "3.2", "3.3"] database: - sqlite - postgresql - mysql gemfile: - Gemfile + - spec/ci/rails71.gemfile - spec/ci/rails70.gemfile - - spec/ci/rails61.gemfile services: postgresql: diff --git a/.ruby-version b/.ruby-version index a3ec5a4..fa7adc7 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -3.2 +3.3.5 diff --git a/CHANGELOG.md b/CHANGELOG.md index 01e1e8d..7a9368c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ version 0.3.0. validates_by_schema uses semantic versioning. +## 0.5.2 - 2024-10-29 + +- Add support for Rails 7.2, drop Ruby 3.0 and Rails 6.1 + ## 0.5.1 - 2023-02-28 - Improve load time to configure validations. diff --git a/Gemfile.lock b/Gemfile.lock index 7f30cf1..75189af 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,75 +1,77 @@ PATH remote: . specs: - validates_by_schema (0.5.1) + validates_by_schema (0.5.2) activerecord (>= 6.0.0) GEM remote: https://rubygems.org/ specs: - actionpack (7.1.3.4) - actionview (= 7.1.3.4) - activesupport (= 7.1.3.4) + actionpack (7.2.1.2) + actionview (= 7.2.1.2) + activesupport (= 7.2.1.2) nokogiri (>= 1.8.5) racc - rack (>= 2.2.4) + rack (>= 2.2.4, < 3.2) rack-session (>= 1.0.1) rack-test (>= 0.6.3) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - actionview (7.1.3.4) - activesupport (= 7.1.3.4) + useragent (~> 0.16) + actionview (7.2.1.2) + activesupport (= 7.2.1.2) builder (~> 3.1) erubi (~> 1.11) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - activemodel (7.1.3.4) - activesupport (= 7.1.3.4) - activerecord (7.1.3.4) - activemodel (= 7.1.3.4) - activesupport (= 7.1.3.4) + activemodel (7.2.1.2) + activesupport (= 7.2.1.2) + activerecord (7.2.1.2) + activemodel (= 7.2.1.2) + activesupport (= 7.2.1.2) timeout (>= 0.4.0) - activesupport (7.1.3.4) + activesupport (7.2.1.2) base64 bigdecimal - concurrent-ruby (~> 1.0, >= 1.0.2) + concurrent-ruby (~> 1.0, >= 1.3.1) connection_pool (>= 2.2.5) drb i18n (>= 1.6, < 2) + logger (>= 1.4.2) minitest (>= 5.1) - mutex_m - tzinfo (~> 2.0) + securerandom (>= 0.3) + tzinfo (~> 2.0, >= 2.0.5) base64 (0.2.0) bigdecimal (3.1.8) - builder (3.2.4) - concurrent-ruby (1.3.1) + builder (3.3.0) + concurrent-ruby (1.3.4) connection_pool (2.4.1) crass (1.0.6) diff-lcs (1.5.1) - docile (1.4.0) + docile (1.4.1) drb (2.2.1) - erubi (1.12.0) - i18n (1.14.5) + erubi (1.13.0) + i18n (1.14.6) concurrent-ruby (~> 1.0) io-console (0.7.2) - irb (1.13.1) + irb (1.14.1) rdoc (>= 4.0.0) reline (>= 0.4.2) - loofah (2.22.0) + logger (1.6.1) + loofah (2.23.1) crass (~> 1.0.2) nokogiri (>= 1.12.0) mini_portile2 (2.8.7) - minitest (5.23.1) - mutex_m (0.2.0) + minitest (5.25.1) mysql2 (0.5.6) - nokogiri (1.16.5) + nokogiri (1.16.7) mini_portile2 (~> 2.8.2) racc (~> 1.4) - pg (1.5.6) + pg (1.5.9) psych (5.1.2) stringio - racc (1.8.0) - rack (3.0.11) + racc (1.8.1) + rack (3.1.8) rack-session (2.0.0) rack (>= 3.0.0) rack-test (2.1.0) @@ -84,54 +86,56 @@ GEM rails-html-sanitizer (1.6.0) loofah (~> 2.21) nokogiri (~> 1.14) - railties (7.1.3.4) - actionpack (= 7.1.3.4) - activesupport (= 7.1.3.4) - irb + railties (7.2.1.2) + actionpack (= 7.2.1.2) + activesupport (= 7.2.1.2) + irb (~> 1.13) rackup (>= 1.0.0) rake (>= 12.2) thor (~> 1.0, >= 1.2.2) zeitwerk (~> 2.6) rake (13.2.1) - rdoc (6.6.3.1) + rdoc (6.7.0) psych (>= 4.0.0) - reline (0.5.7) + reline (0.5.10) io-console (~> 0.5) - rspec-core (3.13.0) + rspec-core (3.13.2) rspec-support (~> 3.13.0) - rspec-expectations (3.13.0) + rspec-expectations (3.13.3) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) - rspec-mocks (3.13.1) + rspec-mocks (3.13.2) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) - rspec-rails (6.1.2) - actionpack (>= 6.1) - activesupport (>= 6.1) - railties (>= 6.1) + rspec-rails (7.0.1) + actionpack (>= 7.0) + activesupport (>= 7.0) + railties (>= 7.0) rspec-core (~> 3.13) rspec-expectations (~> 3.13) rspec-mocks (~> 3.13) rspec-support (~> 3.13) rspec-support (3.13.1) - shoulda-matchers (6.2.0) + securerandom (0.3.1) + shoulda-matchers (6.4.0) activesupport (>= 5.2.0) simplecov (0.22.0) docile (~> 1.1) simplecov-html (~> 0.11) simplecov_json_formatter (~> 0.1) - simplecov-html (0.12.3) + simplecov-html (0.13.1) simplecov-lcov (0.8.0) simplecov_json_formatter (0.1.4) sqlite3 (1.7.3) mini_portile2 (~> 2.8.0) - stringio (3.1.0) - thor (1.3.1) + stringio (3.1.1) + thor (1.3.2) timeout (0.4.1) tzinfo (2.0.6) concurrent-ruby (~> 1.0) - webrick (1.8.1) - zeitwerk (2.6.13) + useragent (0.16.10) + webrick (1.8.2) + zeitwerk (2.6.18) PLATFORMS ruby diff --git a/lib/validates_by_schema.rb b/lib/validates_by_schema.rb index f6d1bc3..2f28239 100644 --- a/lib/validates_by_schema.rb +++ b/lib/validates_by_schema.rb @@ -18,6 +18,9 @@ def validates_by_schema(options = {}) def load_schema! super + # Set flag here to avoid infinite recursion + @schema_loaded = true + # define schema validations lazy to avoid accessing the database # at class load time. define_schema_validations diff --git a/lib/validates_by_schema/version.rb b/lib/validates_by_schema/version.rb index d73695a..6c7eee9 100644 --- a/lib/validates_by_schema/version.rb +++ b/lib/validates_by_schema/version.rb @@ -1,3 +1,3 @@ module ValidatesBySchema - VERSION = '0.5.1' + VERSION = '0.5.2' end diff --git a/spec/ci/rails61.gemfile b/spec/ci/rails71.gemfile similarity index 80% rename from spec/ci/rails61.gemfile rename to spec/ci/rails71.gemfile index 19bc1d9..39082f1 100644 --- a/spec/ci/rails61.gemfile +++ b/spec/ci/rails71.gemfile @@ -5,4 +5,4 @@ gemspec path: '../..' gem 'simplecov', require: false gem 'simplecov-lcov', require: false -gem 'activerecord', '~> 6.1.0' +gem 'activerecord', '~> 7.1.0' diff --git a/spec/support/models/contraption.rb b/spec/support/models/contraption.rb index 857da08..167d97e 100644 --- a/spec/support/models/contraption.rb +++ b/spec/support/models/contraption.rb @@ -1,7 +1,7 @@ require 'widget' class Contraption < Widget - enum kind: %w(one other) + enum :kind, %w(one other) validates_by_schema end