From adff5bfdf386762af4edff43e30cbee212ff5413 Mon Sep 17 00:00:00 2001 From: Thomas von Deyen Date: Sun, 8 Sep 2024 14:10:21 +0200 Subject: [PATCH 1/5] Allow Rails 8.0 --- .github/workflows/build_test.yml | 1 + Gemfile | 4 ++-- alchemy_cms.gemspec | 2 +- spec/dummy/config/application.rb | 2 +- spec/dummy/db/schema.rb | 2 +- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml index 851ba4ac86..b722d8043e 100644 --- a/.github/workflows/build_test.yml +++ b/.github/workflows/build_test.yml @@ -66,6 +66,7 @@ jobs: - "7.0" - "7.1" - "7.2" + - "8.0" ruby: - "3.1" - "3.2" diff --git a/Gemfile b/Gemfile index d5ed225ffe..e0e53dd282 100644 --- a/Gemfile +++ b/Gemfile @@ -4,11 +4,11 @@ source "https://rubygems.org" gemspec -rails_version = ENV.fetch("RAILS_VERSION", "7.2") +rails_version = ENV.fetch("RAILS_VERSION", "8.0") gem "rails", "~> #{rails_version}.0" if ENV["DB"].nil? || ENV["DB"] == "sqlite" - gem "sqlite3", (rails_version == "7.0") ? "~> 1.7.0" : "~> 2.0.0" + gem "sqlite3", (rails_version == "7.0") ? "~> 1.7" : "~> 2.0" end if ENV["DB"] == "mysql" || ENV["DB"] == "mariadb" gem "mysql2", "~> 0.5.1" diff --git a/alchemy_cms.gemspec b/alchemy_cms.gemspec index a8273c018f..90034ea3e5 100644 --- a/alchemy_cms.gemspec +++ b/alchemy_cms.gemspec @@ -33,7 +33,7 @@ Gem::Specification.new do |gem| activesupport railties ].each do |rails_gem| - gem.add_runtime_dependency rails_gem, [">= 7.0", "< 7.3"] + gem.add_runtime_dependency rails_gem, [">= 7.0", "< 8.1"] end gem.add_runtime_dependency "active_model_serializers", ["~> 0.10.14"] diff --git a/spec/dummy/config/application.rb b/spec/dummy/config/application.rb index c7b10e8b29..2ad5b83e81 100644 --- a/spec/dummy/config/application.rb +++ b/spec/dummy/config/application.rb @@ -22,7 +22,7 @@ module Dummy class Application < Rails::Application # Initialize configuration defaults for originally generated Rails version. if config.respond_to?(:load_defaults) - config.load_defaults ENV["RAILS_VERSION"] || 7.2 + config.load_defaults ENV["RAILS_VERSION"] || 8.0 end # Settings in config/environments/* take precedence over those specified here. diff --git a/spec/dummy/db/schema.rb b/spec/dummy/db/schema.rb index 676ff4a484..e76e531dbf 100644 --- a/spec/dummy/db/schema.rb +++ b/spec/dummy/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.2].define(version: 2024_04_11_155901) do +ActiveRecord::Schema[8.0].define(version: 2024_04_11_155901) do create_table "alchemy_attachments", force: :cascade do |t| t.string "name" t.string "file_name" From fab0563acc79802753283e88c34643a41553ca2c Mon Sep 17 00:00:00 2001 From: Thomas von Deyen Date: Sat, 14 Dec 2024 13:27:09 +0100 Subject: [PATCH 2/5] CI: Use Ruby 3.2 to run linter Rails 8.0 (the default Rails we use on CI) needs at least Ruby 3.2. We still support 3.1 and set the linter to check for Ruby 3.1 syntax. --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 160ac82114..884783a9f4 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -15,7 +15,7 @@ jobs: - name: Install Ruby and gems uses: ruby/setup-ruby@v1 with: - ruby-version: "3.1" + ruby-version: "3.2" bundler-cache: true rubygems: "latest" - name: Lint Ruby files From 11e3a550a81710f699f41f62cca176dcd319048c Mon Sep 17 00:00:00 2001 From: Thomas von Deyen Date: Sat, 14 Dec 2024 18:33:58 +0100 Subject: [PATCH 3/5] CI: Skip Rails 8 / Ruby 3.1 builds Rails 8 needs at least Ruby 3.2 --- .github/workflows/build_test.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml index b722d8043e..9c92b1aa5a 100644 --- a/.github/workflows/build_test.yml +++ b/.github/workflows/build_test.yml @@ -76,6 +76,16 @@ jobs: - sqlite - postgresql - mariadb + exclude: + - rails: "8.0" + ruby: "3.1" + database: sqlite + - rails: "8.0" + ruby: "3.1" + database: postgresql + - rails: "8.0" + ruby: "3.1" + database: mariadb env: DB: ${{ matrix.database }} DB_USER: alchemy_user From fb04bb1f9feda0acf66a601ced07b173ab2a91ea Mon Sep 17 00:00:00 2001 From: Thomas von Deyen Date: Sat, 14 Dec 2024 18:55:34 +0100 Subject: [PATCH 4/5] Fix clipboard index route This needs to be defined as member in order to work with Rails 8 --- config/routes.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/routes.rb b/config/routes.rb index 95096ba9b1..7d4daee18e 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -88,7 +88,7 @@ end end - resource :clipboard, only: :index, controller: "clipboard" do + resource :clipboard, only: [], controller: "clipboard" do collection do get :index delete :clear From 6a99e6a8f0761853a2ee948d72f77654864d0f64 Mon Sep 17 00:00:00 2001 From: Thomas von Deyen Date: Fri, 3 Jan 2025 17:38:55 +0100 Subject: [PATCH 5/5] Fix form build spec In Rails 8 the input helper for `