customize_gemfiles drops error message
I added the following code to the Appraisals file, according to the documentation:
customize_gemfiles do
{
single_quotes: true,
heading: <<~HEADING
frozen_string_literal: true
`%<gemfile>s` has been generated by Appraisal, do NOT modify it or `%<lockfile>s` directly!
Make the changes to the "%<appraisal>s" block in `Appraisals` instead.
HEADING
}
end
The result of appraisal generate:
/home/peter/.rbenv/versions/3.4.2/lib/ruby/gems/3.4.0/gems/appraisal-2.5.0/lib/appraisal/customize.rb:3:in 'initialize': wrong number of arguments (given 1, expected 0) (ArgumentError)
from /home/peter/.rbenv/versions/3.4.2/lib/ruby/gems/3.4.0/gems/appraisal-2.5.0/lib/appraisal/appraisal_file.rb:39:in 'Class#new'
from /home/peter/.rbenv/versions/3.4.2/lib/ruby/gems/3.4.0/gems/appraisal-2.5.0/lib/appraisal/appraisal_file.rb:39:in 'Appraisal::AppraisalFile#customize_gemfiles'
from /home/peter/.rbenv/versions/3.4.2/lib/ruby/gems/3.4.0/gems/appraisal-2.5.0/lib/appraisal/appraisal_file.rb:47:in 'Appraisal::AppraisalFile#run'
from /home/peter/.rbenv/versions/3.4.2/lib/ruby/gems/3.4.0/gems/appraisal-2.5.0/lib/appraisal/appraisal_file.rb:45:in 'BasicObject#instance_eval'
from /home/peter/.rbenv/versions/3.4.2/lib/ruby/gems/3.4.0/gems/appraisal-2.5.0/lib/appraisal/appraisal_file.rb:45:in 'Appraisal::AppraisalFile#run'
from /home/peter/.rbenv/versions/3.4.2/lib/ruby/gems/3.4.0/gems/appraisal-2.5.0/lib/appraisal/appraisal_file.rb:22:in 'Appraisal::AppraisalFile#initialize'
from /home/peter/.rbenv/versions/3.4.2/lib/ruby/gems/3.4.0/gems/appraisal-2.5.0/lib/appraisal/appraisal_file.rb:13:in 'Class#new'
from /home/peter/.rbenv/versions/3.4.2/lib/ruby/gems/3.4.0/gems/appraisal-2.5.0/lib/appraisal/appraisal_file.rb:13:in 'Appraisal::AppraisalFile.each'
from /home/peter/.rbenv/versions/3.4.2/lib/ruby/gems/3.4.0/gems/appraisal-2.5.0/lib/appraisal/task.rb:32:in 'block in Appraisal::Task#initialize'
Without the block it works perfectly.
I also found the problem, but I'm not sure what to do with it.
In the gem's 2.5.0 version, the file lib/appraisal/appraisal_file.rb it contains this from line 37:
def customize_gemfiles(&_block)
Customize.new(yield)
end
This creates the problem, as it should be correct:
def customize_gemfiles(&_block)
Customize.new(**yield)
end
Strangely enough, in the main branch, it is correctly written in the repo, but the gem contains the wrong code.
@Antronin see #213, fixed in #214. See #204 for progress toward release of 3.0. In the meantime, you can try the prerelease: https://github.com/thoughtbot/appraisal/releases/tag/v3.0.0.rc1.