Upgrade to Ruby 3.0.2 (#12103)

Co-authored-by: rhymes <rhymes@hey.com>
Co-authored-by: Mac Siri <krairit.siri@gmail.com>
This commit is contained in:
Michael Kohl 2021-08-26 01:26:33 +07:00 committed by GitHub
parent b75af7b2aa
commit 521f1d26bc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 41 additions and 45 deletions

View file

@ -43,7 +43,7 @@ checks:
plugins:
rubocop:
enabled: true
channel: rubocop-0-86
channel: rubocop-1-10
brakeman:
enabled: true
eslint:

View file

@ -1,7 +1,7 @@
FROM gitpod/workspace-postgres
# Install Ruby
ENV RUBY_VERSION=2.7.2
ENV RUBY_VERSION=3.0.2
RUN rm /home/gitpod/.rvmrc && touch /home/gitpod/.rvmrc && echo "rvm_gems_path=/home/gitpod/.rvm" > /home/gitpod/.rvmrc
RUN bash -lc "rvm install ruby-$RUBY_VERSION && rvm use ruby-$RUBY_VERSION --default"

View file

@ -18,7 +18,7 @@ AllCops:
DisplayStyleGuide: true
ExtraDetails: true
NewCops: enable # opt-in to new cops by default
TargetRubyVersion: 2.7
TargetRubyVersion: 3.0
#################### Bundler ###########################

View file

@ -1 +1 @@
2.7.2
3.0.2

View file

@ -8,7 +8,7 @@ cache:
directories:
- node_modules
rvm:
- 2.7.2
- 3.0.2
addons:
postgresql: '12'
apt:

View file

@ -1,4 +1,4 @@
FROM quay.io/forem/ruby:2.7.2 as builder
FROM quay.io/forem/ruby:3.0.2 as builder
USER root
@ -10,7 +10,7 @@ RUN curl -sL https://dl.yarnpkg.com/rpm/yarn.repo -o /etc/yum.repos.d/yarn.repo
dnf -y clean all && \
rm -rf /var/cache/yum
ENV BUNDLER_VERSION=2.2.15 BUNDLE_SILENCE_ROOT_WARNING=true BUNDLE_SILENCE_DEPRECATIONS=true
ENV BUNDLER_VERSION=2.2.22 BUNDLE_SILENCE_ROOT_WARNING=true BUNDLE_SILENCE_DEPRECATIONS=true
RUN gem install -N bundler:"${BUNDLER_VERSION}"
ENV APP_USER=forem APP_UID=1000 APP_GID=1000 APP_HOME=/opt/apps/forem \
@ -49,7 +49,7 @@ RUN echo $(date -u +'%Y-%m-%dT%H:%M:%SZ') >> "${APP_HOME}"/FOREM_BUILD_DATE && \
RUN rm -rf node_modules vendor/assets spec
## Production
FROM quay.io/forem/ruby:2.7.2 as production
FROM quay.io/forem/ruby:3.0.2 as production
USER root
@ -59,7 +59,7 @@ RUN dnf install --setopt install_weak_deps=false -y bash curl ImageMagick \
&& dnf -y clean all \
&& rm -rf /var/cache/yum
ENV BUNDLER_VERSION=2.2.15 BUNDLE_SILENCE_ROOT_WARNING=1
ENV BUNDLER_VERSION=2.2.22 BUNDLE_SILENCE_ROOT_WARNING=1
RUN gem install -N bundler:"${BUNDLER_VERSION}"
ENV APP_USER=forem APP_UID=1000 APP_GID=1000 APP_HOME=/opt/apps/forem \

View file

@ -74,6 +74,7 @@ gem "rack-attack", "~> 6.5.0" # Used to throttle requests to prevent brute force
gem "rack-cors", "~> 1.1" # Middleware that will make Rack-based apps CORS compatible
gem "rack-timeout", "~> 0.6" # Rack middleware which aborts requests that have been running for longer than a specified timeout
gem "rails", "~> 6.1.4" # Ruby on Rails
gem "rss", "~> 0.2.9" # Ruby's standard library for RSS
# Pinned since we have a monkey-patch against this version
gem "rails-settings-cached", "2.6.0" # Settings plugin for Rails that makes managing a table of global key, value pairs easy.
gem "ransack", "~> 2.4" # Searching and sorting
@ -119,9 +120,6 @@ gem "webpacker", "~> 5.4.2" # Use webpack to manage app-like JavaScript modules
group :development do
gem "better_errors", "~> 2.9" # Provides a better error page for Rails and other Rack apps
# NOTE: [@rhymes] binding_of_caller 1.0 breaks Docker Compose, see <https://github.com/forem/forem/issues/12068>
gem "binding_of_caller", "~> 0.8" # Retrieve the binding of a method's caller
gem "brakeman", "~> 5.1", require: false # Brakeman detects security vulnerabilities in Ruby on Rails applications via static analysis
gem "bundler-audit", "~> 0.8" # bundler-audit provides patch-level verification for Bundled apps
gem "derailed_benchmarks", "~> 2.1", require: false # A series of things you can use to benchmark a Rails or Ruby app
@ -143,7 +141,6 @@ group :development, :test do
gem "dotenv-rails", "~> 2.7.6" # For loading ENV variables locally
gem "faker", "~> 2.19" # A library for generating fake data such as names, addresses, and phone numbers
gem "knapsack_pro", "~> 3.1.0" # Help parallelize Ruby spec builds
gem "pry-byebug", "~> 3.8" # Combine 'pry' with 'byebug'. Adds 'step', 'next', 'finish', 'continue' and 'break' commands to control execution
gem "rspec-rails", "~> 5.0" # rspec-rails is a testing framework for Rails 3+
gem "rubocop", "~> 1.19", require: false # Automatic Ruby code style checking tool
gem "rubocop-performance", "~> 1.11", require: false # A collection of RuboCop cops to check for performance optimizations in Ruby code

View file

@ -112,8 +112,6 @@ GEM
parser (>= 2.4)
smart_properties
bindex (0.8.1)
binding_of_caller (0.8.0)
debug_inspector (>= 0.0.1)
blazer (2.4.3)
activerecord (>= 5)
chartkick (>= 3.2)
@ -134,7 +132,6 @@ GEM
bundler-audit (0.8.0)
bundler (>= 1.2.0, < 3)
thor (~> 1.0)
byebug (11.1.3)
capybara (3.35.3)
addressable
mini_mime (>= 0.1.3)
@ -186,7 +183,6 @@ GEM
ffi (~> 1.0)
msgpack
dead_end (1.1.7)
debug_inspector (1.1.0)
derailed_benchmarks (2.1.1)
benchmark-ips (~> 2)
dead_end
@ -511,9 +507,6 @@ GEM
pry (0.13.1)
coderay (~> 1.1)
method_source (~> 1.0)
pry-byebug (3.9.0)
byebug (~> 11.0)
pry (~> 0.13.0)
pry-rails (0.3.9)
pry (>= 0.10.4)
public_suffix (4.0.6)
@ -648,6 +641,8 @@ GEM
rspec-retry (0.6.2)
rspec-core (> 3.3)
rspec-support (3.10.2)
rss (0.2.9)
rexml
rubocop (1.19.1)
parallel (~> 1.10)
parser (>= 3.0.0.0)
@ -853,7 +848,6 @@ DEPENDENCIES
amazing_print (~> 1.3)
ancestry (~> 4.1)
better_errors (~> 2.9)
binding_of_caller (~> 0.8)
blazer (~> 2.4.3)
bootsnap (>= 1.1.0)
brakeman (~> 5.1)
@ -925,7 +919,6 @@ DEPENDENCIES
pg (~> 1.2)
pg_search (~> 2.3.5)
pry (~> 0.13)
pry-byebug (~> 3.8)
pry-rails (~> 0.3)
puma (~> 5.4.0)
pundit (~> 2.1)
@ -952,6 +945,7 @@ DEPENDENCIES
rpush-redis (~> 1.1)
rspec-rails (~> 5.0)
rspec-retry (~> 0.6)
rss (~> 0.2.9)
rubocop (~> 1.19)
rubocop-performance (~> 1.11)
rubocop-rails (~> 2.11)
@ -994,7 +988,7 @@ DEPENDENCIES
zonebie (~> 0.6.1)
RUBY VERSION
ruby 2.7.2p137
ruby 3.0.2p107
BUNDLED WITH
2.2.20
2.2.22

View file

@ -6,7 +6,7 @@
<br>
<p align="center">
<a href="https://www.ruby-lang.org/en/">
<img src="https://img.shields.io/badge/Ruby-v2.7.2-green.svg" alt="ruby version">
<img src="https://img.shields.io/badge/Ruby-v3.0.2-green.svg" alt="ruby version">
</a>
<a href="http://rubyonrails.org/">
<img src="https://img.shields.io/badge/Rails-v6.0.3-brightgreen.svg" alt="rails version">

View file

@ -1,3 +1,3 @@
<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path d="M5.868 2.75L8 10h8l2.132-7.25a.4.4 0 01.765-.01l3.495 10.924a.5.5 0 01-.173.55L12 22 1.78 14.214a.5.5 0 01-.172-.55L5.103 2.74a.4.4 0 01.765.009v.001z"/>
<path d="M5.868 2.75L8 10h8l2.132-7.25a.4.4 0 0 1 .765-.01l3.495 10.924a.5.5 0 0 1-.173.55L12 22 1.78 14.214a.5.5 0 0 1-.172-.55L5.103 2.74a.4.4 0 0 1 .765.009v.001z"/>
</svg>

Before

Width:  |  Height:  |  Size: 258 B

After

Width:  |  Height:  |  Size: 264 B

View file

@ -1,3 +1,3 @@
<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path d="M18.335 18.339H15.67v-4.177c0-.996-.02-2.278-1.39-2.278-1.389 0-1.601 1.084-1.601 2.205v4.25h-2.666V9.75h2.56v1.17h.035c.358-.674 1.228-1.387 2.528-1.387 2.7 0 3.2 1.778 3.2 4.091v4.715h-.001zM7.003 8.575a1.546 1.546 0 01-1.287-2.409 1.548 1.548 0 111.286 2.409h.001zm1.336 9.764H5.666V9.75H8.34v8.589h-.001zM19.67 3H4.329C3.593 3 3 3.58 3 4.297v15.406C3 20.42 3.594 21 4.328 21h15.338C20.4 21 21 20.42 21 19.703V4.297C21 3.58 20.4 3 19.666 3h.004z"/>
</svg>
<path d="M18.335 18.339H15.67v-4.177c0-.996-.02-2.278-1.39-2.278-1.389 0-1.601 1.084-1.601 2.205v4.25h-2.666V9.75h2.56v1.17h.035c.358-.674 1.228-1.387 2.528-1.387 2.7 0 3.2 1.778 3.2 4.091v4.715h-.001zM7.003 8.575a1.546 1.546 0 0 1-1.287-2.409 1.548 1.548 0 1 1 1.286 2.409h.001zm1.336 9.764H5.666V9.75H8.34v8.589h-.001zM19.67 3H4.329C3.593 3 3 3.58 3 4.297v15.406C3 20.42 3.594 21 4.328 21h15.338C20.4 21 21 20.42 21 19.703V4.297C21 3.58 20.4 3 19.666 3h.004z"/>
</svg>

Before

Width:  |  Height:  |  Size: 555 B

After

Width:  |  Height:  |  Size: 559 B

View file

@ -1,3 +1,3 @@
<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path d="M10 6v2H5v11h11v-5h2v6a1 1 0 01-1 1H4a1 1 0 01-1-1V7a1 1 0 011-1h6zm11-3v8h-2V6.413l-7.793 7.794-1.414-1.414L17.585 5H13V3h8z"/>
<path d="M10 6v2H5v11h11v-5h2v6a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h6zm11-3v8h-2V6.413l-7.793 7.794-1.414-1.414L17.585 5H13V3h8z"/>
</svg>

Before

Width:  |  Height:  |  Size: 233 B

After

Width:  |  Height:  |  Size: 237 B

View file

@ -1,5 +1,5 @@
class ProfileField < ApplicationRecord
WORD_REGEX = /\b\w+\b/.freeze
WORD_REGEX = /\b\w+\b/
HEADER_FIELD_LIMIT = 3
HEADER_LIMIT_MESSAGE = "maximum number of header fields (#{HEADER_FIELD_LIMIT}) exceeded".freeze

View file

@ -55,7 +55,7 @@ class User < ApplicationRecord
ANY_ADMIN_ROLES = %i[admin super_admin].freeze
USERNAME_MAX_LENGTH = 30
USERNAME_REGEXP = /\A[a-zA-Z0-9_]+\z/.freeze
USERNAME_REGEXP = /\A[a-zA-Z0-9_]+\z/
MESSAGES = {
reserved_username: "username is reserved"
}.freeze
@ -66,7 +66,7 @@ class User < ApplicationRecord
([a-zA-Z0-9\-.])+ # matches the hostname (ex ilp.uphold.com)
(/[\x20-\x7F]+)? # optional forward slash and identifier with printable ASCII characters
\z
}x.freeze
}x
attr_accessor :scholar_email, :new_note, :note_for_current_role, :user_status, :merge_user_id,
:add_credits, :remove_credits, :add_org_credits, :remove_org_credits, :ip_address,

