diff --git a/.codeclimate.yml b/.codeclimate.yml index 936294cd8..e1457adca 100644 --- a/.codeclimate.yml +++ b/.codeclimate.yml @@ -43,7 +43,7 @@ checks: plugins: rubocop: enabled: true - channel: rubocop-0-86 + channel: rubocop-1-10 brakeman: enabled: true eslint: diff --git a/.gitpod.dockerfile b/.gitpod.dockerfile index c05178468..836e4e70c 100644 --- a/.gitpod.dockerfile +++ b/.gitpod.dockerfile @@ -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" diff --git a/.rubocop.yml b/.rubocop.yml index 13f0a6962..64769da9c 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -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 ########################### diff --git a/.ruby-version b/.ruby-version index 37c2961c2..b50214693 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.7.2 +3.0.2 diff --git a/.travis.yml b/.travis.yml index 13a63cc74..c97d0669d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,7 +8,7 @@ cache: directories: - node_modules rvm: - - 2.7.2 + - 3.0.2 addons: postgresql: '12' apt: diff --git a/Containerfile b/Containerfile index bc94c5b3e..0918cca46 100644 --- a/Containerfile +++ b/Containerfile @@ -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 \ diff --git a/Gemfile b/Gemfile index 2b34d229c..a5a73b1aa 100644 --- a/Gemfile +++ b/Gemfile @@ -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 - 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 diff --git a/Gemfile.lock b/Gemfile.lock index 39cfd043a..40ce783d8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -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 diff --git a/README.md b/README.md index 755dd528a..6fc1bdad8 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@

- ruby version + ruby version rails version diff --git a/app/assets/images/git_lab.svg b/app/assets/images/git_lab.svg index 1097fb86b..9317d8dd8 100644 --- a/app/assets/images/git_lab.svg +++ b/app/assets/images/git_lab.svg @@ -1,3 +1,3 @@ - + diff --git a/app/assets/images/linked_in.svg b/app/assets/images/linked_in.svg index 88d08f406..d9b7d3ada 100644 --- a/app/assets/images/linked_in.svg +++ b/app/assets/images/linked_in.svg @@ -1,3 +1,3 @@ - - \ No newline at end of file + + diff --git a/app/assets/images/website.svg b/app/assets/images/website.svg index a9886a473..d7db71a22 100644 --- a/app/assets/images/website.svg +++ b/app/assets/images/website.svg @@ -1,3 +1,3 @@ - + diff --git a/app/models/profile_field.rb b/app/models/profile_field.rb index 33f1629cd..f2ddbf073 100644 --- a/app/models/profile_field.rb +++ b/app/models/profile_field.rb @@ -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 diff --git a/app/models/user.rb b/app/models/user.rb index 2a514d9a9..a90b862b6 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -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, diff --git a/app/view_objects/articles/social_image.rb b/app/view_objects/articles/social_image.rb index df007ec88..dcb63b3a3 100644 --- a/app/view_objects/articles/social_image.rb +++ b/app/view_objects/articles/social_image.rb @@ -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 diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index 5760688fe..fa18cc500 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -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" diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index f8db4f503..699cc3284 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -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. diff --git a/spec/support/initializers/ci_csv_formatter.rb b/spec/support/initializers/ci_csv_formatter.rb index cb2aad3e4..fbfd21a34 100644 --- a/spec/support/initializers/ci_csv_formatter.rb +++ b/spec/support/initializers/ci_csv_formatter.rb @@ -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 diff --git a/vendor/cache/acts_as_follower-06393d3693a1/acts_as_follower.gemspec b/vendor/cache/acts_as_follower-06393d3693a1/acts_as_follower.gemspec index b6c96db3e..fb9e9bbf3 100644 --- a/vendor/cache/acts_as_follower-06393d3693a1/acts_as_follower.gemspec +++ b/vendor/cache/acts_as_follower-06393d3693a1/acts_as_follower.gemspec @@ -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 diff --git a/vendor/cache/binding_of_caller-0.8.0.gem b/vendor/cache/binding_of_caller-0.8.0.gem deleted file mode 100644 index 43d9e7d4b..000000000 Binary files a/vendor/cache/binding_of_caller-0.8.0.gem and /dev/null differ diff --git a/vendor/cache/byebug-11.1.3.gem b/vendor/cache/byebug-11.1.3.gem deleted file mode 100644 index 4321f4bfb..000000000 Binary files a/vendor/cache/byebug-11.1.3.gem and /dev/null differ diff --git a/vendor/cache/debug_inspector-1.1.0.gem b/vendor/cache/debug_inspector-1.1.0.gem deleted file mode 100644 index c16993e82..000000000 Binary files a/vendor/cache/debug_inspector-1.1.0.gem and /dev/null differ diff --git a/vendor/cache/pry-byebug-3.9.0.gem b/vendor/cache/pry-byebug-3.9.0.gem deleted file mode 100644 index 7c7b891ca..000000000 Binary files a/vendor/cache/pry-byebug-3.9.0.gem and /dev/null differ diff --git a/vendor/cache/rss-0.2.9.gem b/vendor/cache/rss-0.2.9.gem new file mode 100644 index 000000000..de4c49a60 Binary files /dev/null and b/vendor/cache/rss-0.2.9.gem differ