From 91d2e4ca320a1487f0c7417164ca9734c812a697 Mon Sep 17 00:00:00 2001 From: Kevin McCormack Date: Mon, 8 Jan 2024 14:08:00 -0500 Subject: [PATCH 1/2] Add support for Ruby 3.3 --- .github/workflows/rspec.yml | 1 + gemfiles/rails_6.1.gemfile | 7 +++++++ gemfiles/rails_7.0.gemfile | 7 +++++++ gemfiles/sequel_5.0.gemfile | 7 +++++++ 4 files changed, 22 insertions(+) diff --git a/.github/workflows/rspec.yml b/.github/workflows/rspec.yml index 9fbca72..93f3b2f 100644 --- a/.github/workflows/rspec.yml +++ b/.github/workflows/rspec.yml @@ -20,6 +20,7 @@ jobs: - "3.0" - "3.1" - "3.2" + - "3.3" - "head" - "jruby-9.3" runs-on: ${{ matrix.os }}-latest diff --git a/gemfiles/rails_6.1.gemfile b/gemfiles/rails_6.1.gemfile index 6214df6..d0c0ca7 100644 --- a/gemfiles/rails_6.1.gemfile +++ b/gemfiles/rails_6.1.gemfile @@ -2,6 +2,13 @@ source "https://rubygems.org" +gem "appraisal", git: "https://github.com/thoughtbot/appraisal.git", branch: :main +gem "fakefs", "~> 1.2" +gem "nokogiri", "~> 1.10" +gem "pry" +gem "rspec", "~> 3.9" +gem "rubocop", "~> 1.20" +gem "rubocop-rspec", "~> 2.4" gem "activerecord-jdbcsqlite3-adapter", "~> 61.0", platform: :jruby gem "rails", "~> 6.1.0" gem "sqlite3", platform: :mri diff --git a/gemfiles/rails_7.0.gemfile b/gemfiles/rails_7.0.gemfile index 9f381de..83748eb 100644 --- a/gemfiles/rails_7.0.gemfile +++ b/gemfiles/rails_7.0.gemfile @@ -2,6 +2,13 @@ source "https://rubygems.org" +gem "appraisal", git: "https://github.com/thoughtbot/appraisal.git", branch: :main +gem "fakefs", "~> 1.2" +gem "nokogiri", "~> 1.10" +gem "pry" +gem "rspec", "~> 3.9" +gem "rubocop", "~> 1.20" +gem "rubocop-rspec", "~> 2.4" gem "activerecord-jdbcsqlite3-adapter", "~> 70.0", platform: :jruby gem "rails", "~> 7.0.0" gem "sqlite3", platform: :mri diff --git a/gemfiles/sequel_5.0.gemfile b/gemfiles/sequel_5.0.gemfile index b101639..7a18224 100644 --- a/gemfiles/sequel_5.0.gemfile +++ b/gemfiles/sequel_5.0.gemfile @@ -2,6 +2,13 @@ source "https://rubygems.org" +gem "appraisal", git: "https://github.com/thoughtbot/appraisal.git", branch: :main +gem "fakefs", "~> 1.2" +gem "nokogiri", "~> 1.10" +gem "pry" +gem "rspec", "~> 3.9" +gem "rubocop", "~> 1.20" +gem "rubocop-rspec", "~> 2.4" gem "jdbc-sqlite3", platform: :jruby gem "sequel", "~> 5.0" gem "sqlite3", platform: :mri From b4eecbb8c85be84d3dd42f65805f6fd79068f6eb Mon Sep 17 00:00:00 2001 From: Kevin McCormack Date: Mon, 8 Jan 2024 14:10:19 -0500 Subject: [PATCH 2/2] Rubocop auto-correct --- gemfiles/rails_6.1.gemfile | 4 ++-- gemfiles/rails_7.0.gemfile | 4 ++-- gemfiles/sequel_5.0.gemfile | 2 +- .../core_ext/awesome_method_array.rb | 2 +- spec/ext/nokogiri_spec.rb | 4 ++-- spec/formats_spec.rb | 16 ++++++++-------- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/gemfiles/rails_6.1.gemfile b/gemfiles/rails_6.1.gemfile index d0c0ca7..20b98dc 100644 --- a/gemfiles/rails_6.1.gemfile +++ b/gemfiles/rails_6.1.gemfile @@ -2,15 +2,15 @@ source "https://rubygems.org" +gem "activerecord-jdbcsqlite3-adapter", "~> 61.0", platform: :jruby gem "appraisal", git: "https://github.com/thoughtbot/appraisal.git", branch: :main gem "fakefs", "~> 1.2" gem "nokogiri", "~> 1.10" gem "pry" +gem "rails", "~> 6.1.0" gem "rspec", "~> 3.9" gem "rubocop", "~> 1.20" gem "rubocop-rspec", "~> 2.4" -gem "activerecord-jdbcsqlite3-adapter", "~> 61.0", platform: :jruby -gem "rails", "~> 6.1.0" gem "sqlite3", platform: :mri gemspec path: "../" diff --git a/gemfiles/rails_7.0.gemfile b/gemfiles/rails_7.0.gemfile index 83748eb..0a19ff3 100644 --- a/gemfiles/rails_7.0.gemfile +++ b/gemfiles/rails_7.0.gemfile @@ -2,15 +2,15 @@ source "https://rubygems.org" +gem "activerecord-jdbcsqlite3-adapter", "~> 70.0", platform: :jruby gem "appraisal", git: "https://github.com/thoughtbot/appraisal.git", branch: :main gem "fakefs", "~> 1.2" gem "nokogiri", "~> 1.10" gem "pry" +gem "rails", "~> 7.0.0" gem "rspec", "~> 3.9" gem "rubocop", "~> 1.20" gem "rubocop-rspec", "~> 2.4" -gem "activerecord-jdbcsqlite3-adapter", "~> 70.0", platform: :jruby -gem "rails", "~> 7.0.0" gem "sqlite3", platform: :mri gemspec path: "../" diff --git a/gemfiles/sequel_5.0.gemfile b/gemfiles/sequel_5.0.gemfile index 7a18224..ba937c3 100644 --- a/gemfiles/sequel_5.0.gemfile +++ b/gemfiles/sequel_5.0.gemfile @@ -4,12 +4,12 @@ source "https://rubygems.org" gem "appraisal", git: "https://github.com/thoughtbot/appraisal.git", branch: :main gem "fakefs", "~> 1.2" +gem "jdbc-sqlite3", platform: :jruby gem "nokogiri", "~> 1.10" gem "pry" gem "rspec", "~> 3.9" gem "rubocop", "~> 1.20" gem "rubocop-rspec", "~> 2.4" -gem "jdbc-sqlite3", platform: :jruby gem "sequel", "~> 5.0" gem "sqlite3", platform: :mri diff --git a/lib/amazing_print/core_ext/awesome_method_array.rb b/lib/amazing_print/core_ext/awesome_method_array.rb index 8a6204a..96654ef 100644 --- a/lib/amazing_print/core_ext/awesome_method_array.rb +++ b/lib/amazing_print/core_ext/awesome_method_array.rb @@ -78,7 +78,7 @@ def grep(pattern, &blk) super(pattern) end arr.instance_variable_set(:@__awesome_methods__, instance_variable_get(:@__awesome_methods__)) - arr.select! { |item| (item.is_a?(Symbol) || item.is_a?(String)) } # grep block might return crap. + arr.select! { |item| item.is_a?(Symbol) || item.is_a?(String) } # grep block might return crap. arr end end diff --git a/spec/ext/nokogiri_spec.rb b/spec/ext/nokogiri_spec.rb index a6de61a..a1fde12 100644 --- a/spec/ext/nokogiri_spec.rb +++ b/spec/ext/nokogiri_spec.rb @@ -6,7 +6,7 @@ it 'colorizes tags' do xml = Nokogiri::XML('

