1
0
Fork 0
mirror of https://github.com/awesome-print/awesome_print synced 2023-03-27 23:22:34 -04:00

Merge pull request #366 from dweinand/fix-rails-5-builds

Fix build failures
This commit is contained in:
Bryan Hanks, PMP 2020-11-20 18:14:46 -06:00 committed by GitHub
commit 0d7b6debde
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 16 additions and 14 deletions

View file

@ -5,7 +5,7 @@ rvm:
- 2.3 - 2.3
- 2.4 - 2.4
- 2.5 - 2.5
- ruby-head - 2.6
before_install: before_install:
- gem install bundler - gem install bundler
@ -22,10 +22,9 @@ gemfile:
matrix: matrix:
include: include:
- rvm: ruby-head - rvm: 2.6
env: RUBYOPT="--enable-frozen-string-literal" env: RUBYOPT="--enable-frozen-string-literal"
# allow_failures: gemfile: gemfiles/rails_5.2.gemfile
# - rvm: ruby-head
addons: addons:
code_climate: code_climate:

View file

@ -8,6 +8,7 @@
appraise 'rails-5.0' do appraise 'rails-5.0' do
gem 'rails', '>= 5.0.0', '< 5.1' gem 'rails', '>= 5.0.0', '< 5.1'
gem 'sqlite3', '~> 1.3.6'
end end
appraise 'rails-5.1' do appraise 'rails-5.1' do

View file

@ -3,5 +3,6 @@
source "https://rubygems.org" source "https://rubygems.org"
gem "rails", ">= 5.0.0", "< 5.1" gem "rails", ">= 5.0.0", "< 5.1"
gem "sqlite3", "~> 1.3.6"
gemspec path: "../" gemspec path: "../"

View file

@ -55,7 +55,7 @@ module AwesomePrint
hash hash
end end
end end
"#{object} " << awesome_hash(data) "#{object} #{awesome_hash(data)}"
end end
# Format ActiveRecord class object. # Format ActiveRecord class object.
@ -95,7 +95,7 @@ module AwesomePrint
end end
data.merge!({details: object.details, messages: object.messages}) data.merge!({details: object.details, messages: object.messages})
"#{object} " << awesome_hash(data) "#{object} #{awesome_hash(data)}"
end end
end end
end end

View file

@ -31,7 +31,7 @@ module AwesomePrint
if options[:multiline] if options[:multiline]
multiline_array multiline_array
else else
'[ ' << array.map { |item| inspector.awesome(item) }.join(', ') << ' ]' "[ #{array.map { |item| inspector.awesome(item) }.join(', ')} ]"
end end
end end

View file

@ -73,7 +73,7 @@ module AwesomePrint
keys.map! do |key| keys.map! do |key|
plain_single_line do plain_single_line do
[inspector.awesome(key), hash[key]] [String.new(inspector.awesome(key)), hash[key]]
end end
end end
end end

View file

@ -22,7 +22,7 @@ module AwesomePrint
object.respond_to?(property) ? :reader : nil object.respond_to?(property) ? :reader : nil
end end
if accessor if accessor
["attr_#{accessor} :#{property}", var] [String.new("attr_#{accessor} :#{property}"), var]
else else
[var.to_s, var] [var.to_s, var]
end end
@ -60,7 +60,8 @@ module AwesomePrint
end end
def awesome_instance def awesome_instance
str = object.send(options[:class_name]).to_s str = String.new
str << object.send(options[:class_name]).to_s
str << ":0x%08x" % (object.__id__ * 2) if options[:object_id] str << ":0x%08x" % (object.__id__ * 2) if options[:object_id]
str str
end end

View file

@ -492,7 +492,7 @@ EOS
describe 'File' do describe 'File' do
it 'should display a file (plain)' do it 'should display a file (plain)' do
File.open(__FILE__, 'r') do |f| File.open(__FILE__, 'r') do |f|
expect(f.ai(plain: true)).to eq("#{f.inspect}\n" << `ls -alF #{f.path}`.chop) expect(f.ai(plain: true)).to eq("#{f.inspect}\n#{`ls -alF #{f.path}`.chop}")
end end
end end
end end
@ -501,7 +501,7 @@ EOS
describe 'Dir' do describe 'Dir' do
it 'should display a direcory (plain)' do it 'should display a direcory (plain)' do
Dir.open(File.dirname(__FILE__)) do |d| Dir.open(File.dirname(__FILE__)) do |d|
expect(d.ai(plain: true)).to eq("#{d.inspect}\n" << `ls -alF #{d.path}`.chop) expect(d.ai(plain: true)).to eq("#{d.inspect}\n#{`ls -alF #{d.path}`.chop}")
end end
end end
end end
@ -694,7 +694,7 @@ EOS
class My < File; end class My < File; end
my = File.new('/dev/null') rescue File.new('nul') my = File.new('/dev/null') rescue File.new('nul')
expect(my.ai(plain: true)).to eq("#{my.inspect}\n" << `ls -alF #{my.path}`.chop) expect(my.ai(plain: true)).to eq("#{my.inspect}\n#{`ls -alF #{my.path}`.chop}")
end end
it 'inherited from Dir should be displayed as Dir' do it 'inherited from Dir should be displayed as Dir' do
@ -702,7 +702,7 @@ EOS
require 'tmpdir' require 'tmpdir'
my = My.new(Dir.tmpdir) my = My.new(Dir.tmpdir)
expect(my.ai(plain: true)).to eq("#{my.inspect}\n" << `ls -alF #{my.path}`.chop) expect(my.ai(plain: true)).to eq("#{my.inspect}\n#{`ls -alF #{my.path}`.chop}")
end end
it 'should handle a class that defines its own #send method' do it 'should handle a class that defines its own #send method' do