-
Notifications
You must be signed in to change notification settings - Fork 529
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
Add support for Rails 8.0 #572
base: core
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
3.2.0 | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,8 @@ sqlite = ENV['SQLITE_VERSION'] | |
if sqlite | ||
gem 'sqlite3', sqlite, platforms: [:ruby] | ||
else | ||
gem 'sqlite3', '~> 1.4', platforms: [:ruby] | ||
# Rails 8.0 requires sqlite3 2.x | ||
gem 'sqlite3', ENV['RAILS']&.start_with?('~> 8') ? '~> 2.1' : '~> 1.4', platforms: [:ruby] | ||
end | ||
|
||
platforms :jruby do | ||
|
@@ -20,7 +21,7 @@ if RUBY_ENGINE == 'rbx' | |
end | ||
end | ||
|
||
rails = ENV['RAILS'] || '~> 6.0.4' | ||
rails = ENV['RAILS'] || '~> 6.1.0' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we could move up the |
||
|
||
if rails == 'edge' | ||
gem 'rails', github: 'rails/rails' | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
require 'active_record' unless defined? ActiveRecord | ||
|
||
if [ActiveRecord::VERSION::MAJOR, ActiveRecord::VERSION::MINOR] == [5, 2] || | ||
ActiveRecord::VERSION::MAJOR > 5 | ||
ActiveRecord::VERSION::MAJOR >= 6 | ||
require 'paranoia/active_record_5_2' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. looking at this change, this looks badly named... do we need this patch for rails 6, 7 and 8 ? |
||
end | ||
|
||
|
@@ -22,7 +22,7 @@ def paranoid? ; true ; end | |
|
||
# If you want to find all records, even those which are deleted | ||
def with_deleted | ||
if ActiveRecord::VERSION::STRING >= "4.1" | ||
if ActiveRecord::VERSION::STRING >= "6.0" | ||
return unscope where: paranoia_column | ||
end | ||
all.tap { |x| x.default_scoped = false } | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#!/bin/bash | ||
|
||
set -e # Exit on error | ||
|
||
# Colors for output | ||
GREEN='\033[0;32m' | ||
RED='\033[0;31m' | ||
NC='\033[0m' # No Color | ||
|
||
# Rails versions to test | ||
RAILS_VERSIONS=( | ||
"~> 6.1.0" | ||
"~> 7.0.0" | ||
"~> 7.1.0" | ||
"~> 7.2.0" | ||
"~> 8.0.0" | ||
) | ||
|
||
# Function to run tests for a specific Rails version | ||
test_rails_version() { | ||
local version=$1 | ||
echo -e "\n${GREEN}Testing Rails ${version}...${NC}" | ||
|
||
# Update Rails and sqlite3 | ||
RAILS="$version" bundle update rails sqlite3 | ||
if [ $? -ne 0 ]; then | ||
echo -e "${RED}Failed to update Rails ${version}${NC}" | ||
return 1 | ||
fi | ||
|
||
# Run tests | ||
RAILS="$version" bundle exec rake test | ||
if [ $? -ne 0 ]; then | ||
echo -e "${RED}Tests failed for Rails ${version}${NC}" | ||
return 1 | ||
fi | ||
|
||
echo -e "${GREEN}Rails ${version} tests passed successfully!${NC}" | ||
return 0 | ||
} | ||
|
||
# Main execution | ||
failed_versions=() | ||
|
||
for version in "${RAILS_VERSIONS[@]}"; do | ||
if ! test_rails_version "$version"; then | ||
failed_versions+=("$version") | ||
fi | ||
done | ||
|
||
# Summary | ||
echo -e "\n${GREEN}Test Summary:${NC}" | ||
if [ ${#failed_versions[@]} -eq 0 ]; then | ||
echo -e "${GREEN}All Rails versions tested successfully!${NC}" | ||
exit 0 | ||
else | ||
echo -e "${RED}Tests failed for the following Rails versions:${NC}" | ||
printf "${RED}%s${NC}\n" "${failed_versions[@]}" | ||
exit 1 | ||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure why we need this file, especially with
.0
...