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

Upgrade to Ruby 3.0.5 #3266

Merged
merged 19 commits into from
Mar 9, 2023
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
2 changes: 1 addition & 1 deletion .github/workflows/mysql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
# Install Ruby and run bundler
- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7.6
ruby-version: '3.0'
bundler-cache: true

# Install Node
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/postgres.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
# Install Ruby and run bundler
- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7.6
ruby-version: '3.0'
bundler-cache: true

# Install Node
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
# Install Ruby and run bundler
- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7.6
ruby-version: '3.0'
bundler-cache: true

# Run the Rubocop linter checks
Expand Down
27 changes: 27 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,37 @@
# Changelog

## v4.1.0

**Note this upgrade is a migration from Ruby v2.7.6 to v3.0.5.** Note that this could have an impact on any customizations you may have made to your fork of this project. Please see https://www.fastruby.io/blog/ruby/upgrades/upgrade-ruby-from-2.7-to-3.0.html for further information on what to check.

### Fixed

- Issue with `@import 'font-awesome-sprockets';` line in `app/assets/stylesheets/application.scss`. Removed that line after referring to the latest font-awesome install/setup guide which no longer includes it.
- Updated places that were incorrectly using keyword args. See [this article](https://makandracards.com/makandra/496481-changes-to-positional-and-keyword-args-in-ruby-3-0) for an overview

### Changed

- Upgrade to Ruby version 3.0.5 [#3225](https://github.com/DMPRoadmap/roadmap/issues/3225)
- Bumped all Github actions to use ruby 3.0
- Cleaned up Gemfile by:
- removing gems that were already commented out
- removed selenium-webdriver and capybara-webmock
- removing version restrictions on: danger, font-awesome-sass, webdrivers
- Cleaned up `spec/rails_helper.rb` and `spec/spec_helper.rb`
- Simplified the `spec/support/capybara.rb` helper to work with the latest version of Capybara and use its built in headless Chrome driver
- Removed `.freeze` from Regex and Range constants since those types are already immutable
- Fixed Rubocop complaint about redundancy of `r.nil? ? nil : r.user`, so changed it to `r&.user` in `app/models/plan.rb`
- Fixed Rubocop complaint about redundant `::` in config.log_formatter = `::Logger::Formatter.new` in `config/environments/production.rb`
- Froze `lib/deprecators/*.rb` constants that were Strings

## v4.0.2

### Added

- Added CHANGELOG.md and Danger Github Action [#3257](https://github.com/DMPRoadmap/roadmap/issues/3257)
- Added validation with custom error message in research_output.rb to ensure a user does not enter a very large value as 'Anticipated file size'. [#3161](https://github.com/DMPRoadmap/roadmap/issues/3161)
- Added popover for org profile page and added explanation for public plan

### Fixed

- Froze mail gem version [#3254](https://github.com/DMPRoadmap/roadmap/issues/3254)
Expand Down
62 changes: 5 additions & 57 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

source 'https://rubygems.org'

ruby '>= 2.7'
ruby '>= 3.0'

# ===========#
# CORE RAILS #
Expand All @@ -17,9 +17,6 @@ gem 'rails', '~> 6.1'
# Analysis of the issue: https://www.theregister.com/2021/03/25/ruby_rails_code/
gem 'mimemagic'

# Use sqlite3 as the database for Active Record
# gem 'sqlite3', '~> 1.4'

# Use Puma as the app server
gem 'puma', group: :puma, require: false

Expand Down Expand Up @@ -50,14 +47,6 @@ gem 'jbuilder'
# Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', require: false

# GEMS ADDED TO HELP HANDLE RAILS MIGRATION FROM 3.x to 4.2
# THESE GEMS HELP SUPPORT DEPRACATED FUNCTIONALITY AND WILL LOSE SUPPORT IN
# FUTURE VERSIONS WE SHOULD CONSIDER BRINGING THE CODE UP TO DATE INSTEAD

# A set of Rails responders to dry up your application
# (http://github.com/plataformatec/responders)
# gem "responders"

# ============== #
# ERROR HANDLING #
# ============== #
Expand Down Expand Up @@ -165,19 +154,12 @@ gem 'api-pagination'
gem 'sassc-rails'

# Font-Awesome SASS (https://github.com/FortAwesome/font-awesome-sass)
gem 'font-awesome-sass', '~> 5'

# Use webpack to manage app-like JavaScript modules in Rails
# (https://github.com/rails/webpacker)
# gem "webpacker"
gem 'font-awesome-sass'

# Parse CSS and add vendor prefixes to CSS rules using values from the Can
# I Use website. (https://github.com/ai/autoprefixer-rails)
gem 'autoprefixer-rails'

# Minimal embedded v8 for Ruby (https://github.com/discourse/mini_racer)
# gem "mini_racer"

# ========= #
# EXPORTING #
# ========= #
Expand Down Expand Up @@ -250,18 +232,10 @@ group :test do
# Guard keeps an eye on your file modifications (https://github.com/guard/guard)
gem 'guard'

# Guard gem for RSpec (https://github.com/guard/guard-rspec)
# gem 'guard-rspec'

# Library for stubbing HTTP requests in Ruby.
# (http://github.com/bblimke/webmock)
gem 'webmock'

# Code coverage for Ruby 1.9+ with a powerful configuration library and
# automatic merging of coverage across test suites
# (http://github.com/colszowka/simplecov)
# gem 'simplecov', require: false

# Strategies for cleaning databases. Can be used to ensure a clean state
# for testing. (http://github.com/DatabaseCleaner/database_cleaner)
gem 'database_cleaner', require: false
Expand All @@ -275,17 +249,9 @@ group :test do

# Adds support for Capybara system testing and selenium driver
gem 'capybara'
gem 'selenium-webdriver'
# Easy installation and use of web drivers to run system tests with browsers
gem 'webdrivers', '~> 5.2'

# Automatically create snapshots when Cucumber steps fail with Capybara
# and Rails (http://github.com/mattheworiordan/capybara-screenshot)
# gem 'capybara-screenshot'

# Browser integration tests are expensive. We can mock external requests
# in our tests, but once a browser is involved, we lose control.
gem 'capybara-webmock'
# Easy installation and use of web drivers to run system tests with browsers
gem 'webdrivers'

# RSpec::CollectionMatchers lets you express expected outcomes on
# collections of an object in an example.
Expand All @@ -299,7 +265,7 @@ group :test do
gem 'rails-controller-testing'

# automating code review
gem 'danger', '~> 9.0', require: false
gem 'danger'
end

group :ci, :development do
Expand All @@ -318,24 +284,6 @@ group :ci, :development do
# RuboCop rules for detecting and autocorrecting undecorated strings for i18n
# (gettext and rails-i18n)
gem 'rubocop-i18n'

# A collection of RuboCop cops to check for performance optimizations in Ruby code.
# gem 'rubocop-performance'

# Automatic Rails code style checking tool. A RuboCop extension focused on enforcing
# Rails best practices and coding conventions.
# gem 'rubocop-rails'

# A RuboCop plugin for Rake tasks
# gem 'rubocop-rake'

# Code style checking for RSpec files. A plugin for the RuboCop code style enforcing
# & linting tool.
# gem 'rubocop-rspec'

# Thread-safety checks via static analysis. A plugin for the RuboCop code style
# enforcing & linting tool.
# gem 'rubocop-thread_safety'
end

group :development do
Expand Down
47 changes: 22 additions & 25 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ GEM
rack-test (>= 0.6.3)
regexp_parser (>= 1.5, < 3.0)
xpath (~> 3.2)
capybara-webmock (0.1.0)
claide (1.1.0)
claide-plugins (0.9.2)
cork
Expand Down Expand Up @@ -164,14 +163,14 @@ GEM
ecma-re-validator (0.4.0)
regexp_parser (~> 2.2)
erubi (1.12.0)
excon (0.98.0)
excon (0.99.0)
execjs (2.8.1)
factory_bot (6.2.1)
activesupport (>= 5.0.0)
factory_bot_rails (6.2.0)
factory_bot (~> 6.2.0)
railties (>= 5.0.0)
faker (3.1.0)
faker (3.1.1)
i18n (>= 1.8.11, < 2)
faraday (2.7.4)
faraday-net_http (>= 2.0, < 3.1)
Expand All @@ -181,7 +180,7 @@ GEM
faraday-net_http (3.0.2)
ffi (1.15.5)
flag_shih_tzu (0.3.23)
fog-aws (3.16.0)
fog-aws (3.17.0)
fog-core (~> 2.1)
fog-json (~> 1.1)
fog-xml (~> 0.1)
Expand All @@ -196,8 +195,8 @@ GEM
fog-xml (0.1.4)
fog-core
nokogiri (>= 1.5.11, < 2.0.0)
font-awesome-sass (5.15.1)
sassc (>= 1.11)
font-awesome-sass (6.3.0)
sassc (~> 2.0)
formatador (1.1.0)
forwardable (1.3.3)
fuubar (2.5.1)
Expand Down Expand Up @@ -330,7 +329,7 @@ GEM
options (2.3.2)
orm_adapter (0.5.0)
parallel (1.22.1)
parser (3.2.0.0)
parser (3.2.1.0)
ast (~> 2.4.1)
pg (1.4.5)
prime (0.1.2)
Expand All @@ -343,7 +342,7 @@ GEM
coderay (~> 1.1)
method_source (~> 1.0)
public_suffix (5.0.1)
puma (6.0.2)
puma (6.1.0)
nio4r (~> 2.0)
pundit (2.3.0)
activesupport (>= 3.0.0)
Expand Down Expand Up @@ -397,15 +396,15 @@ GEM
rchardet (1.8.0)
recaptcha (5.12.3)
json
regexp_parser (2.6.2)
responders (3.0.1)
actionpack (>= 5.0)
railties (>= 5.0)
regexp_parser (2.7.0)
responders (3.1.0)
actionpack (>= 5.2)
railties (>= 5.2)
rexml (3.2.5)
rollbar (3.4.0)
rspec-collection_matchers (1.2.0)
rspec-expectations (>= 2.99.0.beta1)
rspec-core (3.12.0)
rspec-core (3.12.1)
rspec-support (~> 3.12.0)
rspec-expectations (3.12.2)
diff-lcs (>= 1.2.0, < 2.0)
Expand All @@ -422,7 +421,7 @@ GEM
rspec-mocks (~> 3.11)
rspec-support (~> 3.11)
rspec-support (3.12.0)
rubocop (1.44.1)
rubocop (1.45.1)
json (~> 2.3)
parallel (~> 1.10)
parser (>= 3.2.0.0)
Expand All @@ -432,8 +431,8 @@ GEM
rubocop-ast (>= 1.24.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.24.1)
parser (>= 3.1.1.0)
rubocop-ast (1.26.0)
parser (>= 3.2.1.0)
rubocop-i18n (3.0.0)
rubocop (~> 1.0)
ruby-progressbar (1.11.0)
Expand Down Expand Up @@ -535,10 +534,10 @@ GEM
yard-tomdoc (0.7.1)
tomparse (>= 0.4.0)
yard
zeitwerk (2.6.6)
zeitwerk (2.6.7)

PLATFORMS
arm64-darwin-22
arm64-darwin-21
x86_64-linux

DEPENDENCIES
Expand All @@ -555,9 +554,8 @@ DEPENDENCIES
bundle-audit
byebug
capybara
capybara-webmock
contact_us
danger (~> 9.0)
danger
database_cleaner
devise
devise_invitable
Expand All @@ -567,7 +565,7 @@ DEPENDENCIES
factory_bot_rails
faker
flag_shih_tzu
font-awesome-sass (~> 5)
font-awesome-sass
fuubar
guard
htmltoword
Expand Down Expand Up @@ -602,7 +600,6 @@ DEPENDENCIES
rubocop-i18n
sass-rails
sassc-rails
selenium-webdriver
shoulda
spring
spring-commands-rspec
Expand All @@ -611,7 +608,7 @@ DEPENDENCIES
translation
turbo-rails
web-console
webdrivers (~> 5.2)
webdrivers
webmock
webpacker
wicked_pdf
Expand All @@ -620,7 +617,7 @@ DEPENDENCIES
yard-tomdoc

RUBY VERSION
ruby 2.7.6p219
ruby 3.0.5p211

BUNDLED WITH
2.4.3
2.4.6
6 changes: 3 additions & 3 deletions app/assets/stylesheets/application.scss
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
// Import locally defined variables. Load this before 'bootstrap'

@import "variables/*";

// Pull in the webpacker managed copy of Bootstrap Stylesheets
@import "../../../node_modules/bootstrap-sass/assets/stylesheets/_bootstrap.scss";
@import "../../../node_modules/bootstrap-select/sass/bootstrap-select.scss";

// Pull in the DMPRoadmap CSS
@import "blocks/*";
@import "utils/*";

// Pull in the webapcker managed copy of JQuery-UI Stylesheets
// we are using the Datepicker and Sortable at the very least
@import "../../../node_modules/jquery-ui-sass/assets/sass/jquery-ui.scss";

@import "font-awesome-sprockets";
@import "font-awesome";
// Pull in Fontawesome
@import "font-awesome";
2 changes: 1 addition & 1 deletion app/controllers/concerns/paginable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module Paginable

##
# Regex to validate sort_field param is safe
SORT_COLUMN_FORMAT = /[\w_]+\.[\w_]+$/.freeze
SORT_COLUMN_FORMAT = /[\w_]+\.[\w_]+$/

PAGINATION_QUERY_PARAMS = %i[page sort_field sort_direction
search controller action].freeze
Expand Down
Loading