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
Fixed crash if a .gemspec has a string for require_paths variable. #904
Conversation
@@ -134,7 +134,7 @@ def full_name | |||
# activated. | |||
|
|||
def full_require_paths | |||
full_paths = @require_paths.map do |path| | |||
full_paths = [@require_paths].flatten.map do |path| |
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.
Why not use Array(@require_paths)
instead?
a = %w(lib ext) #=> ["lib", "ext"]
b = "lib"
Array(a) #=> ["lib", "ext"]
Array(b) #=> ["lib"]
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.
You're right that's much nicer. I found two tests that had the wrong variable require_path instead of require_paths set; require_path isn't used. I'll post the chages here in the pull request.
@danielpclark thank you for your pull request. Would you mind adding a test to verify this fix? Thank you. |
I've fixed an existing test. Changed require_path to require_paths since require_path doesn't actually get used. Without the Array(@require_paths) fix the tests would fail. Thank you for your nicer looking code tip @luislavena . |
I'm afraid the changes to the implementation may re-break elsewhere if Instead, can you replace the |
Missed by 4e5f3e3
Missed by 4e5f3e3
Shouldn't
per @drbrain's suggestion. And
should now be
to avoid getting an array within an array with [] to [[]]? I've submitted it to commit #909 |
|
Yes sir. You showed that to me earlier when I used the .flatten method. It is the right way to do it. I had later seen it in one of Avdi Grimm's presentations. |
Addresses open issue "require_path from gemspec is type sensitive. #890".