Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Rails 7.2 #2999

Merged
merged 10 commits into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ jobs:
rails:
- "7.0"
- "7.1"
- "7.2"
ruby:
- "3.0"
- "3.1"
- "3.2"
- "3.3"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Install Ruby and gems
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.0"
ruby-version: "3.1"
bundler-cache: true
rubygems: "latest"
- name: Lint Ruby files
Expand Down
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require: standard

AllCops:
TargetRubyVersion: 3.0
TargetRubyVersion: 3.1

inherit_gem:
standard: config/base.yml
2 changes: 1 addition & 1 deletion .standard.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
parallel: true
ruby_version: 3.0
ruby_version: 3.1
ignore:
- "spec/dummy/**/*"
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ source "https://rubygems.org"

gemspec

rails_version = ENV.fetch("RAILS_VERSION", "7.1")
rails_version = ENV.fetch("RAILS_VERSION", "7.2")
gem "rails", "~> #{rails_version}.0"

if ENV["DB"].nil? || ENV["DB"] == "sqlite"
Expand Down
9 changes: 5 additions & 4 deletions alchemy_cms.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Gem::Specification.new do |gem|
gem.summary = "A powerful, userfriendly and flexible CMS for Rails"
gem.description = "Alchemy is a powerful, userfriendly and flexible Rails CMS."
gem.requirements << "ImageMagick (libmagick), v6.6 or greater."
gem.required_ruby_version = ">= 3.0.0"
gem.required_ruby_version = ">= 3.1.0"
gem.license = "BSD-3-Clause"
gem.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^spec/|bun\.lockdb|package\.json|^\.}) }
gem.require_paths = ["lib"]
Expand All @@ -29,14 +29,15 @@ Gem::Specification.new do |gem|
activesupport
railties
].each do |rails_gem|
gem.add_runtime_dependency rails_gem, [">= 7.0", "< 7.2"]
gem.add_runtime_dependency rails_gem, [">= 7.0", "< 7.3"]
end

gem.add_runtime_dependency "active_model_serializers", ["~> 0.10.14"]
gem.add_runtime_dependency "acts_as_list", [">= 0.3", "< 2"]
gem.add_runtime_dependency "awesome_nested_set", ["~> 3.1"]
gem.add_runtime_dependency "awesome_nested_set", ["~> 3.1", ">= 3.7.0"]
gem.add_runtime_dependency "cancancan", [">= 2.1", "< 4.0"]
gem.add_runtime_dependency "coffee-rails", [">= 4.0", "< 6.0"]
gem.add_runtime_dependency "csv", ["~> 3.3"]
gem.add_runtime_dependency "dragonfly", ["~> 1.4"]
gem.add_runtime_dependency "dragonfly_svg", ["~> 0.0.4"]
gem.add_runtime_dependency "gutentag", ["~> 2.2", ">= 2.2.1"]
Expand All @@ -58,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", [">= 4.0.0.beta2"]
gem.add_development_dependency "rspec-rails", ["~> 6.1"]
gem.add_development_dependency "simplecov", ["~> 0.20"]
gem.add_development_dependency "selenium-webdriver", ["~> 4.10"]
gem.add_development_dependency "webmock", ["~> 3.3"]
Expand Down
4 changes: 2 additions & 2 deletions app/helpers/alchemy/base_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ def render_icon(icon_name, options = {})
# <p>Caution! This is a warning!</p>
# <% end %>
#
def render_message(type = :info, msg = nil, &blk)
render Alchemy::Admin::Message.new(msg || capture(&blk), type: type)
def render_message(type = :info, msg = nil, &)
render Alchemy::Admin::Message.new(msg || capture(&), type: type)
end

# Checks if the given argument is a String or a Page object.
Expand Down
4 changes: 2 additions & 2 deletions app/helpers/alchemy/pages_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ def render_page_layout
#
# renders +app/views/alchemy/site_layouts/_default_site.html.erb+ for the site named "Default Site".
#
def render_site_layout(&block)
render current_alchemy_site, &block
def render_site_layout(&)
render(current_alchemy_site, &)
rescue ActionView::MissingTemplate => error
error_or_warning(error, "Site layout for #{current_alchemy_site.try(:name)} not found. Please run `rails g alchemy:site_layouts`")
end
Expand Down
4 changes: 2 additions & 2 deletions app/models/alchemy/elements_repository.rb
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ def children_of(parent)
self.class.new(select { |e| e.parent_element_id == parent.id })
end

