Skip to content

Commit

Permalink
wip: Allow Rails 8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
tvdeyen committed Sep 18, 2024
1 parent 0dfea1e commit 6f3ec38
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 11 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ jobs:
- "7.0"
- "7.1"
- "7.2"
- "main"
ruby:
- "3.1"
- "3.2"
Expand Down
10 changes: 7 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@ source "https://rubygems.org"

gemspec

rails_version = ENV.fetch("RAILS_VERSION", "7.2")
gem "rails", "~> #{rails_version}.0"
rails_version = ENV.fetch("RAILS_VERSION", "main")
if rails_version == "main"
gem "rails", github: "rails/rails", branch: "main"
else
gem "rails", "~> #{rails_version}.0"
end

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"
Expand Down
10 changes: 5 additions & 5 deletions alchemy_cms.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand All @@ -42,14 +42,14 @@ 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"]
gem.add_runtime_dependency "ransack", [">= 1.8", "< 5.0"]
gem.add_runtime_dependency "ransack", ["~> 4.2", "< 5.0"]
gem.add_runtime_dependency "simple_form", [">= 4.0", "< 6"]
gem.add_runtime_dependency "sprockets-rails", [">= 3.5", "< 4"]
gem.add_runtime_dependency "turbo-rails", [">= 1.4", "< 2.1"]
gem.add_runtime_dependency "turbo-rails", ["~> 2.0", "< 2.1"]
gem.add_runtime_dependency "view_component", ["~> 3.0"]

gem.add_development_dependency "capybara", ["~> 3.0"]
Expand All @@ -59,7 +59,7 @@ Gem::Specification.new do |gem|
gem.add_development_dependency "puma", ["~> 6.0"]
gem.add_development_dependency "rails-controller-testing", ["~> 1.0"]
gem.add_development_dependency "rspec-activemodel-mocks", ["~> 1.0"]
gem.add_development_dependency "rspec-rails", ["~> 6.1"]
gem.add_development_dependency "rspec-rails", ["~> 7.0"]
gem.add_development_dependency "simplecov", ["~> 0.20"]
gem.add_development_dependency "selenium-webdriver", ["~> 4.10"]
gem.add_development_dependency "webmock", ["~> 3.3"]
Expand Down
6 changes: 5 additions & 1 deletion lib/generators/alchemy/install/install_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion spec/dummy/config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,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"] == "main" ? 8.0 : ENV.fetch("RAILS_VERSION", 8.0)
end

# Settings in config/environments/* take precedence over those specified here.
Expand Down
2 changes: 1 addition & 1 deletion spec/dummy/db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 6f3ec38

Please sign in to comment.