Fix error when using Appraisal and install_if#226
Merged
nickcharlton merged 1 commit intothoughtbot:mainfrom Sep 23, 2024
n-rodriguez:wip/combustion
Merged
Fix error when using Appraisal and install_if#226nickcharlton merged 1 commit intothoughtbot:mainfrom n-rodriguez:wip/combustion
nickcharlton merged 1 commit intothoughtbot:mainfrom
n-rodriguez:wip/combustion
Conversation
Member
nickcharlton
left a comment
There was a problem hiding this comment.
This looks good! We can merge this in once we've gone through #230.
```sh An error occurred while loading ./spec/draper/draper_spec.rb. Failure/Error: Bundler.require(*Rails.groups) SyntaxError: /Users/nicolas/.asdf/installs/ruby/3.3.3/lib/ruby/gems/3.3.0/gems/appraisal-2.5.0/lib/appraisal/gemfile.rb:52: syntax error, unexpected `end' ``` Instead of using a raw String as explained here (#176) it uses the interpreted version: ```sh --- |- source "https://rubygems.org" gem "appraisal" gem "capybara" gem "cuprite" gem "database_cleaner" gem "factory_bot" gem "faker" gem "guard-rspec" gem "puma" gem "rake" gem "rspec-rails" gem "rspec-retry" gem "rubocop" gem "rubocop-capybara" gem "rubocop-factory_bot" gem "rubocop-rake" gem "rubocop-rspec" gem "simplecov" gem "sqlite3", "~> 1.5.0" gem "rails", "6.1.7" install_if #<Proc:0x000000011f590cc0 /Users/nicolas/PROJECTS/CONCERTO/gems/draper/gemfiles/rails_6.1.7.gemfile:25 (lambda)> do gem "net-imap" gem "net-pop" gem "net-smtp" end install_if #<Proc:0x000000011f5909f0 /Users/nicolas/PROJECTS/CONCERTO/gems/draper/gemfiles/rails_6.1.7.gemfile:31 (lambda)> do gem "base64" gem "bigdecimal" gem "mutex_m" gem "drb" gem "logger" end gemspec path: "../" ```
javierjulio
added a commit
to javierjulio/dartsass-rails
that referenced
this pull request
Nov 11, 2024
This bumps the Bundler version to resolve `warning: constant DidYouMean::SPELL_CHECKERS is deprecated` warnings. This installs zeitwerk 2.6 for now. I couldn't get this work with appraisal's `install_if` method introduced in v2.5.0 which has a hard error. It's been fixed in thoughtbot/appraisal#226 but has no release. For now we'll install zeitwerk 2.6 since 2.7 requires Ruby 3.2+.
santiagorodriguez96
added a commit
to cedarcode/devise-webauthn
that referenced
this pull request
Jan 7, 2026
We were running into a weird issue after starting using `install_if` in 4e7fdb6: ``` SyntaxError: /home/runner/work/devise-webauthn/devise-webauthn/vendor/bundle/ruby/3.4.0/gems/appraisal-2.5.0/lib/appraisal/gemfile.rb:46: syntax error found (SyntaxError) 44 | install_if #<Proc:0x00007fb6ce1724d8 /home/runner/work/devise-webauthn/devise-webauthn/gemfiles/devise_5_0.gemfile:22 (lambda)> do 45 | gem "rack", "~> 2.2" > 46 | end | ^~~ unexpected 'end', ignoring it 47 | 48 | gemspec path: "../" ``` This is an Appraisal bug fixed in thoughtbot/appraisal#226, but not released yet. However, as this happens when loading `appraisal` when using our `devise_5_0` generated gemfile that has the `install_if` directive, we can simply fix it by preventing it from loading using `require: false` (which allow us to continue using `appraisal` normally as we were too).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I've added some debug around
def dup(puts YAML.dump(for_dup)right beforegemfile.run(for_dup, __FILE__, __LINE__):appraisal/lib/appraisal/gemfile.rb
Lines 22 to 26 in be4fa01
Instead of using a raw String as explained here (#176) it uses the interpreted version: