-
Notifications
You must be signed in to change notification settings - Fork 340
Don't supress non-spring load errors in binstub #444
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
Conversation
Thanks for the pull request, and welcome! The Rails team is excited to review your changes, and you should hear from @grosser (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
The acceptance tests currently only cover the case of a missing spring gem, but not of a missing spring binary. If a missing spring binary should blow up with a load error, I could omit the check for spring_loader. |
Hmm, seems like Ruby 1.9.3 doesn't have |
211cc4b
to
2da00ee
Compare
OK, updated to use |
can you add an acceptance test that fails without this patch ? (like loading a random gem and asserting it blows up nicely) |
@@ -13,8 +13,9 @@ class Binstub < Command | |||
# should cause the "unsprung" version of the command to run. | |||
LOADER = <<CODE | |||
begin | |||
load File.expand_path('../spring', __FILE__) | |||
rescue LoadError | |||
load spring_loader = File.expand_path('../spring', __FILE__) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doing the assignment on an extra line would improve readability a bit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but it would also break the existing regex to check for the old/new style binstub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how is this breaking a regex ?
spring_loader = File.expand_path('../spring', __FILE__)
load spring_loader
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, both load File.expand_path('../spring', __FILE__)
and load spring_loader
match the regex /load .*spring/
in Spring::Binstub::Item#add
, so it's OK.
I think that's a great change/pattern, too many libraries do this rescue all ... |
@chancancode Oh, I didn't see your PR because it wasn't linked to the issue mentioned above. I think we could add a test to check for the case were the spring binary is missing. @grosser What do you think should be the intended behavior, when the |
is there any downside to ignoring it ? wrong version will be used / slower ? On Mon, Nov 16, 2015 at 6:42 AM, Felix Bünemann [email protected]
|
Well, it should only happen, if a user deleted |
So sounds like you think it's best to ignore it ? On Mon, Nov 16, 2015 at 8:41 AM, Felix Bünemann [email protected]
|
Yes, I'll add a test that makes the expected behavior explicit. |
2da00ee
to
2238047
Compare
Adressed feedback from @grosser and @chancancode and added a new test that checks the behavior in absence of a |
🎉 |
Don't supress non-spring load errors in binstub
1.4.2 is out ! |
Great, thanks Michael! |
Without this change, the spring binstub supresses unrelated load errors, eg. due to errors in initializers or loaded gems. This change causes the binstub to only ignore a missing spring loader or gem.
This will get rid of the misleading
warning: already initialized constant APP_PATH
and resolves #259.