From d43357711209d3674c24a8e79d4a87d4bcc6a7dc Mon Sep 17 00:00:00 2001 From: Thomas von Deyen Date: Sun, 8 Sep 2024 14:10:21 +0200 Subject: [PATCH] wip: Allow Rails 8.0 --- Gemfile | 6 +++--- alchemy_cms.gemspec | 4 ++-- lib/generators/alchemy/install/install_generator.rb | 6 +++++- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Gemfile b/Gemfile index 319a24ff7f..2e11116588 100644 --- a/Gemfile +++ b/Gemfile @@ -4,11 +4,11 @@ source "https://rubygems.org" gemspec -rails_version = ENV.fetch("RAILS_VERSION", "7.2") -gem "rails", "~> #{rails_version}.0" +rails_version = ENV.fetch("RAILS_VERSION", "8.0") +gem "rails", github: "rails/rails", branch: "main" if ENV["DB"].nil? || ENV["DB"] == "sqlite" - gem "sqlite3", "~> 1.7.0" + gem "sqlite3", "~> 2.0.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 a64c14fa08..0394c055cc 100644 --- a/alchemy_cms.gemspec +++ b/alchemy_cms.gemspec @@ -29,7 +29,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"] @@ -42,7 +42,7 @@ Gem::Specification.new do |gem| gem.add_runtime_dependency "dragonfly_svg", ["~> 0.0.4"] gem.add_runtime_dependency "gutentag", ["~> 2.2", ">= 2.2.1"] gem.add_runtime_dependency "handlebars_assets", ["~> 0.23"] - gem.add_runtime_dependency "importmap-rails", ["~> 1.2", ">= 1.2.1"] + gem.add_runtime_dependency "importmap-rails", ["~> 2.0"] gem.add_runtime_dependency "jquery-rails", ["~> 4.0", ">= 4.0.4"] gem.add_runtime_dependency "kaminari", ["~> 1.1"] gem.add_runtime_dependency "originator", ["~> 3.1"] diff --git a/lib/generators/alchemy/install/install_generator.rb b/lib/generators/alchemy/install/install_generator.rb index 22187ef29d..b09fbe8690 100644 --- a/lib/generators/alchemy/install/install_generator.rb +++ b/lib/generators/alchemy/install/install_generator.rb @@ -66,7 +66,11 @@ def copy_yml_files def install_assets copy_file "all.js", app_vendor_assets_path.join("javascripts", "alchemy", "admin", "all.js") copy_file "custom.css", app_assets_path.join("stylesheets/alchemy/admin/custom.css") - append_to_file Rails.root.join("app/assets/config/manifest.js"), "//= link alchemy/admin/custom.css\n" + if File.exist?(Rails.root.join("app/assets/config/manifest.js")) + append_to_file Rails.root.join("app/assets/config/manifest.js"), "//= link alchemy/admin/custom.css\n" + else + create_file Rails.root.join("app/assets/config/manifest.js"), "//= link alchemy/admin/custom.css\n" + end end def copy_demo_views