View file

@ -4,10 +4,10 @@ module Articles
SOCIAL_PREVIEW_MIGRATION_DATETIME = Time.zone.parse("2019-04-22T00:00:00Z")
def initialize(article, **options)
def initialize(article, height: 500, width: 1000)
@article = article
@height = options[:height] || 500
@width = options[:width] || 1000
@height = height
@width = width
end
def url

View file

@ -1,5 +1,10 @@
# Be sure to restart your server when you modify this file.
# See: https://github.com/sass/sassc-ruby/issues/197
Rails.application.config.assets.configure do |env|
env.export_concurrent = false
end
# Version of your assets, change this if you want to expire all your assets.
Rails.application.config.assets.version = "1.1"

View file

@ -31,12 +31,12 @@ require "webmock/rspec"
# directory. Alternatively, in the individual `*_spec.rb` files, manually
# require only the support files necessary.
Dir[Rails.root.join("spec/support/**/*.rb")].sort.each { |f| require f }
Dir[Rails.root.join("spec/system/shared_examples/**/*.rb")].sort.each { |f| require f }
Dir[Rails.root.join("spec/models/shared_examples/**/*.rb")].sort.each { |f| require f }
Dir[Rails.root.join("spec/workers/shared_examples/**/*.rb")].sort.each { |f| require f }
Dir[Rails.root.join("spec/initializers/shared_examples/**/*.rb")].sort.each { |f| require f }
Dir[Rails.root.join("spec/mailers/shared_examples/**/*.rb")].sort.each { |f| require f }
Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
Dir[Rails.root.join("spec/system/shared_examples/**/*.rb")].each { |f| require f }
Dir[Rails.root.join("spec/models/shared_examples/**/*.rb")].each { |f| require f }
Dir[Rails.root.join("spec/workers/shared_examples/**/*.rb")].each { |f| require f }
Dir[Rails.root.join("spec/initializers/shared_examples/**/*.rb")].each { |f| require f }
Dir[Rails.root.join("spec/mailers/shared_examples/**/*.rb")].each { |f| require f }
# Checks for pending migrations before tests are run.
# If you are not using ActiveRecord, you can remove this line.

