Skip to content

Commit

Permalink
Update Ruby Dependencies (#1595)
Browse files Browse the repository at this point in the history
* Remove unused sqlite3 gem

* Move sqlite3 gem into dummy gemfile

* Revert "Move sqlite3 gem into dummy gemfile"

This reverts commit 270507e.

* Revert "Remove unused sqlite3 gem"

This reverts commit 55629c9.

* Bump rails to 7.1

* Bump Shakapacker to 7.2.1

* Bump rubocop related gems

* Fix Rubocop issues

* Bump to use Ruby 3.0.0

* Fix Rubocop issues

* Update CircleCI config for Ruby 3

* Remove outdated comment for Ruby 2.2

* Update changelog
  • Loading branch information
ahangarha authored Jan 10, 2024
1 parent 6f1ca20 commit 2c04db6
Show file tree
Hide file tree
Showing 26 changed files with 180 additions and 286 deletions.
6 changes: 3 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: 2

aliases:
- &docker-image
- image: circleci/ruby:2.7-node-browsers
- image: circleci/ruby:3.0-node-browsers

# Print critical data and executables versions.
- &print-system-info
Expand Down Expand Up @@ -54,15 +54,15 @@ aliases:
- &install-dummy-app-ruby-gems
name: Install Ruby Gems for dummy app
command: |
gem install bundler:2.4.17
gem install bundler:2.5.3
echo "Bundler version: "; bundle --version
cd spec/dummy && bundle lock --add-platform 'x86_64-linux' && bundle check --path=vendor/bundle || bundle install --path=vendor/bundle --jobs=4 --retry=3
# Install ruby gems unless existing set of gems is satisfying bundler.
- &install-package-ruby-gems
name: Install Ruby Gems for package
command: |
gem install bundler:2.4.17
gem install bundler:2.5.3
echo "Bundler version: "; bundle --version
bundle lock --add-platform 'x86_64-linux'
bundle check --path=vendor/bundle || bundle install --path=vendor/bundle --jobs=4 --retry=3
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lint-js-and-ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler: 2.4.17
bundler: 2.5.3
- name: Setup Node
uses: actions/setup-node@v3
with:
Expand Down Expand Up @@ -52,7 +52,7 @@ jobs:
yarn run eslint -v
sudo yarn global add yalc
- name: Install Ruby Gems for package
run: bundle check --path=vendor/bundle || bundle _2.4.17_ install --path=vendor/bundle --jobs=4 --retry=3
run: bundle check --path=vendor/bundle || bundle _2.5.3_ install --path=vendor/bundle --jobs=4 --retry=3
- name: Linting of Ruby
run: bundle exec rubocop
- name: Linting of JS
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
build-dummy-app-webpack-test-bundles:
strategy:
matrix:
ruby: [2.7, 3.2]
ruby: [3.0, 3.3]
node: [14, 20]
runs-on: ubuntu-22.04
steps:
Expand All @@ -21,7 +21,7 @@ jobs:
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler: 2.4.17
bundler: 2.5.3
# libyaml-dev is needed for psych v5
# this gem depends on sdoc which depends on rdoc which depends on psych
- name: Fix dependency for libyaml-dev
Expand Down Expand Up @@ -66,7 +66,7 @@ jobs:
path: spec/dummy/vendor/bundle
key: v5-dummy-app-gem-cache-${{ hashFiles('spec/dummy/Gemfile.lock') }}
- name: Install Ruby Gems for dummy app
run: cd spec/dummy && bundle lock --add-platform 'x86_64-linux' && bundle check --path=vendor/bundle || bundle _2.4.17_ install --path=vendor/bundle --jobs=4 --retry=3
run: cd spec/dummy && bundle lock --add-platform 'x86_64-linux' && bundle check --path=vendor/bundle || bundle _2.5.3_ install --path=vendor/bundle --jobs=4 --retry=3
- name: generate file system-based packs
run: cd spec/dummy && RAILS_ENV=test bundle exec rake react_on_rails:generate_packs
- name: Build test bundles for dummy app
Expand All @@ -83,7 +83,7 @@ jobs:
needs: build-dummy-app-webpack-test-bundles
strategy:
matrix:
ruby: [2.7, 3.2]
ruby: [3.0, 3.3]
node: [14, 20]
rake_task: ['run_rspec:all_but_examples', 'run_rspec:examples']
runs-on: ubuntu-22.04
Expand All @@ -95,7 +95,7 @@ jobs:
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler: 2.4.17
bundler: 2.5.3
- name: Setup Node
uses: actions/setup-node@v3
with:
Expand Down Expand Up @@ -148,7 +148,7 @@ jobs:
- name: Install Ruby Gems for package
run: bundle lock --add-platform 'x86_64-linux' && bundle check --path=vendor/bundle || bundle install --path=vendor/bundle --jobs=4 --retry=3
- name: Install Ruby Gems for dummy app
run: cd spec/dummy && bundle lock --add-platform 'x86_64-linux' && bundle check --path=vendor/bundle || bundle _2.4.17_ install --path=vendor/bundle --jobs=4 --retry=3
run: cd spec/dummy && bundle lock --add-platform 'x86_64-linux' && bundle check --path=vendor/bundle || bundle _2.5.3_ install --path=vendor/bundle --jobs=4 --retry=3
- name: Ensure minimum required Chrome version
run: |
echo -e "Already installed $(google-chrome --version)\n"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/rspec-package-specs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
build:
strategy:
matrix:
ruby: [2.7, 3.2]
ruby: [3.0, 3.3]
node: [14, 20]
runs-on: ubuntu-22.04
steps:
Expand All @@ -21,7 +21,7 @@ jobs:
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler: 2.4.17
bundler: 2.5.3
- name: Print system information
run: |
echo "Linux release: "; cat /etc/issue
Expand Down
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require:
AllCops:
NewCops: enable
DisplayCopNames: true
TargetRubyVersion: 2.5
TargetRubyVersion: 3.0.0

Include:
- '**/Rakefile'
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ Please follow the recommendations outlined at [keepachangelog.com](http://keepac
### [Unreleased]
Changes since the last non-beta release.

#### Removed
- Dropped Ruby 2.7 support [PR 1595](https://github.com/shakacode/react_on_rails/pull/1595) by [ahangarha](https://github.com/ahangarha).

### [13.4.1]
#### Fixed
- Fixed Typescript types for ServerRenderResult, ReactComponent, RenderFunction, and RailsContext interfaces. [PR 1582](https://github.com/shakacode/react_on_rails/pull/1582) & [PR 1585](https://github.com/shakacode/react_on_rails/pull/1585) by [kotarella1110](https://github.com/kotarella1110)
Expand Down
15 changes: 7 additions & 8 deletions Gemfile.development_dependencies
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
# frozen_string_literal: true

gem "shakapacker", "7.0.1"
gem "shakapacker", "7.2.1"
gem "bootsnap", require: false
gem "rails", "~> 7.0", ">= 7.0.1"
gem "rails", "~> 7.1"

# sqlite3 1.7.0 ends native gem support for Ruby 2.7
gem "sqlite3", "~> 1.0", "< 1.7.0"
gem "sqlite3"
gem "sass-rails", "~> 6.0"
gem "uglifier"
gem "jquery-rails"
gem "puma", "~> 6.0"
gem "bundler", "2.4.17"
gem "bundler", "2.5.3"

# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem "turbolinks" if ENV["DISABLE_TURBOLINKS"].nil? || ENV["DISABLE_TURBOLINKS"].strip.empty?
Expand All @@ -31,9 +30,9 @@ group :development, :test do
gem "pry-doc"
gem "pry-rails"
gem "pry-rescue"
gem "rubocop", "~>1.56", require: false
gem "rubocop-performance", "~>1.18.0", require: false
gem "rubocop-rspec", "~>2.23.2", require: false
gem "rubocop", "~>1.59", require: false
gem "rubocop-performance", "~>1.20.0", require: false
gem "rubocop-rspec", "~>2.26", require: false
gem "scss_lint", require: false
gem "spring", "~> 4.0"
end
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ _Requires creating a free account._

## Prerequisites

Ruby on Rails >=5, rails/webpacker >= 4.2 or shakapacker > 6, Ruby >= 2.7
Ruby on Rails >=5, rails/webpacker >= 4.2 or shakapacker > 6, Ruby >= 3.0.0

# Support

Expand Down
2 changes: 1 addition & 1 deletion lib/generators/react_on_rails/base_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def add_base_gems_to_gemfile
end

def add_yarn_dependencies
major_minor_patch_only = /\A\d+\.\d+\.\d+\z/.freeze
major_minor_patch_only = /\A\d+\.\d+\.\d+\z/
if ReactOnRails::VERSION.match?(major_minor_patch_only)
run "yarn add react-on-rails@#{ReactOnRails::VERSION} --exact"
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
# ActiveRecord::Migration.maintain_test_schema!

RSpec.configure do |config|
config.before(:each, js: true, type: :system) do
config.before(:each, :js, type: :system) do
driven_by :selenium_chrome
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

require_relative "../rails_helper"

describe "Hello World", js: true do
describe "Hello World", :js do
it "the hello world example works" do
visit "/hello_world"
expect(heading).to have_text("Hello World")
Expand Down
2 changes: 1 addition & 1 deletion lib/react_on_rails/locales/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def default_locale

def convert
file_names.each do |name|
template = send("template_#{name}")
template = send(:"template_#{name}")
path = file(name)
generate_file(template, path)
end
Expand Down
2 changes: 1 addition & 1 deletion lib/react_on_rails/packs_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
module ReactOnRails
# rubocop:disable Metrics/ClassLength
class PacksGenerator
CONTAINS_CLIENT_OR_SERVER_REGEX = /\.(server|client)($|\.)/.freeze
CONTAINS_CLIENT_OR_SERVER_REGEX = /\.(server|client)($|\.)/
MINIMUM_SHAKAPACKER_VERSION = [6, 5, 1].freeze

def self.instance
Expand Down
2 changes: 1 addition & 1 deletion lib/react_on_rails/utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def self.smart_trim(str, max_length = 1000)
to_remove = str.length - max_length
lstrip = (to_remove / 2.0).ceil
rstrip = to_remove - lstrip
str[0..(midpoint - lstrip - 1)] + TRUNCATION_FILLER + str[(midpoint + rstrip)..-1]
str[0..(midpoint - lstrip - 1)] + TRUNCATION_FILLER + str[(midpoint + rstrip)..]
end

def self.find_most_recent_mtime(files)
Expand Down
2 changes: 1 addition & 1 deletion lib/react_on_rails/version_checker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module ReactOnRails
class VersionChecker
attr_reader :node_package_version

MAJOR_MINOR_PATCH_VERSION_REGEX = /(\d+)\.(\d+)\.(\d+)/.freeze
MAJOR_MINOR_PATCH_VERSION_REGEX = /(\d+)\.(\d+)\.(\d+)/

def self.build
new(NodePackageVersion.build)
Expand Down
2 changes: 1 addition & 1 deletion rakelib/examples.rake
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace :examples do # rubocop:disable Metrics/BlockLength
include ReactOnRails::TaskHelpers
# Loads data from examples_config.yml and instantiates corresponding ExampleType objects
examples_config_file = File.expand_path("examples_config.yml", __dir__)
examples_config = symbolize_keys(YAML.safe_load(File.read(examples_config_file)))
examples_config = symbolize_keys(YAML.safe_load_file(examples_config_file))
examples_config[:example_type_data].each { |example_type_data| ExampleType.new(**symbolize_keys(example_type_data)) }

# Define tasks for each example type
Expand Down
3 changes: 1 addition & 2 deletions react_on_rails.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,14 @@ Gem::Specification.new do |s|
s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
s.require_paths = ["lib"]

s.required_ruby_version = ">= 2.7.0"
s.required_ruby_version = ">= 3.0.0"

s.add_dependency "addressable"
s.add_dependency "connection_pool"
s.add_dependency "execjs", "~> 2.5"
s.add_dependency "rails", ">= 5.2"
s.add_dependency "rainbow", "~> 3.0"

s.add_development_dependency "bundler", "~> 2"
s.add_development_dependency "gem-release"
s.post_install_message = '
--------------------------------------------------------------------------------
Expand Down
Loading

0 comments on commit 2c04db6

Please sign in to comment.