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

Add support for Ruby 3.3 #105

Merged
merged 2 commits into from
Jan 9, 2024
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
1 change: 1 addition & 0 deletions .github/workflows/rspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
- "3.0"
- "3.1"
- "3.2"
- "3.3"
- "head"
- "jruby-9.3"
runs-on: ${{ matrix.os }}-latest
Expand Down
7 changes: 7 additions & 0 deletions gemfiles/rails_6.1.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,14 @@
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 "sqlite3", platform: :mri

gemspec path: "../"
7 changes: 7 additions & 0 deletions gemfiles/rails_7.0.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,14 @@
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 "sqlite3", platform: :mri

gemspec path: "../"
7 changes: 7 additions & 0 deletions gemfiles/sequel_5.0.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@

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 "sequel", "~> 5.0"
gem "sqlite3", platform: :mri

Expand Down
2 changes: 1 addition & 1 deletion lib/amazing_print/core_ext/awesome_method_array.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions spec/ext/nokogiri_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
it 'colorizes tags' do
xml = Nokogiri::XML('<html><body><h1></h1></body></html>')
# 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
<?xml version="1.0"?>\e[1;32m
\e[0m<\e[1;36mhtml\e[0m>\e[1;32m
Expand All @@ -32,7 +32,7 @@
it 'colorizes class and id' do
xml = Nokogiri::XML('<html><body><h1><span class="world" id="hello"></span></h1></body></html>')
# 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
<?xml version="1.0"?>\e[1;32m
\e[0m<\e[1;36mhtml\e[0m>\e[1;32m
Expand Down
16 changes: 8 additions & 8 deletions spec/formats_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -695,21 +695,21 @@ 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'
my = My.new(Dir.tmpdir)
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'
Expand Down