def each(&blk)
elements.each(&blk)
def each(&)
elements.each(&)
end

private
Expand Down
4 changes: 2 additions & 2 deletions lib/alchemy/test_support/capybara_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ def click_icon(name)

private

def within_entire_page(&block)
within(:xpath, "//body", &block)
def within_entire_page(&)
within(:xpath, "//body", &)
end

def find_label_by_text(text)
Expand Down
5 changes: 2 additions & 3 deletions spec/components/alchemy/admin/resource/action_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@

require "rails_helper"

CustomResource = Struct.new(:name, :description)

RSpec.describe Alchemy::Admin::Resource::Action, type: :component do
let(:name) { nil }
let(:tooltip) { nil }
let(:block) { lambda { |item| "Foo" } }
let(:resource) { CustomResource.new("Foo", "Bar") }
let(:custom_resource) { Struct.new(:name, :description) }
let(:resource) { custom_resource.new("Foo", "Bar") }
let(:component) { described_class.new(name, tooltip, &block) }

subject(:render) do
Expand Down
5 changes: 2 additions & 3 deletions spec/components/alchemy/admin/resource/cell_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@

require "rails_helper"

CustomResource = Struct.new(:name, :description)

RSpec.describe Alchemy::Admin::Resource::Cell, type: :component do
let(:css_classes) { "foo bar" }
let(:block) { lambda { |item| "Foo" } }
let(:resource) { CustomResource.new("Foo", "Bar") }
let(:custom_resource) { Struct.new(:name, :description) }
let(:resource) { custom_resource.new("Foo", "Bar") }
let(:component) { described_class.new(css_classes, &block) }

subject(:render) do
Expand Down
8 changes: 4 additions & 4 deletions spec/components/alchemy/admin/resource/table_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

require "rails_helper"

CustomResource = Struct.new(:name, :description)

RSpec.describe Alchemy::Admin::Resource::Table, type: :component do
let(:collection) { [] }
let(:component) { described_class.new(collection) }
Expand All @@ -15,10 +13,12 @@
end

context "with data" do
let(:custom_resource) { Struct.new(:name, :description) }

let(:collection) {
[
CustomResource.new("Foo", "Awesome description"),
CustomResource.new("Bar", "Another description")
custom_resource.new("Foo", "Awesome description"),
custom_resource.new("Bar", "Another description")
]
}

Expand Down
14 changes: 7 additions & 7 deletions spec/dummy/app/models/event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ class Event < ActiveRecord::Base
validates_presence_of :name
belongs_to :location

enum event_type: {
enum :event_type, {
expo: 0,
workshop: 1,
workshop: 1
}

before_destroy :abort_if_name_is_undestructible

scope :starting_today, -> { where(starts_at: Time.current.at_midnight..Date.tomorrow.at_midnight) }
scope :future, -> { where("starts_at > ?", Date.tomorrow.at_midnight) }
scope :by_location_name, ->(name) { joins(:location).where(locations: { name: name }) }
scope :by_location_name, ->(name) { joins(:location).where(locations: {name: name}) }

def self.ransackable_attributes(*)
[
Expand All @@ -26,20 +26,20 @@ def self.ransackable_attributes(*)

def self.alchemy_resource_relations
{
location: { attr_method: "name", attr_type: "string" },
location: {attr_method: "name", attr_type: "string"}
}
end

def self.alchemy_resource_filters
[
{
name: :start,
values: %w(starting_today future),
values: %w[starting_today future]
},
{
name: :by_location_name,
values: Location.distinct.pluck(:name),
},
values: Location.distinct.pluck(:name)
}
]
end

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.0
config.load_defaults ENV["RAILS_VERSION"] || 7.2
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.1].define(version: 2024_04_11_155901) do
ActiveRecord::Schema[7.2].define(version: 2024_04_11_155901) do
create_table "alchemy_attachments", force: :cascade do |t|
t.string "name"
t.string "file_name"
Expand Down
Loading