View file

@ -64,7 +64,7 @@ class CSVFormatter
suite_runtime = (Time.zone.now - @suite_start_time).round(3)
with_headers = { write_headers: true, headers: HEADERS }
CSV.open(csv_filename, "w", with_headers) do |csv|
CSV.open(csv_filename, "w", **with_headers) do |csv|
(@rows + RSpecRetryFormatterHelper.instance.rows).each do |row|
row += [@suite_status, suite_runtime, ENV["TRAVIS_BUILD_WEB_URL"], ENV["TRAVIS_BRANCH"]]
csv << row

View file

@ -8,16 +8,16 @@ Gem::Specification.new do |s|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
s.require_paths = ["lib".freeze]
s.authors = ["Tom Cocca".freeze]
s.date = "2021-04-09"
s.date = "2021-07-08"
s.description = "acts_as_follower is a Rubygem to allow any model to follow any other model. This is accomplished through a double polymorphic relationship on the Follow model. There is also built in support for blocking/un-blocking follow records. Main uses would be for Users to follow other Users or for Users to follow Books, etc\u2026 (Basically, to develop the type of follow system that GitHub has)".freeze
s.email = ["tom dot cocca at gmail dot com".freeze]
s.files = [".gitignore".freeze, ".travis.yml".freeze, "Gemfile".freeze, "MIT-LICENSE".freeze, "README.rdoc".freeze, "Rakefile".freeze, "acts_as_follower.gemspec".freeze, "init.rb".freeze, "lib/acts_as_follower.rb".freeze, "lib/acts_as_follower/follow_scopes.rb".freeze, "lib/acts_as_follower/followable.rb".freeze, "lib/acts_as_follower/follower.rb".freeze, "lib/acts_as_follower/follower_lib.rb".freeze, "lib/acts_as_follower/railtie.rb".freeze, "lib/acts_as_follower/version.rb".freeze, "lib/generators/USAGE".freeze, "lib/generators/acts_as_follower_generator.rb".freeze, "lib/generators/templates/migration.rb".freeze, "lib/generators/templates/model.rb".freeze, "test/README".freeze, "test/acts_as_followable_test.rb".freeze, "test/acts_as_follower_test.rb".freeze, "test/dummy30/Gemfile".freeze, "test/dummy30/Rakefile".freeze, "test/dummy30/app/models/application_record.rb".freeze, "test/dummy30/app/models/band.rb".freeze, "test/dummy30/app/models/band/punk.rb".freeze, "test/dummy30/app/models/band/punk/pop_punk.rb".freeze, "test/dummy30/app/models/custom_record.rb".freeze, "test/dummy30/app/models/some.rb".freeze, "test/dummy30/app/models/user.rb".freeze, "test/dummy30/config.ru".freeze, "test/dummy30/config/application.rb".freeze, "test/dummy30/config/boot.rb".freeze, "test/dummy30/config/database.yml".freeze, "test/dummy30/config/environment.rb".freeze, "test/dummy30/config/environments/development.rb".freeze, "test/dummy30/config/environments/test.rb".freeze, "test/dummy30/config/initializers/backtrace_silencers.rb".freeze, "test/dummy30/config/initializers/inflections.rb".freeze, "test/dummy30/config/initializers/secret_token.rb".freeze, "test/dummy30/config/initializers/session_store.rb".freeze, "test/dummy30/config/locales/en.yml".freeze, "test/dummy30/config/routes.rb".freeze, "test/factories/bands.rb".freeze, "test/factories/somes.rb".freeze, "test/factories/users.rb".freeze, "test/follow_test.rb".freeze, "test/schema.rb".freeze, "test/test_helper.rb".freeze]
s.homepage = "https://github.com/tcocca/acts_as_follower".freeze
s.licenses = ["MIT".freeze]
s.rubygems_version = "3.1.4".freeze
s.rubygems_version = "3.2.22".freeze
s.summary = "A Rubygem to add Follow functionality for ActiveRecord models".freeze
s.installed_by_version = "3.1.4" if s.respond_to? :installed_by_version
s.installed_by_version = "3.2.22" if s.respond_to? :installed_by_version
if s.respond_to? :specification_version then
s.specification_version = 4

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
vendor/cache/rss-0.2.9.gem vendored Normal file

Binary file not shown.