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

Add rails release details to the rails releases table #89

Merged
merged 4 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
10 changes: 10 additions & 0 deletions app/models/rails_release.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,16 @@ def earlier?
!self.class.latest_major.exists?(id: self)
end

def self.print_all
all.each do |release|
puts "# #{release}"

puts "Minimum ruby version: #{release.minimum_ruby_version}"
puts "Minimum bundler version: #{release.minimum_bundler_version}"
puts "Minimum rubygems version: #{release.minimum_rubygems_version}"
end
end

def compatible_ruby_version
if version
Gem::Version.new(version < Gem::Version.new("5") ? "2.7" : RUBY_VERSION)
Expand Down
10 changes: 10 additions & 0 deletions db/migrate/20240930143554_add_columns_to_rails_releases_table.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class AddColumnsToRailsReleasesTable < ActiveRecord::Migration[7.1]
def change
add_column :rails_releases, :minimum_ruby_version, :string
add_column :rails_releases, :minimum_bundler_version, :string
add_column :rails_releases, :minimum_rubygems_version, :string
add_column :rails_releases, :maximum_ruby_version, :string
add_column :rails_releases, :maximum_bundler_version, :string
add_column :rails_releases, :maximum_rubygems_version, :string
end
end
8 changes: 7 additions & 1 deletion db/schema.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

136 changes: 136 additions & 0 deletions lib/tasks/data.rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
# lib/tasks/update_rails_releases.rake
namespace :data do
SUPPORTED_RAILS_VERSIONS = %w(
2.3
3.0
3.1
3.2
4.0
4.1
4.2
5.0
5.1
5.2
6.0
6.1
7.0
7.1
7.2
)

task find_or_create_rails_releases: :environment do
SUPPORTED_RAILS_VERSIONS.each do |version|
RailsRelease.find_or_create_by(version: version)
end
end

desc "Update minimum Ruby versions from Rails 2.3 to 7.2"
task update_rails_releases: :find_or_create_rails_releases do
min_versions = {
"2.3" => {
minimum_ruby_version: "1.8.7",
maximum_ruby_version: "1.9.3",
minimum_bundler_version: "1.17.3",
minimum_rubygems_version: "1.3.6"
},
"3.0" => {
minimum_ruby_version: "1.8.7",
maximum_ruby_version: "1.9.3",
minimum_bundler_version: "1.17.3",
minimum_rubygems_version: "1.3.6"
},
"3.1" => {
minimum_ruby_version: "1.8.7",
maximum_ruby_version: "2.1.0",
minimum_bundler_version: "1.17.3",
minimum_rubygems_version: "1.3.6"
},
"3.2" => {
minimum_ruby_version: "1.8.7",
maximum_ruby_version: "2.1.0",
minimum_bundler_version: "1.17.3",
minimum_rubygems_version: "1.3.6"
},
"4.0" => {
minimum_ruby_version: "1.9.3",
maximum_ruby_version: "2.1.0",
minimum_bundler_version: "1.17.3",
minimum_rubygems_version: "1.3.6"
},
"4.1" => {
minimum_ruby_version: "1.9.3",
maximum_ruby_version: "2.1.0",
minimum_bundler_version: "1.17.3",
minimum_rubygems_version: "1.3.6"
},
"4.2" => {
minimum_ruby_version: "1.9.3",
maximum_ruby_version: "2.2.0",
minimum_bundler_version: "1.17.3",
minimum_rubygems_version: "1.3.6"
},
"5.0" => {
minimum_ruby_version: "2.2.2",
maximum_ruby_version: "2.5.0",
minimum_bundler_version: "1.17.3",
minimum_rubygems_version: "1.3.6"
},
"5.1" => {
minimum_ruby_version: "2.2.2",
maximum_ruby_version: "2.6.0",
minimum_bundler_version: "1.17.3",
minimum_rubygems_version: "1.3.6"
},
"5.2" => {
minimum_ruby_version: "2.2.2",
maximum_ruby_version: "2.7.0",
minimum_bundler_version: "1.17.3",
minimum_rubygems_version: "1.3.6"
},
"6.0" => {
minimum_ruby_version: "2.5.0",
maximum_ruby_version: "3.0.0",
minimum_bundler_version: "2.3.0",
minimum_rubygems_version: "2.5.0"
},
"6.1" => {
minimum_ruby_version: "2.5.0",
maximum_ruby_version: "3.0.0",
minimum_bundler_version: "2.3.0",
minimum_rubygems_version: "2.5.0"
},
"7.0" => {
minimum_ruby_version: "2.7.0",
maximum_ruby_version: "3.1.0",
minimum_bundler_version: "2.4.0",
minimum_rubygems_version: "3.0.1"
},
"7.1" => {
minimum_ruby_version: "2.7.0",
maximum_ruby_version: "3.2.0",
minimum_bundler_version: "2.4.0",
maximum_bundler_version: "2.5.20",
minimum_rubygems_version: "3.0.1"
},
"7.2" => {
minimum_ruby_version: "3.1.0",
maximum_ruby_version: "3.3.0",
minimum_bundler_version: "2.5.20",
maximum_bundler_version: "2.5.20",
minimum_rubygems_version: "3.2.3"
}
}

min_versions.each do |version, attrs|
if rails_release = RailsRelease.find_by(version: version)
puts "Updating Rails Release #{rails_release} with #{attrs}"
rails_release.update_columns(attrs)
puts "Updated Rails Release versions"
else
puts "Skipping Rails Release #{version} as it does not exist"
end
end

puts "Rails Releases updated successfully."
end
end