Skip to content

Handle when Spring is not installed#40913

Merged
rafaelfranca merged 1 commit intorails:masterfrom
jonathanhefner:handle-spring-not-installed
Dec 29, 2020
Merged

Handle when Spring is not installed#40913
rafaelfranca merged 1 commit intorails:masterfrom
jonathanhefner:handle-spring-not-installed

Conversation

@jonathanhefner
Copy link
Member

Spring is not in the default :test gem group, and may not be installed in some testing environments, such as CI.

Fixes #40911.

@rails-bot rails-bot bot added the railties label Dec 22, 2020
@jonathanhefner jonathanhefner force-pushed the handle-spring-not-installed branch 2 times, most recently from 0642f2b to 557f6ee Compare December 23, 2020 14:05
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/rubygems/rubygems/blob/a969c0f16aa56cdb69e2a051f2b093427010e1d9/lib/rubygems/errors.rb#L23-L27

Instead of rescuing from this class, make sure to rescue from the superclass Gem::LoadError to catch all types of load errors.

Suggested change
rescue Gem::MissingSpecError
rescue Gem::LoadError

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've changed it to Gem::LoadError, but I'm not 100% sure that is more suitable. I think the documentation is generally good advice, but, since we are swallowing the error, being more specific might be better. On the other hand, Gem::ConflictError is currently the only other subclass of Gem::LoadError, and the !defined?(Spring) guard should prevent us from causing / swallowing such an error, so perhaps it doesn't matter.

@rafaelfranca rafaelfranca modified the milestones: 6.2, 6.1.1 Dec 28, 2020
Spring is not in the default `:test` gem group, and may not be installed
in some testing environments, such as CI.

Fixes rails#40911.
@jonathanhefner jonathanhefner force-pushed the handle-spring-not-installed branch from 557f6ee to 2a4fa7e Compare December 28, 2020 16:56
@rafaelfranca rafaelfranca merged commit d73ddc6 into rails:master Dec 29, 2020
rafaelfranca added a commit that referenced this pull request Dec 29, 2020
…lled

Handle when Spring is not installed
jcoyne added a commit to sul-dlss-deprecated/happy-heron that referenced this pull request Feb 2, 2021
i.e. in production.

This allows us to do `bin/rails c -e p` on the servers again

See: rails/rails#40913
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

3 participants