') # FIXME: Due to something strange with Nokogiri and JRuby, we need to remove extra blank lines. - output = xml.ai.gsub(/\n\n/, "\n") + output = xml.ai.gsub("\n\n", "\n") expect(output).to eq <<~EOS \e[1;32m \e[0m<\e[1;36mhtml\e[0m>\e[1;32m @@ -32,7 +32,7 @@ it 'colorizes class and id' do xml = Nokogiri::XML('

') # FIXME: Due to something strange with Nokogiri and JRuby, we need to remove extra blank lines. - output = xml.ai.gsub(/\n\n/, "\n") + output = xml.ai.gsub("\n\n", "\n") expect(output).to eq <<~EOS \e[1;32m \e[0m<\e[1;36mhtml\e[0m>\e[1;32m diff --git a/spec/formats_spec.rb b/spec/formats_spec.rb index bd6a15d..9790566 100644 --- a/spec/formats_spec.rb +++ b/spec/formats_spec.rb @@ -499,13 +499,13 @@ #------------------------------------------------------------------------------ describe 'File' do - it 'displays a file (plain)', unix: true do + it 'displays a file (plain)', :unix do File.open(__FILE__, 'r') do |f| expect(f.ai(plain: true)).to eq("#{f.inspect}\n" + `ls -alF #{f.path}`.chop) end end - it 'displays a file (plain) akin to powershell Get-ChildItem', mswin: true do + it 'displays a file (plain) akin to powershell Get-ChildItem', :mswin do File.open(__FILE__, 'r') do |f| expect(f.ai(plain: true)).to eq("#{f.inspect}\n" + AmazingPrint::Formatters::GetChildItem.new(f.path).to_s) end @@ -514,13 +514,13 @@ #------------------------------------------------------------------------------ describe 'Dir' do - it 'displays a direcory (plain)', unix: true do + it 'displays a direcory (plain)', :unix do Dir.open(File.dirname(__FILE__)) do |d| expect(d.ai(plain: true)).to eq("#{d.inspect}\n" + `ls -alF #{d.path}`.chop) end end - it 'displays a directory (plain) akin to powershell Get-ChildItem', mswin: true do + it 'displays a directory (plain) akin to powershell Get-ChildItem', :mswin do Dir.open(File.dirname(__FILE__)) do |d| expect(d.ai(plain: true)).to eq("#{d.inspect}\n" + AmazingPrint::Formatters::GetChildItem.new(d.path).to_s) end @@ -684,7 +684,7 @@ class My < Hash; end EOS end - it 'inherited from File should be displayed as File', unix: true do + it 'inherited from File should be displayed as File', :unix do class My < File; end my = begin @@ -695,13 +695,13 @@ class My < File; end expect(my.ai(plain: true)).to eq("#{my.inspect}\n" + `ls -alF #{my.path}`.chop) end - it 'inherited from File should be displayed as File', mswin: true do + it 'inherited from File should be displayed as File', :mswin do class My < File; end my = My.new('nul') # it's /dev/null in Windows expect(my.ai(plain: true)).to eq("#{my.inspect}\n" + AmazingPrint::Formatters::GetChildItem.new(my.path).to_s) end - it 'inherited from Dir should be displayed as Dir', unix: true do + it 'inherited from Dir should be displayed as Dir', :unix do class My < Dir; end require 'tmpdir' @@ -709,7 +709,7 @@ class My < Dir; end expect(my.ai(plain: true)).to eq("#{my.inspect}\n" + `ls -alF #{my.path}`.chop) end - it 'inherited from Dir are displayed as Dir', mswin: true do + it 'inherited from Dir are displayed as Dir', :mswin do class My < Dir; end require 'tmpdir'